Log in or register to post comments

any luck with screenshots?

April 12, 2012 - 12:26pm #1

I noticed that when using Texture2D.ReadPixels() that what is being rendered by ARCamera is not captured.

So I created a RenderTexture and was able to successfully render the ARCamera's view to a Texture2D.

Problem with that is that it doesn't capture the background (i.e., what the iPhone's camera is picking up).

So, the bottom line is this:

1. ReadPixels() will capture what the iPhone's cam is seeing.
2. Using RenderTexture allows you to capture what the ARCamera is rendering (into a Texture2D).

But I need both :)

Any thoughts?

Re: any luck with screenshots?

April 13, 2012 - 3:34pm #11

Thanks for the update!

Readme.txt should be in the Assets folder (so you should see it in Unity as well). It was only added with the final 1.5.8 release, you're not using the beta?

- Kim

Re: any luck with screenshots?

April 13, 2012 - 7:00am #10

Thanks, Kim! I don't know why I'm so retarded, but I can't find the readme in the BackgroundTextureAccess folder anywhere!

Anyways, the problem has been solved. We found that the ReadPixels call captured the screen before the frame was finished rendering, which is why we weren't getting the AR content.

Re: any luck with screenshots?

April 13, 2012 - 6:50am #9

I'm not sure how to composite your two Texture2D objects without rendering them to yet another buffer and then grabbing that texture (which is going to be rather expensive).

MoSR is right about using the BackgroundTextureAccess sample. That sample includes a Readme that explains how to render the camera background using the ARCamera. You just need to disable the BackgroundCamera object and enable the VideoBackground child of the ARCamera. Now the ARCamera is rendering everything using the typical Unity rendering pipeline, and you should be able capture everything in a single RenderTexture.

Let us know if that works for you!

- Kim

Re: any luck with screenshots?

April 13, 2012 - 5:25am #8

Ok, after having a peak at BackgroundTextureAccess, I'm wondering if anyone has accomplished the same approach in Unity?

I mean, I already capture the camera feed into a texture. So that's done.

I already capture what ARCamera renders into a texture (including the background of the ARCamera... which is just black).

Re: any luck with screenshots?

April 13, 2012 - 5:12am #7
MoSR wrote:

1) You can use the same technique as in BackgroundTextureAccess to get the camera feed into a texture, rather than do your own thing - up to you

2) You should then render that texture as a rectangle into the background of your render context for your new texture

3) you can then render your augmentations into that same render context

You should now have a single texture from your render context with both parts combined.

Ok, I'm a little lost at #2, but I'll look into those examples you mentioned.

Re: any luck with screenshots?

April 13, 2012 - 3:34am #6

1) You can use the same technique as in BackgroundTextureAccess to get the camera feed into a texture, rather than do your own thing - up to you

2) You should then render that texture as a rectangle into the background of your render context for your new texture

3) you can then render your augmentations into that same render context

You should now have a single texture from your render context with both parts combined.

Re: any luck with screenshots?

April 13, 2012 - 3:23am #5

Ok, I have been able to successfully capture the background into one texture, and the AR rendering into another. Is that what you mean? If so, then yes, I have two Texture2D objects that together contain what I want. But I'm not sure where to go from there.

Re: any luck with screenshots?

April 13, 2012 - 2:42am #4

Hi Jack,

Take a look at the Background Texture Access and Occlussion Management examples.

You should be able to render the background yourself into a new texture and render your augmentations on top?

Re: any luck with screenshots?

April 12, 2012 - 12:31pm #3

Sorry, I should add that I really don't want to use Application.CaptureScreenshot() since it seems to force a write to disk.

Log in or register to post comments