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 

Can see parts of the back side of a model


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
bclay
Newbie


Joined: 28 Oct 2015
Posts: 9

PostPosted: Thu Aug 24, 2017 12:09 am    Post subject:
Can see parts of the back side of a model
Reply with quote

Hi,

I am using OSG 3.4 with QT 5.8 and Visual Studio 2015. I am also using the QT osgWidget class I found on line. When I load a model I can see parts of the inside or back side of the model. One viewer noted that it looked like the surface normals are inverted. I could not find anything in the osgWidget class or anything in the qtOsgWidget class that has anyeffect on surface normals.

Any suggestion would be greatly appreciated

Thank you!

Cheers,
Bruce
Back to top
View user's profile Send private message
tianzjyh
Guest





PostPosted: Thu Aug 24, 2017 1:05 am    Post subject:
Can see parts of the back side of a model
Reply with quote

Hi, Clay,
Could you please attach a picture relative to the problem. Also, could you please describe what is the model's behavior under normal OSG, saying it viewed by "osgviewer.exe".


--


Cheers,
---
TianZJ




Quote:
At 2017-08-24 08:09:23, "Bruce Clay" <> wrote:
Quote:
I am using OSG 3.4 with QT 5.8 and Visual Studio 2015. I am also using the QT osgWidget class I found on line. When I load a model I >can see parts of the inside or back side of the model. One viewer noted that it looked like the surface normals are inverted. I could not >find anything in the osgWidget class or anything in the qtOsgWidget class that has anyeffect on surface normals.>Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71514#71514



------------------
Post generated by Mail2Forum
Back to top
Voerman, L.
Guest





PostPosted: Thu Aug 24, 2017 7:17 am    Post subject:
Can see parts of the back side of a model
Reply with quote

Hi Bruce,backface culling does not work with surface normals, the front and back faces are separated by the vertex winding.
your model might have the faces in the wrong direction - or QT might have left openGL in an unexpected state.
maybe this could help:
                osg::ref_ptr<osg::CullFace> cf = new osg::CullFace;
                cf->setMode(osg::CullFace::FRONT);
                ss->setAttributeAndModes(cf.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute:ShockedN);

or possibly this:
    ff = new osg::FrontFace;
    ff->setMode( inverted() ? osg::FrontFace::CLOCKWISE : osg::FrontFace::COUNTER_CLOCKWISE);

    ss->setAttribute(ff);


Regards, Laurens. 





On Thu, Aug 24, 2017 at 2:09 AM, Bruce Clay < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

I am using OSG 3.4 with QT 5.8 and Visual Studio 2015.  I am also using the QT osgWidget class I found on line.  When I load a model I can see parts of the inside or back side of the model.  One viewer noted that it looked like the surface normals are inverted.  I could not find anything in the osgWidget class or anything in the qtOsgWidget class that has anyeffect on surface normals.

Any suggestion would be greatly appreciated

Thank you!

Cheers,
Bruce

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11238

PostPosted: Thu Aug 24, 2017 7:54 am    Post subject:
Can see parts of the back side of a model
Reply with quote

HI Bruce,

On 24 August 2017 at 01:09, Bruce Clay < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
I am using OSG 3.4 with QT 5.8 and Visual Studio 2015.  I am also using the QT osgWidget class I found on line.  When I load a model I can see parts of the inside or back side of the model.  One viewer noted that it looked like the surface normals are inverted.  I could not find anything in the osgWidget class or anything in the qtOsgWidget class that has anyeffect on surface normals.



When references a 3rd party code that is online somewhere it would be worth providing a link to it.


FYI, osgWidget is a NodeKit in OSG-3.4 so references a class of the same name is a bit confusing.  I presume you aren't talking about the osgWidget NodeKit as it has nothing to do with Qt.


As the issue, is this a new issue?  Could it be lack of depth testing?


Robert.

 
 

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
bclay
Newbie


Joined: 28 Oct 2015
Posts: 9

PostPosted: Thu Aug 24, 2017 2:43 pm    Post subject:
Reply with quote

Hi,

The original source code related to this problem was downloaded from https://github.com/Submanifold/QtOSG.

The QtOSG class is similar in function to the osgQt distributed with OSG in function but it seems more "native" to OSG itself. That is I could see all of the normal OSG code. When I use the osgQt class I can display the model properly but I don't appear to get the same window capabilities.

The good and bad images were attached as requested

Thank you!

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


Joined: 18 Mar 2009
Posts: 11238

PostPosted: Thu Aug 24, 2017 3:02 pm    Post subject:
Can see parts of the back side of a model
Reply with quote

Hi Bruce,


A quick look at the OSGWidget.cpp and it looks to me like the code is creating its own osg::Camera and assigning it to the view but this Camera never sets up global default state so OpenGL defaults will be used, depth testing is off by default in OpenGL, which in turn will give this problem.  This is a bug in OSGWidget.cpp that needs fixing and passing on to the authors of the code.


What the code should do is either:


 1)  Use the View's master Camera rather than replacing it with a locally created one, View's master Camera has a StateSet with the appropriate
   global defaults applied.  i.e.


   osg::Camera* camera = view->getCamera() // replacing camera = new osg::Camera



 2) Assign a StateSet to the Camera, and set it's up with the appropriate global defaults for the 3D scene i.e.


    camera->getOrCreateStateSet()->setGlobalDefaults();  // add around line 127


Robert.
 






On 24 August 2017 at 15:43, Bruce Clay < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

The original source code related to this problem was downloaded from https://github.com/Submanifold/QtOSG.

The QtOSG class is similar in function to the osgQt distributed with OSG in function but it seems more "native" to OSG itself.  That is I could see all of the normal OSG code.  When I use the osgQt class I can display the model properly but I don't appear to get the same window capabilities.

The good and bad images were attached as requested

Thank you!

Cheers,
Bruce

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




_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
bclay
Newbie


Joined: 28 Oct 2015
Posts: 9

PostPosted: Fri Aug 25, 2017 8:00 pm    Post subject:
Reply with quote

Robert:

Thanks for your help. I could not get the camera instance but was able to create the camera as in the original code and add the setGlobalDefaults as you suggested.

Things are appear to be working correctly now.

Thanks again

Cheers,
Bruce
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General 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 model matrix d_a_heitbrink General 0 Tue Oct 24, 2017 3:33 pm View latest post
No new posts BVH and model axis centering: a model... Paradox Plugins [osgPlugins] 0 Mon Oct 16, 2017 4:27 pm View latest post
No new posts Best Model For Augmented Reality? Bobykhani General [forum] 3 Sun Oct 15, 2017 6:49 am View latest post
No new posts Osg model assembly jaisingla General 0 Mon Sep 18, 2017 3:36 pm View latest post
No new posts Osg model assembly jaisingla General 0 Mon Sep 18, 2017 3:35 pm 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