Log in or register to post comments

Apply Camera ImageTarget Texture on Model

October 13, 2013 - 12:54am #1

Hi, First i want to display 3d model on ImageTarget when my whole imagetarget is visible on deviceCamera , if partial imageTarget seen on deviceCamera i want to diaplsy transparent plane.as well as how i can take only camera ImageTarget texture ? Currently im able to take cameraTexture & able to apply on model.

Please help me very urgent.....

Apply Camera ImageTarget Texture on Model

October 26, 2013 - 12:47pm #5

I suspect that the Y value is static because screen space is 2D - are you seeing a changing Z that you can use for height?

Apply Camera ImageTarget Texture on Model

October 26, 2013 - 2:47am #4

Could you please help me , for getting proper imagetarger height in ARCamera view??

Apply Camera ImageTarget Texture on Model

October 23, 2013 - 11:53am #3

Hey David Thanks for reply!

I am very near to my goal but having some problems. Post which you shared for getting TargetImage width, height & X Y location im refering that but there is some problems in Y co-ordinates value. I am not getting changing Y coordinates value if i change target location also. But in the case of changing X location im getting correct value.

 

Code:

   float  wid = Screen.width;
    float    hei = Screen.height;
     

Vector3 origin = Camera.main.WorldToScreenPoint(newVector3(GameObject.Find("ImageTargetTarmac").collider.bounds.min.x,GameObject.Find("ImageTargetTarmac").collider.bounds.max.y, 0f));
            
Vector3 extent = Camera.main.WorldToScreenPoint(new Vector3(GameObject.Find("ImageTargetTarmac").collider.bounds.max.x, GameObject.Find("ImageTargetTarmac").collider.bounds.min.y, 0f));
  

    Debug.Log ("Screen width : " + wid + "  ,Screen height :: " +hei);

                 Debug.Log ("Target X--> " + origin.x + "    ,   Target Y-->" + origin.y);

 

                         Debug.Log ("Target EndPoint X--> " + extent.x + "    ,Target EndPoint Y-->" + extent.y);
 

    float aTemp = extent.x-origin.x;

        float bTemp = origin.y-extent.y;
       
                 Debug.Log ("Texture Width: " + aTemp + "Texture Height:: " + bTemp);
 

 

Logs:

 

Screen width : 480  ,Screen height :: 854
UnityEngine.Debug:Log(Object)
Target X--> 62.42326    ,   Target Y-->278.6966
UnityEngine.Debug:Log(Object)
Target EndPoint X--> 428.7334    ,Target EndPoint Y-->278.6966
UnityEngine.Debug:Log(Object)
Texture Width: 366.3102Texture Height:: 0
UnityEngine.Debug:Log(Object)

 

 

even im changing ImageTarget Y location im getting ,"Target Y-->278.6966" &"Target EndPoint Y-->278.6966"  only

 

 

Apply Camera ImageTarget Texture on Model

October 13, 2013 - 2:56pm #2

By 'take ImageTarget texture' do you mean to extract the image of the target in the camera view?

To determine whether the entire target is visible, you'll need to determine its size and position in screen space to see whether the entire target is visible based on the position + width/2 and height/2

Here are some solutions for finding the scaled size of the target, accounting for camera perspective - http://answers.unity3d.com/questions/49943/is-there-an-easy-way-to-get-on-screen-render-size.html

Log in or register to post comments