Jump to content
Posted 15 June 2014 - 09:56 AM
Posted 15 June 2014 - 11:52 AM
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.