Hi Anton,
Then your problem seems to be clipping not culling.
Anyways, you will still have to send the original vertices to the GPU,
so it is simply a matter of putting them at an absolute position to the
camera, so you won't get culling.
Also there will be CPU-side calls anyways to render the skybox, the only
difference might be one matrix call.
But thinking about it, it also might be directly the opposite, as the
viewmatrix essentially moves geometry relative to the fixed eyepoint,
not vice versa.
And still culling can be avoided by simply switching it off.
To avoid depth clamping you can try:
stateset->setMode(GL_DEPTH_CLAMP, osg::StateAttribute::ON);
cheers
Sebastian
Sebastian:
rendering a skybox in a shader is easy & elegant:
I can do all the necessary calculations in the shaders in literally 3 lines of
code on the GPU.
Completely independent of field of view, aspect ratio and position of the
camera in the scene my shader renders a simple quad filling the whole
background and texture it according to the camera orientation with a cubemap
texture.
I do this by putting the vertex positions ONLY inside the shader to the far
plane, thus ensuring that I do not hide anything in the scene. If I do this
last, only the pixels not covered by scene geometry get written, which speeds
up things if you want to use a more complicated sky shader (think animated
clouds, physically correct skylight etc.)
The whole code runs on the GPU.
If I do this on the CPU, I have to update vertex positions for every frame "by
hand" or define a pre- or post-render step with an orthographic camera or something
similar.
My way, the skybox is just another piece of geometry you put in your scene
which can be cached on the GPU and does not need any intervention from the CPU
at rendering time.
Additionally, the skybox was only an example. There are lots of applications
for vertex shaders which move their geometry around, and I do not want them to
get culled because their original position wandered behind the camera.
regards,
Tony
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55949#55949
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org