Loading:

Real-time Raytracing in your Browser!

Use the mouse to click/drag the planet; make sure you check out the night side!

Method

This WebGL program renders a plane across the entire screen. Vertex parameters are "RT World X,Y,Z" and "RT Eye X,Y,Z". The entire rendering process occurs in the pixel-shader. The ray-sphere calculation is done, yielding a position (which equals the surface normal). This is decomposed into a latitude and longitude. The longitudes are offset to make the planet and clouds rotate at slightly different speeds. We then look-up into spherical texture maps: color, specular, clouds and lights (for the night side). If the ray misses the planet, we instead lookup into a spherical starmap, using the same kind of logic.

Acknowledgements

The texture maps come from JHT's Planetary Pixel Emporium

Code

Hello