Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by bhart · Dec 26, 2012 at 10:32 PM · cameraviewportpixelsframes

How to access Camera Viewport raw pixels, and save frames.

When capturing with the camera how can one access the Viewport raw pixels pixels in-memory, and also save the frames to disk?

In addition is there any notification that indicates the Viewport frame has updated?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by whydoidoit · Dec 26, 2012 at 10:34 PM

You can't access them in memory per se - it would be totally different on different hardware configurations. If you have Unity Pro then you can render the camera to a RenderTexture which allows you to access the pixels.

A coroutine that does yield WaitForEndOfFrame is resumed after the scene is rendered.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bhart · Dec 27, 2012 at 12:31 AM 0
Share

So would I for example be able to create a 3$$anonymous$$ X 2$$anonymous$$ RGB RenderTexture, and read the pixels with a C++ or C# application? I'm wanting to render, and read pixels, at substantially greater resolutions than would fit onscreen.

avatar image whydoidoit · Dec 27, 2012 at 08:49 AM 0
Share

Interesting - didn't this question used to be about multipass rendering or did I get confused and answer the wrong question? Because either I had a brain fart or I wouldn't have answered this way. Yes as @Aldonaletto says you can get the whole frame, but not an individual camera (rendering pass) on Indie. Ugh, sorry for any confusion.

And yes, you can make a render texture that is much bigger than the screen and have the camera render to that.

avatar image
0

Answer by aldonaletto · Dec 27, 2012 at 12:50 AM

Actually, you can load a rectangle of screen pixels in a texture even in Unity Indie, with Texture2D.ReadPixels - take a look at the EncodeToPNG example, where a screenshot is saved to the disk and also sent over the network. But if you want a higher resolution, or render images that aren't in the screen, you'll need Pro and a RenderTexture as Mike said.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Detecting camera viewport on mouse down? 1 Answer

Prevent objects from disappearing when zooming in on an orthographic scene? 1 Answer

In-game video monitor without render-to-texture 0 Answers

WorldToViewportPoint and WorldToScreenPoint give wrong positions when VR is enabled 1 Answer

Move the camera in 2D when target reaches bounds. Is there a better way? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges