[osg-users] [osgPlugins] Incorrect normals calculated on 3DS import

36 views
Skip to first unread message

Alexey Chernov

unread,
Jul 4, 2011, 10:49:30 AM7/4/11
to osg-...@lists.openscenegraph.org
Hi,

I tried to load a model from 3DS file and found that it has some strange lighting effect both in osgviewer and in my application: on model's borders there're dark areas and it seems as if there're low of polygons (a screenshot and model are attached). I was suggested that the problem is with normals which are inverted to inside the model.

So, I've got 2 questions:
1. Is it right that the problem is caused by normals (as I found in 3ds plugin code, they are calculated on the fly)?
2. Can I fix them somehow after the model is loaded? For example, is there an easy way to perform something like "Recalculate Normal Outside" in Blender?

Thanks in advance for any information!

Regards,
Alexey

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


Attachments:
http://forum.openscenegraph.org//files/can_172.zip


_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Sukender

unread,
Jul 7, 2011, 5:25:08 AM7/7/11
to osg-...@lists.openscenegraph.org
Hi Alexey,

The 3DS format doesn't store normals, and the reader thus generates default normals PER VERTEX (and not per face), using a kind of "smooth eveything" algorithm. It fits many usages but it is clearly not adapted to your model. You may find algorithms to recompute them, but I'm not a Blender expert at all... good luck ;)

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

----- "Alexey Chernov" <4er...@gmail.com> a écrit :

Alexey Chernov

unread,
Jul 7, 2011, 9:16:48 AM7/7/11
to osg-...@lists.openscenegraph.org
Thank you, Sukender,

But can you suggest to some universal way to get valid model from 3DS in OSG? For example, is it possible to calculate normals in PER FACE mode. What's the common way to workaround problems with 3DS-imported models in OSG?

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=41236#41236

Sergey Kurdakov

unread,
Jul 7, 2011, 1:17:02 PM7/7/11
to osg-...@lists.openscenegraph.org
Hi Alexey,

you mentioned Blender, why then you would not use other formats, such as Collada
( now available in Blender ), or does not use native osg exporter for Blender?

Regards
Sergey


Alexey Chernov

unread,
Jul 8, 2011, 9:28:09 AM7/8/11
to osg-...@lists.openscenegraph.org
Yes, I can, but the main aim of my application is to support both OBJ and 3DS formats of models which are loaded by user, so I wanted to know how to load 3DS and avoid problems mentioned above.

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=41265#41265

Sukender

unread,
Jul 11, 2011, 6:45:58 AM7/11/11
to osg-...@lists.openscenegraph.org
Hi Alexey,

Loaded models are perfectly valid, and most users are okay with per-vertex normals. However, you seem to need a different representation. I don't have code to share witch would generate per-face normals, but this is quite straightforward. Look at the Newell method to generate normals. Or look at osgModeling, but I think it's a per-vertex basis too (however you can choose between different algorithms if I remember well).

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

----- "Alexey Chernov" <4er...@gmail.com> a écrit :

> Thank you, Sukender,

Alexey Chernov

unread,
Jul 13, 2011, 3:31:32 AM7/13/11
to osg-...@lists.openscenegraph.org
Sukender, thanks for references. I've also read that per-vertex model is more precise than per-face, and the result in my case is more similar to per-face example..

So, am I right that these problems are completely because of this exact model and not the algorithm?

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=41330#41330

Reply all
Reply to author
Forward
0 new messages