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 your help with zNear / zFar calculation


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


Joined: 06 Feb 2013
Posts: 76

PostPosted: Thu May 03, 2018 1:45 pm    Post subject:
Need your help with zNear / zFar calculation
Reply with quote

Dear community,

today I need your help. Since many days I try finding a solution for my problem - unfortunately without success.

Here are the facts:

I have a view for my scene and a camera manipulator.
The scene has a switch node holding the actual scene and some classes for creation of shadow, ambient shadow etc.
Everything works pretty well so far.

For some reasons we decided rendering the actual scene into a texture and displaying this texture in a hud.
So we create a texture and a rtt camera and added it to the above switch.
Then we removed the actual scene from the switch and added it as a child to the rtt camera.

In order to get the scene moved according to the camera manipulator we installed a cull callback updating the rtt cameras matrices:

Quote:
if (renderCamera.valid()) {
osg::Camera * cam = getMainCamera(); renderCamera->setViewMatrix(cam->getViewMatrix()); renderCamera->setProjectionMatrix(cam->getProjectionMatrix()); renderCamera->setClearColor(cam->getClearColor());
Without this callback all matrices are odd and zNear and zFar are both at 0.0f.
Question 1: Why is it like that? The rtt camera is a child of the main camera and should not need above settings. (?)
Question 2: In the original configuration zNear and zFar of the main camera gets recalculated continuously.
                        In the rtt configuration zNear is always 0.0f and zFar always 10000f. Why? The rtt camera is child of main camera and it has the actual scene as a child.
                        So all cullings should take the actual scene in account.
I'm really lost. When looking at the osgdeferred example I see the rtt camera is just created, gets a viewport and gets a child of the main camera. So easy!
What am I doing wrong and/or where can I start for a deeper research?

Many thanks for any help.

- Werner -

------------------
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 -> 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 How to query calczulated zNear zFar? wernerM General 2 Thu May 17, 2018 2:12 pm View latest post
No new posts Text Bounding Box Calculation Daniel Emminizer, Code... General 2 Mon May 14, 2018 3:03 pm View latest post
No new posts Hardware skinning computeBound() calc... DrPowers General 6 Thu Jan 18, 2018 4:18 pm View latest post
No new posts basic understanding wrong or my calcu... Assassin General 0 Sat Apr 18, 2015 7:31 pm View latest post
No new posts Incorrect zfar/znear when scene rende... fred_em General 7 Fri May 31, 2013 8:54 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