[osg-users] Tangent, Binormal and Normal Calculation to GLSL on OSG

Ümit Uzun umituzun84 at gmail.com
Thu Sep 25 05:24:13 PDT 2008


Hi David,

Thanks for detailed explanation. I will look osgFX and BumpMapping.

Best Regards.

Umit Uzun

2008/9/25 David Spilling <david.spilling at gmail.com>

> Hi Umit,
>
> Assuming you are loading an external model, your model will need to have
> tangent and binormal attributes associated with its vertices.
>
> Even if you can do this in your modelling package, I'm not sure if any of
> the intermediate formats will read/write tangents and binormals. (Other than
> .osg, of course. Does anybody out there know?)
>
> Therefore you will most likely need to generate tangent and binormals
> within your application. In the first instance you will need a model with UV
> texture coordinates assigned. You should look at
> osgUtil:TangentSpaceGenerator and use that to generate and attach tangent
> and binormal vector arrays to your geometry. If you have more than one
> geometry (in particular if you load up a model) you will need to write a
> Visitor which will traverse your model scenegraph and generate all the
> tangent/binormals itself. The osgFX::BumpMapping technique gives a good
> example of how the TangentSpaceGenerator is actually used with a Visitor
> pattern.
>
> Of course, if you are generating your geometry on-the-fly from within your
> application, then you don't need all of this stuff. Just generate a
> Vec3Array with the right vectors in it for binormal and tangent, and attach
> them to the geometry (in otherwise unused vertex attribute numbers like 6
> and 7, otherwise strange things will happen). Again, have a look at how
> osgFX::BumpMapping does it.
>
> Hope that helps,
>
> David
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080925/9adbcfba/attachment-0003.htm>


More information about the osg-users mailing list