AimplainLeo / osgocean

Automatically exported from code.google.com/p/osgocean
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Large Area SkyDome Error #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What is the expected output? What do you see instead?
My terrains are very large scale... about 65k x 65k and more. I start off
the scenario very far from the origin.... lets say about (35000,35000,50)... 
When osgOcean initializes, the sky dome and the sky shaders dont seem to
work....its like everything that has to do with the sky dome gets turned
off, and all i see is a black sky. When i start to move around.... after
some time...usually after i look up...it suddenly turns on and after that
works just fine...

What version of the product are you using? On what operating system?
osgOcean 1.0.1
winXP 
vs2008

Original issue reported on code.google.com by maxims...@gmail.com on 27 Jan 2010 at 5:36

GoogleCodeExporter commented 9 years ago
I suspect this is something to do with the camera tracking on the sky dome, I 
believe 
there was a similar problem with the ocean surface tracking a while back.

I'll have a look at this. If you need an urgent fix, take a look at the 
callback 
attached to the skydome.

Kim

Original comment by kcb...@googlemail.com on 27 Jan 2010 at 9:21

GoogleCodeExporter commented 9 years ago
Hey Kim, 

Don't know if you looked at this or not.....but i found out that it has 
something to
do with culling. 
As i said before, the dome comes back when I move around.....well...its more 
when the
database origin gets inside the cameras culling volume. Also, i can see the 
dome snap
back into place above me if i start my prog very far off looking at the 
origin....if
im looking away from the origin, there will be no sky until i turn to it.....
Also if you play around with various camera culling modes....the sky will work 
with
some...and not with others....  

MS 

Original comment by maxims...@gmail.com on 16 Mar 2010 at 11:57

GoogleCodeExporter commented 9 years ago
I've seen the same problem in my application. You can reproduce that issue in 
oceanExample by setting the camera far off the origin (for example "osgOcean 
--initialCameraPosition -10400 -10100 120"). In this case the cull stage sees 
the OceanScene and the SkyDome outside of viewing frustum. Those nodes get 
rejected after computing the bounding sphere. Therefore the cull callbacks are 
never called and the ocean and sky stays at origin.

I've done a crude workaround. I apply a custom bounding sphere callback to both 
the OceanScene and the SkyDome. It returns a huge bounding sphere:
struct BoundingSphereCallbackHack : public 
osg::Node::ComputeBoundingSphereCallback
{
    virtual osg::BoundingSphere computeBound(const osg::Node &) const
    {
        return osg::BoundingSphere(osg::Vec3(0.0, 0.0, 0.0), 1.0e10);
    }
};

However I don't like this hack. I guess there is a better way achieve this by 
customizing the cull traversal. I don't know much of the details of the cull 
stage, so any comments are welcome.

Jean-Claude

Original comment by jcmon...@gmail.com on 21 Dec 2011 at 4:27