Log in or register to post comments

Region Capture

July 12, 2015 - 3:41pm #19

Thanks for great asset! 
Can you explain how to save captured texture to file?

 

GOtoApplyTexture - object that we paint on

 mainTextureAs2D- mainTexture from GOtoApplyTexture object

 TextureToSave   - public Texture2D  -  original mainTexture of GOtoApplyTexture object

 

 mainTextureAs2D = GOtoApplyTexture.GetComponent<Renderer>().material.mainTexture as Texture2D;
 mainTextureAs2D.Resize(TextureToSave.width, TextureToSave.width);
 
        for (int i = 0; i < TextureToSave.width; i++)
            for (int k = 0; k < TextureToSave.height; k++)
            {
                TextureToSave.SetPixel(i, k, mainTextureAs2D.GetPixel(i, k));
            }
TextureToSave.Apply();
 
 
in console i get error "NullReferenceException: Object reference not set to an instance of an object"  for this line:
mainTextureAs2D.Resize(TextureToSave.width, TextureToSave.width);
 
which means that unity can't get texture from this line:
mainTextureAs2D = GOtoApplyTexture.GetComponent<Renderer>().material.mainTexture as Texture2D;
 
 
 

Region Capture

July 12, 2015 - 3:34pm #18

Thanks for great asset! 
Can you explain how to save captured texture to file?

Region Capture

July 6, 2015 - 6:24am #17

Ok.. I added version for Unity 4X.

Now, all versions will be available on SourceForge.

Region Capture

July 6, 2015 - 1:27am #16

I was getting some weird probelms with the unity 5.0 version. When i build the android app, the app was laggy and crashed every now and then. With the older version i'm not having such issues, so i decided to use the older version.

I tried to create the region capture prefab my self, but wasn't able to get the region capture perfectly. i think i might be having an issue with the shader script. The camera feed looks distorted on my region capture prefab. Any idea on how to go fix that. I seriously am out of ideas as to how to fix that

Region Capture

July 5, 2015 - 12:44pm #15

Why do you use an older Unity version?

Region Capture

July 4, 2015 - 2:18pm #14

So i'm working with unity 4.6

 

and when i import the region capture project, i'm unable to use the region_capture prefab for some reason.

do you have any idea why this might be an issue.

 

I tried to work your code in unity 5.0 it worked fine

Region Capture

June 29, 2015 - 7:52am #13

Great !! it's exactly what i want to do. Thank you very much!

Region Capture

June 28, 2015 - 11:42am #12

I have read your request and I added some new elements in the code.

– RenderTexture draw in GUI   --- ("Show Texture" checkbox)

– Auto Position and Scale  ---  ("Auto Region Size" checkbox)

– Update help information --- (new ReadMe.txt)

 

Click here – Setup image

AttachmentSize
Package icon region_capture_1.3.zip10.09 KB

Region Capture

June 26, 2015 - 10:20am #11

ok i'm just a complete newbie to this, so ths question may sound very trivial.

 

I want to obtain the image as Texture2d and i can't figure out how to go about it.

Some guidlines as to how to go about it

Region Capture

June 24, 2015 - 6:05pm #10

oh, I see, what we want to do now is change the position, rotation of "region_capture" reference to the position of "Image Target" ?

Region Capture

June 24, 2015 - 11:38am #9

For scale size? .. 

I just know the aspect ratio of my prefab to ImageTarget.  (1/10)

 

Region Capture

June 24, 2015 - 10:44am #8

how are you doing the calculation for it ?

Region Capture

June 24, 2015 - 10:28am #7

OK. 

Set your "region_capture" prefab size is 256 / 10 = 25.6

Region Capture

June 23, 2015 - 11:59pm #6

256 for the image target scale.

Region Capture

June 23, 2015 - 11:35pm #5

I mean - the scale values of the ImageTarget.

Region Capture

June 23, 2015 - 11:22pm #4

512 x 512 pixel

Region Capture

June 23, 2015 - 1:14am #3

What is the size of your ImageTarget?

Region Capture

June 22, 2015 - 7:39pm #2

Thank you very much about your code !
I followed your guide, but it just wrap everything which camera watched to "Region_Capture" material. Should i finish step 5 before i can get just image target in camera image ? and you sad that use Scale, Position, and Rotation, these modifies attack to texture of material ?

Pages

Log in or register to post comments