When making a multi-pass material shader what is the proper approach to share information between passes?
Is there a way to use a render texture as an intermediary to store information from one pass so it may be used in subsequent passes?
I’ve seen examples of GrabPass being used to read pixel information between passes. But what if you can’t encode enough information in those pixels?
Say I want to write just a basic thickness material shader.
- First pass: Render back faces and calculate distance from camera to vertices – store information somewhere (backDistance).
- Second pass: Render front faces and calculate distance from camera to vertices (frontDistance)
- Subtract backDistance from frontDistance to get thickness. Render using thickness.
I could easily be misunderstanding the workflow here, but is it possible to share information between passes for a material shader (not an image effect)?