After finally starting to wrap my mind around GLSL shaders thanks to Elburz’s book (thank you!!) I think I figured out how to select pixels from a render TOP based on the material they came from using the GLSL version of the phong material, so I wanted to share. I haven’t been able to find a built-in-to-TD way of doing this yet. Feel free to share your own method for doing this-- I’m sure there’s something I am doing here that could be done better.
The attached component has a simple render setup inside. You can drag each of the three materials onto the geometry to see the effect.
phong1 is just a normal unchanged phong material.
phong1GLSL is just an unchanged shader output from phong1 (in a phong material, in the RGB tab, click the Output Shader button at the bottom)
phong2GLSL is where I added and deleted a few lines to the pixel shader so that a render select TOP can extract just that material’s geometry from the render. You can compare the two pixel shader DATs to see what I changed.
Only other thing you have to remember to do is change the ‘# of color buffers’ parameter in the Render TOP to 2.
renderSelectGLSL.tox (3.89 KB)