OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Need help with setting/calculating normals


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins]
View previous topic :: View next topic  
Author Message
szadeklord
Newbie


Joined: 29 Jun 2016
Posts: 2

PostPosted: Wed Jun 29, 2016 12:52 am    Post subject:
Need help with setting/calculating normals
Reply with quote

Hi,

First of all I am new to OSG so forgive me if I am making any mistakes.

I am creating a plugin for a proprietary 3d model format that we use at my work. These model files only contain grid points and unsorted primitives such as TRI's and QUADs.

Currently when I create the model I am not setting normals since non are provided by the file format. So I used the smoothing visitor to calculate the normals for me. However when I do this I get weird white spots all over model when I rotate it and look at it.

It seems like this really occurs when there is a 2d shape that is outjutting into 3d space. (Essentially has no or almost no width).

Is there any way I can calculate the proper normals, even though they are not given? Or is there any way to fix this rendering issue.

And do not worry about the models color, each section has its own section to denote different things for our clients.

Thank you!

Cheers,
Daniel
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11235

PostPosted: Wed Jun 29, 2016 1:49 pm    Post subject:
Need help with setting/calculating normals
Reply with quote

Hi Daniel,

If your models don't come with normals then there is no way to know
what the appropriate normals would be so there isn't any single
automated tools that will automagically do the right thing by all
models.

The SmoothingVisitor is simply assumes that vertices in the same x,y,z
are shared vertices that potentially will share the same normal, so in
it's default settings will smooth round sharp edges. This works
really well for smooth objects, but performs poorly on angular
objects.

Recent versions of SmoothingVisitor add support for users to specify a
crease angle, this gives a hint to the smoothing algorithm that edges
in the mesh that are sharper than the specified create angle should
not assume shared vertices and shared normals, instead should have
separate vertices and normals. This enables one to see sharp edges in
the mesh.

For you using the SmoothingVisitor::setCreaseAngle(angleInRadians)
will be worth trying, however, you can't expect it to give you perfect
results for all models, in the end it's a crude geometric algorithm
that knows nothing about what the object it is processing represents,
it can't make any of the higher level artistic judgements that a
modeller can do. Essentially models with normals are already broken,
so these automated tools can only go so far in fixing the problems
that the art path route has created.

Robert.

On 29 June 2016 at 01:52, Daniel Lecklider <> wrote:
Quote:
Hi,

First of all I am new to OSG so forgive me if I am making any mistakes.

I am creating a plugin for a proprietary 3d model format that we use at my work. These model files only contain grid points and unsorted primitives such as TRI's and QUADs.

Currently when I create the model I am not setting normals since non are provided by the file format. So I used the smoothing visitor to calculate the normals for me. However when I do this I get weird white spots all over model when I rotate it and look at it.

It seems like this really occurs when there is a 2d shape that is outjutting into 3d space. (Essentially has no or almost no width).

Is there any way I can calculate the proper normals, even though they are not given? Or is there any way to fix this rendering issue.

And do not worry about the models color, each section has its own section to denote different things for our clients.

Thank you!

Cheers,
Daniel

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




Attachments:
http://forum.openscenegraph.org//files/osg2_109.png
http://forum.openscenegraph.org//files/osg1_115.png





------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Setting up a shadowDepthCamera wernerM General 0 Fri Sep 08, 2017 11:28 am View latest post
No new posts using modern shaders with osg - setti... antiro42 General 18 Fri Sep 01, 2017 9:30 am View latest post
No new posts Setting the transform matrices robertosfield General 14 Wed Aug 09, 2017 8:35 am View latest post
No new posts setting 2D manipulator bhanu406 General 1 Wed May 31, 2017 4:55 am View latest post
No new posts Setting vertex attribute array of float Bruno Oliveira General 1 Mon Mar 20, 2017 9:55 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP