Background (skybox, sky and ground)

Use TCastleBackground to define a nice background for 3D games. Just add it to the design by "Add Non-Visual Component → Background" (under any parent) and then set TCastleViewport.Background.

TCastleBackground skybox TCastleBackground default gradients TCastleBackground skybox

  1. You can provide up to 6 textures that define 6 sides of a skybox. See wikipedia about skyboxes. Set 6 URLs like TCastleBackground.TexturePositiveX for this (our naming follows e.g. X3D and Emil Persson’s conventions.

    How to make such skyboxes?

  2. You can also define a sky gradient using TCastleBackground.SkyTopColor, TCastleBackground.SkyEquatorColor, ground gradient using TCastleBackground.GroundBottomColor, TCastleBackground.GroundEquatorColor, and additional gradient to smooth transition between the sky and ground using TCastleBackground.SmoothEquator.

    The sky and ground gradients are visible if you don’t provide the 6 textures for a skybox, or if some of them use alpha for transparency.

If you only want to define a background as a simple color, then leave TCastleViewport.Background empty and set TCastleViewport.BackgroundColor instead.

Watch the presentation how to use TCastleBackground:

To improve this documentation just edit the source of this page in AsciiDoctor (simple wiki-like syntax) and create a pull request to Castle Game Engine WWW (cge-www) repository.