Sky Sphere / Cube / Dome Render

Sky Sphere / Cube / Dome Render

Released 3 years ago , Last update 3 years ago

Three blisteringly fast classes for rendering sky textures in 3D games: sphere, cube and dome

A very large percentage of games use textures to fake 'stuff' on or over the horizon. Distant mountains, buildings, clouds, hills, stars, nebula, sun, moon, etc, can all be painted into textures rather than rendered with actual geometry.

However, there are several geometries and mapping methods that can be used, each with their own advantages and disadvantages. This application showcases 3 types of environment geometry: sphere, cube and dome. Which one you choose depends on your requirements and how it will be used:

SkySphere:

  • Advantages: 1 texture, 1 draw call, only 1 seam, full 360 degree coverage
  • Disadvantages: texture singularity at poles
  • Example usage: racing game (no looking directly up)

SkyCube:

  • Advantages: minimal texture distortion, full 360 degree coverage, only 12 triangles
  • Disadvantages: 6 textures, 6 draw calls, more seams
  • Example usage: space battle game (full rotation)

SkyDome:

  • Advantages: 1 texture, 1 draw call, 0 seams, minimal texture distortion
  • Disadvantages: 50% coverage
  • Example usage: first-person shooter with fairly flat terrain

They all use vertex buffer objects and triangle strips for greatest speed. The code is clear, concise and optimized.

TIP: It is SOMETIMES a good idea to render your sky last. This is because the other geometry will have written to the depth buffer, and a large portion of the sky pixels will fail the z test and never be drawn. If you render the sky first, they will be drawn unnecessarily. Of course, this only works if you have no transparency in the scene.

Note: The example program uses freeglut for window creation but the Sky Geometry components themselves do not, so they are very portable.

4.0
  • 5 0
  • 4 1
  • 3 0
  • 2 0
  • 1 0
1 Reviews Read Reviews

Pricing

FREE

Executable Demo

  • Perpetual license

  • 1 application

  • Can distribute binary products only

  • Non-commercial use

$74.99

Developer License

  • Perpetual license

  • Unlimited projects

  • Can distribute code and binary products

  • Commercial use

Documentation

How to use in your own application:

Create one of the objects:

SkySphere* _skysphere;
_skysphere = new SkySphere( SCALE, SLICES, STACKS, TEXTURE_HANDLE);

Where:

SCALE is the radius of the sky sphere
SLICES and STACKS are the number of horizontal and vertical tesslation divisions
TEXTURE_HANDLE is an opengl handle to a texture. Included is a function for reading TGA images but you'll probably want something better

Every frame simply use:

_skysphere->draw();

And finally, at the end, remember to clean up after yourself:

delete _skysphere;
3 licenses, starting from From » FREE View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
  • N nagakontot 2 months ago
    how to get the free liciense?