matej_jack's picture


Hello folks,
I am noob with OpenTK but I sucesfully created terrain with shadows which can be rotated, zoomed, etc.
Now, I would like to insert some sky but I cant find any good documentation. Can you help me with it?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Drac32Drac's picture

In short, the age old technique for rendering a skybox is to render most of your scene, then render your skybox (which is just a textured inside out cube) by feeding it the Camera(View) position, but NOT the camera rotation. Instead, keep the rotation set at Identity or some other constant value. In old school gl style, that would just be...
GL.LoadMatrix(ref Matrix4.Identity);

Also, skyboxes typically do not receive any lighting as it is prebaked into the texture. Disable lighting on it in these cases.

Improper backface culling can prevent the skybox from displaying at all, which can be fixed by disabling the culling... However, it is usually much better to properly draw the skybox so that it isn't culled in the first place.

Setting the skybox dimensions greater than the view frustum can handle is one last stumbling block people run against. Make sure that the depth is less than the far clipping plane.

All of these are easy to implement, though the method can be different depending on whether you are using fixed function or not.