#How can I render the normals to a texture?

4 messages · Page 1 of 1 (latest)

timber forge
#

I'm trying to write my own edge detection post-processing shader (for fun), and I'm approaching it as follows:

  1. Render the scene.
  2. Render the depth value of each pixel.
  3. Render the normal value of each pixel.
  4. Apply something like a Sobel filter using the depth + normal render as input.
  5. Use the results of the Sobel filter to add edges onto the scene render.

What would be the easiest way to achieve step 3?

I could replace the materials of all objects in my scene with materials that render normals, renderer it, and then change the materials back, but I'm hoping for a cleaner solution.

#

Any pointers on where I can fetch the depth buffer from at step 2 would be helpful as well.

frosty latch
vale acorn
#

you can override the material of the scene with Scene.overrideMaterial that is a pretty convenient solution thats what i do to render my depth, normal, and diffuse buffers