[osg-users] Render normal vectors to image

Trajce Nikolov NICK trajce.nikolov.nick at gmail.com
Mon Nov 11 01:39:54 PST 2019


Hi,

you can use the normals pseudoloader. just append .normals to your osgb
file on reading - mymodel.osgb.normals

On Mon, Nov 11, 2019 at 10:20 AM Han Hu <huhan8807 at gmail.com> wrote:

> Hi,
>
> I would like to do offscreen rendering of a mesh.
> Currently, I have suceeded to do this for both the color (RGB) and depth
> data using the built-in functions as below.
>
>
> Code:
>
>
>         osg::ref_ptr<osg::Image> rttImage = new osg::Image;
>         osg::ref_ptr<osg::Image> depthImage = new osg::Image;
>
> camera->attach(osg::Camera::COLOR_BUFFER, rttImage.get());
>         camera->attach(osg::Camera::DEPTH_BUFFER, depthImage.get());
>
>         rttImage->allocateImage(ATInfo.width, ATInfo.height, 1, GL_RGB,
> GL_UNSIGNED_BYTE);
>         depthImage->allocateImage(ATInfo.width, ATInfo.height, 1,
> GL_DEPTH_COMPONENT, GL_FLOAT);
>
>
>
>
> But I also need to render the normal vectors to images too. I have googled
> this topic using native opengl, it seems that I have to write shaders for
> it. But my mesh are defined using the osgb plugin format, so I must
> implement in the osg.
>
> I would like to know, is there an approach to do this in osg? Thanks!
>
> Thank you!
>
> Cheers,
> Han
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76892#76892
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20191111/63ea20fe/attachment.html>


More information about the osg-users mailing list