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

