[osg-users] Render normal vectors to image

Yu Qi yuqicxy at foxmail.com
Mon Nov 11 03:38:17 PST 2019


Hi,

I think u must use shader to achieve it. 
u can bind regular color buffer,but using gl_FragColor.rgb = normal.xyz in fragment shader.
the fallback is that you need to render the Node twice.
OSG support this way.

If you're familiar with OpenGL4.x,you can use GL_COLOR_ATTACHMENT_i Frame Buffer attachment,then use Multi-Render target to do this.
layout(location =1) out vec4 normal;
{
 normal = Computednormal;
}

But I'm not sure whether OSG support this feather.



Thank you!

Cheers,
Yu

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76896#76896







More information about the osg-users mailing list