osgexport icon indicating copy to clipboard operation
osgexport copied to clipboard

Convert the normals for rotated and (unevenly) scaled objects

Open fulezi opened this issue 7 years ago • 2 comments

Flat normals does not appear correctly if there where unevenly transformed. fix_normals

fulezi avatar Dec 04 '17 10:12 fulezi

Thanks @fulezi for this PR.

My only concern with this fix is that, in my opinion, mesh data should never be modified according to any transform data, it's more the role of the rendering part to handle such case.

In the case your mesh is used by two object having different matrices (let's say one with an uneven scale and another one at identity), as processed meshes are cached in unique_objects and could be retrieved here, one of the two mentionned objects will appear with wrong normals.

It can be a workaround but I don't think it's the best way to fix.

I might have missed something, though

AurL avatar Dec 04 '17 13:12 AurL

Thanks for your answer @AurL,

The issue symptoms are unlighted or totally lighted (white) models with OpenSceneGraph (version 3.2.3 and 3.5.7): http://forum.openscenegraph.org/viewtopic.php?t=16991 While the same model is working when exported as .3sd or .obj.

I was not aware of cached objects, and I need to dig more on this. I will come back in my next spare time. :)

fulezi avatar Dec 06 '17 13:12 fulezi