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 customphase · Dec 24, 2014 at 05:28 PM · camerashaderrendertexturedelaypost effects

One-frame delay with 2 cameras

Hello everyone. Why does my render texture is sent from one camera to another with one-frame delay? Even if the cameras are standing still. Also cameras' depths are set correctly.

Heres the full description of the problem im having:
Im making an object motion blur shader, so this is what im doing:
1) I have 2 cameras, one for rendering velocities, the other one is main camera. Main camera depth is 0, velocity camera depth is -1 (it should render first). Velocity camera's parent is main camera.
2) First, velocity camera frees previous temporary RTs/does shader replacement (OnPreRender), renders/stores the RT in temporary RTS(OnRenderImage), sets all the shaders back(OnPostRender).
3) Then, main camera takes that temp RT and sets it as a texture in my post processing shader (OnRenderImage).
4) When i compare positions of the object on Source image from main camera, and on image from velocity camera, they are exactly one frame off on a velocity one.

Am i doing something wrong?


EDIT: I just checked, and for some reason, OnPostRender is called before OnRenderImage, on both cameras. But even after making changes in an order, it still has this one-frame delay.

Here are screenshots comparisons at the same frame: alt text

alt text

main.png (314.3 kB)
velo.png (18.0 kB)
Comment
Add comment · Show 2
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 Venryx · Nov 11, 2016 at 04:10 AM 0
Share

I get a similar problem... (https://forum.unity3d.com/threads/bug-1-frame-delay-when-rendering-to-texture.367353/)

I found a workaround myself, but it doesn't look like it'd work in your case.

avatar image Bunny83 · Nov 11, 2016 at 04:31 AM 0
Share

Well, of course "OnPostRender" is called before "OnRenderImage" since OnPostRender is called right after a camera has finished rendering while "OnRenderImage" is called when all rendering has finised to perform postprocessing on the actual screen.

Have a look at the event order here.

You might want to disable your velocity camera and render it manually. $$anonymous$$eep in $$anonymous$$d that you can directly render a camera with a replacement shader.

0 Replies

· Add your reply
  • Sort: 

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

28 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 avatar image avatar image avatar image avatar image 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

Easy way to render a texture, pixel perfectly, with a shader, and get the result? 0 Answers

Use camera depth texture to find distance from camera 0 Answers

,Can camera output negative values to render texture? 0 Answers

Check if mouse is over GUI element using Rendertexture? 1 Answer

Unity Grabpass Feature 1 Answer


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