GLSL - single texture skydome
hi guys,
I need to fake a skydome behaviour in GLSL.
I have viewer position (obviously), vertex position, etc, and a single skydome texture (NOT a cubemap, single 2D texture)
How can I calculate texcoord so my polygons looks like sky?
thanks in advance,
You need a direction vector, same as with cube maps. Use that for spherical mapping:
vec2 coord = vec2(((atan(norm.y, norm.x) + sunAngle) / PI + 1.0) * 0.5, asin(norm.z) / PI + 0.5 );
NOTE: this will look really bad. REALLY bad.
There's a reason no one uses this. It's fine for stars at night, since no one will notice the badness.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement