Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unified Coordinate System for String and QCAR

Discussion in 'Scripting' started by Elecman, Oct 15, 2011.

  1. Tuxxo

    Tuxxo

    Joined:
    Sep 4, 2013
    Posts:
    15
    sorry, if I understand the move to take box_lidTop in MainCamera?

    MainCamera active and i do a screenshot(Texture2D)?

    that's right?
     
  2. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
  3. Tuxxo

    Tuxxo

    Joined:
    Sep 4, 2013
    Posts:
    15
    I tried to do so but the Main Camera and ARCamera mix!.

    I wish I had the image of the marker to be applied to a model like this app:
    http://colarapp.com/

    please let you tell me exactly get the exact picture of the marker recovery?

    I created a script that:

    1) moves box_lidTop in Main Camera
    2) Active Main Camera
    3) Take A picture: Application.CaptureScreenshot ("Screenshot.png");

    but the scene I see AR Camera with mainCamera, I have no idea how to do ...
     
  4. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    I don't have access to UCS at the moment but from what I remember is that MainCamera contains the end result you see on screen and ARCamera contains just the video feed. But if you use CaptureScreenshot, you should get the result from MainCamera.

    Can you post a screenshot from CaptureScreenshot?
     
  5. Tuxxo

    Tuxxo

    Joined:
    Sep 4, 2013
    Posts:
    15
    marker.png
    OK! I created the marker photo! but it is not quality ..

    In any case I think it is acceptable, at least I think ...
     
  6. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    I think the latest Vuforia version has an option to increase the quality, but I didn't try that yet.
     
  7. Tuxxo

    Tuxxo

    Joined:
    Sep 4, 2013
    Posts:
    15
    hi Elecman, after many tests I got some good screenshots on my device! .. but I have a problem ..

    by 10 screenshots, I get similar results but with noticeable errors for UV Map model!

    how do I get always the same image without pixel-error to have a UV map is always the same?

    I used this to create the image on the device, it is slightly slower:

    var tex = new Texture2D ((int) camera.pixelWidth, (int) camera.pixelHeight, TextureFormat.RGB24, false);

    tex.ReadPixels (new Rect (0,0, camera.pixelWidth, camera.pixelHeight), 0, 0);
    / / tex.Resize (1024.768);
    tex.Apply ();
    NEWTEX var = Instantiate (tex);
    / / renderer.material.mainTexture = NEWTEX;
    TextureScale.Bilinear (tex, (int) 1024, (int) 724);

    do you have any idea how to do? ..
    I do not know how to contain the pixel-error ---
     
  8. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    Hm, not sure why that is. Are you sure your game object containing the frozen video texture is in the correct location in relation to the marker? Can you post a screenshot of this?
     
  9. taforyou

    taforyou

    Joined:
    Jul 15, 2012
    Posts:
    13
    Excuse me, i'm not sure am i ask the right place ? According to this video



    at 2:26 plane comming out from painted paper and texture of that plane cover by color that player already painted

    is there any how that this technique related to ucs ? and is that possible to do something like that in unity3d ?

    Thank you in advance
     
    Last edited: Jul 17, 2014
  10. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    That is not really related to UCS, although UCS contains a shader which you can use to approximate that effect. Have a look at the VidTexPatch example. See the UCS documentation for more details.
     
  11. boubouk50

    boubouk50

    Joined:
    Jul 10, 2014
    Posts:
    15
    Hi,
    I'm currently testing UCS (awesome by the way) and I've got few questions about it.
    The pitch:
    I need to augment a entire empty room with funitures and lining (nearly VR). I need the augmentation to be the fluidest and nothing has to pop when a tracker is found (what happens if I use common tracking). I also want to have the fewer marker as possible. (Clients...)
    The questions:
    * I was wondering if I can set up a full room with UCS (vertical and horizontal markers) and what would be the best way to do it.
    * How many markers is best for calibration? I mean at the same time in view.
    * How much markers max can I have at the same time with good performances.

    I've tested it with Unity, Vuforia and Frame Markers on a Galaxy Tab Pro. It's shaky, and swapping from vertical to horizontal markers is worse. I've tried with 5 markers (2 ground, 1 wall, 2 other wall), and I've set up the scene with 3 markers max in view. Indoor condition, indoor lighting.

    Thanks a lot,
    Antoine.
     
  12. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    Yes, that can be done, although I am not sure what the difference is between a vertical and horizontal marker. Do you mean an A4 size marker horizontal or vertical? In that case, it makes no difference. The best way to set it up is to make sure your markers are large enough for the camera distance used. If you want to cover a large distance range, you need to use both large and small markers together. Then spread the markers across the room so that there are always at least 2 markers in view as you pan the camera around. The distance between the markers depends on the distance to the camera and the size of the markers. It is best to experiment with a few different setups.

    You need at least two markers in view at any time, and one of the markers of the previous frame must be in view in the current frame as well. This is because the location of a maker can only be known if the location of the marker next to it is known. More markers is better though because it uses an average. There is a detailed explanation of this in the manual.

    That depends on the type of markers you use. Frame markers are the fastest and are not really affected by performance but the binary pattern is a bit small. If you use image targets you will run into performance issues but that also depends on the hardware you use. The only way to find out is to experiment with it.
     
  13. boubouk50

    boubouk50

    Joined:
    Jul 10, 2014
    Posts:
    15
    Thanks.
    I was curious about its limits (low and high) to know what are the min and max requirement for markers for setting up a scene, and its related accuracy.
    I mean for example:
    • with 5 markers and 2 max in view: ≃70% accurate
    • 5 markers, 3 max: ≃73%
    • 8 markers, 3 max: ≃80%
    • 8 markers, 5 max: ≃90%
    • 15 markers, 3 max: ≃88%
    • ...
    You know like a performance graph that would help me to chose the closest configuration depending on my expectation (Few marker, good accuracy). Anyway, I will make lot of tests to find out what fits me the most. It's not a waste of time for me, just a waste for my boss's wallet :)
    Thank you again.
     
  14. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    You are right, there is an ideal situation with as little markers as possible. That would be easier to setup and less ink and paper required. More markers doesn't necessarily make it more accurate though, just more robust panning around. What does make it much more accurate is using markers which are as large as possible.
     
  15. m_bombin

    m_bombin

    Joined:
    Aug 10, 2014
    Posts:
    5
    Hello.
    Do i need to record scenes for example scenes to see them? Getting "scene not saved yet" when trying to load them. I assume that i doing something wrong about all of it, maybe i misunderstood tutorial for scenes or something like that.
     
  16. elixir-bash

    elixir-bash

    Joined:
    Mar 27, 2012
    Posts:
    23
    test1.jpg Hi ElecMan,

    I have been playing with UCS for a while and im in love with your coding skills. I also loved the inscript comments :D
    Currently im trying to make use of the vidtexpatch functionality to create a live transform effect in our Ar experience.
    I have noticed a small deformity in the UV adjustment when capturing the same target from different angle. I tried to remove the deformity but i failed here and i totally don know where to look at now.
    Please find attachments of pictures refering to the issue im facing.
    test1.jpg
     
    Last edited: Aug 13, 2014
    GhostSoar likes this.
  17. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    @m_bombin:
    Yes, you need to record it first.

    @elixir.bash:
    -Does the example scene work?
    -The shader only works if the geometry is placed on the ground plane, facing up.
    Let me know if that solves it.
     
  18. elixir-bash

    elixir-bash

    Joined:
    Mar 27, 2012
    Posts:
    23
    @Elecman

    Hi it is the sample scene that i have used to take the screenshots. I Have just commented the rotation code in the update.
    i have also mailed you few pictures. Also im attaching reference of jpg images as a zip files that i save from the feed.
     

    Attached Files:

  19. m_bombin

    m_bombin

    Joined:
    Aug 10, 2014
    Posts:
    5
    i try to do it, but it says that i should set the base frame. i'm tapping on the markers, but nothing actually happends, and it doesn't react on markers in any way - is it normal, or i haven't activated something?
     
  20. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    @m_bombin
    -Do you see a blue outline or square rendered on top of the marker?
    -Are you using one of the UCS markers or your own marker?
    If you don't see the blue outline or square, it doesn't recognize the marker.

    @elixir.bash:
    -Does it work if you use the original code, with the rotation code intact?
    -I am not sure what the problem is if I look at the pictures you mailed me. To me it just seems distorted, but there are no seams visible. What is the difference with the screenshots on the forum?
     
  21. elixir-bash

    elixir-bash

    Joined:
    Mar 27, 2012
    Posts:
    23
    @Elecman
    Even with rotation I see a distortion .
    The pictures that I have mailed are the pictures that I save as a png file..
    Whatever vidtexpatch object displays , I capture it and save it to a pngfile
    Also I made sure the vidtexobject has equal scale coords
    There are actually 2 issues; the seam and second one is distortion .
    Distortion seems like a bigger devil...
     
  22. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    -Did you use the original box geometry that came with UCS?
    -Do you use your your own geometry?
    -Did you modify the original geometry or its hierarchy?

    The shader is very picky with geometry, scale, and orientation.
     
  23. elixir-bash

    elixir-bash

    Joined:
    Mar 27, 2012
    Posts:
    23
    @Elecman
    I used the original box. The one with just four vertices
    I actually added a 3 D model as a child to the box top plane. No other modifications were done. I have also changed the dataset for testing purpose .
     
  24. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    Hm, strange.

    Maybe you can send me your test project? I will have a look.
     
  25. elixir-bash

    elixir-bash

    Joined:
    Mar 27, 2012
    Posts:
    23
    @Elecman
    That would be great !! Will share it once I reach office tomorrow.
    I really appreciate your help!!
     
  26. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    No problem.
     
  27. m_bombin

    m_bombin

    Joined:
    Aug 10, 2014
    Posts:
    5
    It started to work finally :) I didn't understand what i did actually, but following the steps from manual for third time make it work.
    I'm trying to get an effect of getting an texture from coloured ImageTarget too, hope i can find out how to do it. The guys from Vuforia gave an example of how to do it, but only in a native SDK, cause it's written on С++. Or maybe i don't know how to make this work in Unity too. If anyone already solved that problem - would be great getting an advice.
     
  28. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    You can get the texture using the VidTexPatch example in UCS. Scroll through this thread and you find some related posts. It is an advanced subject though.
     
  29. elixir-bash

    elixir-bash

    Joined:
    Mar 27, 2012
    Posts:
    23
    @Elecman Kindly check your mail.
    I have shared the project.
     
  30. aum

    aum

    Joined:
    Dec 17, 2012
    Posts:
    20
    Hi Elecman, same m_bombin, I'm trying to create a texture from just the marker zone with the natural ilumination, and same says m_bombin Vuforia gave an example but not in unity code, I 'm tried to understand the UCS code with the specialeffects.cs(VidTexPatch) but I'm really lost. Do you have a litle example for just extract the texture patch zone marker for save it in a png.
    I thing that many users would be interested because searching in the post many people ask the same.. :)

    https://developer.vuforia.com/resources/dev-guide/camera-target-patch

    Thanks in advance.

    Alvaro
     
  31. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    I recommend changing the example step by step. Change one line of code or object at a time and see if it works. Keep in mind these issues:

    -This effect requires a flat plane and object deforming is not supported.
    -The object must be parallel to the ground plane and has to face up, with the camera facing down on it.
    -The object has to have a rotation of 0,0,0, so if that gives an object which does not face up, you have to change the mesh.
    -The object should remain stationary with the camera moving around it. Keeping the camera stationary with the object moving around it will not work.
    -The object must have a uniform scale such as 1, 1, 1, or 2, 2, 2, but not for example 1, 0.5, 1. If you want to create a different shape you have to change the mesh itself.
    -Do not use the boxlidtop mesh if you want to use your own effect as the UV mapping of that geometry is not suitable for modification. Use the build in Unity plane geometry (not the quad) instead.

    I understand that the current implementation is hard to change to another project. I will change it at some point in the not too distant future.

    Let me know if you need some more help but be specific with what exactly the problem is.
     
  32. m_bombin

    m_bombin

    Joined:
    Aug 10, 2014
    Posts:
    5
    i'm expirimenting with example, but seems to me it works with a problems. i used a VidTextPatch, and get a result like this:
    Seems like it's not what i'm supposed to recieve? Or is it normal?
     
  33. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    The effect you are seeing is caused by incorrect UV mapping.
    Make sure these rules are adhered to:

    -This effect requires a flat plane and object deforming is not supported.
    -The object must be parallel to the ground plane and has to face up, with the camera facing down on it.
    -The object has to have a rotation of 0,0,0, so if that gives an object which does not face up, you have to change the mesh.
    -The object should remain stationary with the camera moving around it. Keeping the camera stationary with the object moving around it will not work.
    -The object must have a uniform scale such as 1, 1, 1, or 2, 2, 2, but not for example 1, 0.5, 1. If you want to create a different shape you have to change the mesh itself.
    -Do not use the boxlidtop mesh if you want to use your own effect as the UV mapping of that geometry is not suitable for modification. Use the build in Unity plane geometry (not the quad) instead.

    Let me know if that fixes the problem.
     
  34. m_bombin

    m_bombin

    Joined:
    Aug 10, 2014
    Posts:
    5
    Now i use only an example from UCS without changing something in it, and an image target is pinned to the wall. Well, camera is stationary too, so don't think it can be a problem here. Maybe i didn't used some parameter at post-install phase?
     
  35. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    Is that marker the only one you use or do you use multiple markers in that scene?

    Does it work in the Editor with a webcam?

    I know that the shader is temperamental, my apologies for that. I will try to fix it but so far with not much success.
     
  36. ljhvr01

    ljhvr01

    Joined:
    Aug 13, 2014
    Posts:
    4
    Hello Sir.

    I have tried to record with the manual offered in this post.

    However, It did not work when I tried to select a marker.

    I just used Vectrosity 2.3, ObjReader 2.3.2, UniFileBrowser 2.4.1 with description of the manual

    Would I able to ask completed project file of UCS?

    So that I can check which parts I missed.

    My E-mail address is ljhvr01@gmail.com

    Thank you.
     
  37. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    It will only work with the supplied markers. If you use your own marker then you will have to change the database. Also, you have to start recording first before you can select a marker.

    Does it show a blue outline or blue plane on top of the marker?
     
  38. ljhvr01

    ljhvr01

    Joined:
    Aug 13, 2014
    Posts:
    4
    I tried both IMAGE_TARGET and Frame_Marker though...

    I could not find blue outline just like a video clip or App you have provided.

    I touched the button "Start Recording" and waited for a moment just in front of Frame Markers. :eek:
     
  39. ljhvr01

    ljhvr01

    Joined:
    Aug 13, 2014
    Posts:
    4
    Oh~ Sorry for bothering Sir.

    I just figured out what the problem was.

    I did not have enough time to make my camera track frame markers

    Anyway Thank you for your reply.
     
  40. ljhvr01

    ljhvr01

    Joined:
    Aug 13, 2014
    Posts:
    4
    Hello Sir.

    I have a question on loading my game in UCS

    I made a simple game which has it's own main camera to handle game scene.

    I would like to know how to load my game just like your UCS App for Android with car game.

    Thanks
     
  41. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    This is described in the UCS manual under the chapter "Scene Setup". Have a look and let me know if you are stuck.
     
  42. jasontcy

    jasontcy

    Joined:
    Sep 12, 2014
    Posts:
    3
    Hi Elecman,

    Somehow after save & record the Target Image, when i clicked on Game mode but the 3D model do not appear on the Target Image. After that I try placing Vuforia default Target Image prefab in Scene and it work.

    I want to ask did I screw up during the installation?

    I install latest Vuforia + UCS 1.2+Vectrosity 3.0 only.
     
    Last edited: Sep 13, 2014
  43. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    Not sure what went wrong. The only way to find out is if you post exactly in great detail what you did step by step. The installation and setup process is quite complex so it is easy to get wrong.
     
  44. jasontcy

    jasontcy

    Joined:
    Sep 12, 2014
    Posts:
    3
    Thx for reply and I found out the problem, i activated the data set in the AR camera. That why its buggy.

    Can you explain to me about the UV mapping code you used. Im a little confused on how it works. .
     
  45. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    The UV mapping is done inside a shader called VidTexDeform and VidTexPatch. It basically takes the current camera matrix and uses this to map the texture instead of the mesh UV coordinates.
     
  46. jasontcy

    jasontcy

    Joined:
    Sep 12, 2014
    Posts:
    3
    Elecman, I noticed the texture captured by the webcam is quite blur. Do we have any ways to increase the picture quality or the resolution? .
    -Currently im using a HD 1080p webcam.

    Furthermore, how can i detect the vertex points of the line bound in world space coordinate?
    As shown in the picture below, i want to get the coordinate of those 4 vertices.

     
    Last edited: Sep 19, 2014
  47. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    To increase the texture quality, please refer to the Vuforia documentation.

    To get the world coordinates of the marker corners, just take the marker transform, then transform 4 points so it matches the corners. For this you need to know the marker size, but you can get it from the data file.
     
  48. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    You mentioned using SLAM, which I believe I saw you say somewhere that you were using PointCloud to implement for the mobile devices. My question is seeing as PointCloud only supports iOS, how did you get the SLAM functionality to work on Android?
     
  49. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    Yes, that was done using PointCloud but as you mentioned, that doesn't work on Android and it never did. But 13th lab is working on that, or so they say.
     
  50. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    So does your Unified Coordinate System support Android due to limitation, or only iOS at the moment?