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
2
Question by siaran · Mar 24, 2015 at 12:20 AM · shaderrendertextureshader programming

Using rendertextures in multiple shader passes

Right, so I'm working off some somewhat old (wait, I just checked, 2004? When did 2004 books written in 2004 become old?) book about shaders, and it talks about 'render targets', which are textures that a shader writes to instead of the camera. Which you then use to do...stuff...before you calculate your final output. So basically, that's a RenderTexture, right?

But now I'm trying to make a shader that does something like this

 Pass {
  //make rendertexture A
 }
 
 Pass {
 //make rendertexture B
 }
 
 Pass {
 //final output is something like B-A
 }

Is it possible to do something like that? If so, how? I've mentioned it on this forum before, but I am kind of bad at shaders. (Trying to get better!)

Comment
Add comment · Show 3
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 Jagwire · May 22, 2015 at 06:20 PM 0
Share

VERY interested in the answer to this question. Have you figured anything out?

avatar image siaran · May 23, 2015 at 08:51 PM 0
Share

Sadly, no, I haven't (I haven't really looked at this in a while - in the end I didn't really need this and I moved on to trying other things).

avatar image Rs · Mar 03, 2016 at 11:14 AM 0
Share

I use Graphics.Blit for that which allows to select which pass to get the shader to render onto the RenderTexture. But I am currently looking for a solution to your same problem: how to reuse the RenderTextures in the shader. It seemed trivial to me to reupload and make a lerp in a fragment shader but I am having unexpected results. In my case I am trying to smooth a movement in GPU; with this goal in $$anonymous$$d, before I do the pass, I upload the RenderTexture that holds the results of the previous Update to the shader and lerp in the pass using the old value. I also tried to keep two separate RenderTextures by calling Graphics.Blit twice with the same pass so I have a copy with the same values and pass one of the two but NO LUC$$anonymous$$ so far. I guess I am missing something in the sequence. RenderTexture doesn't seem to hold the values like I expect. Hope someone comes to point some light at this.

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

23 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

Related Questions

In Unity 2D how can I make a shader aware of the Z coordinate (depth) of the object it is about to draw over? 1 Answer

How do I make a paint trail effect in ShaderGraph? Are there better ways? 0 Answers

Most Efficient way to save shader result as texture and feed it back in next frame (Ping Pong Buffer) 1 Answer

How can I add a color, smoothness and metallic property to this shader? 1 Answer

Mobile performance of splat map shader with distance blending 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