Jump to content

  • Log In with Google      Sign In   
  • Create Account

GLSL - single texture skydome


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 fread   Members   -  Reputation: 238

Like
0Likes
Like

Posted 15 June 2014 - 09:56 AM

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,

Sponsor:

#2 Kaptein   Prime Members   -  Reputation: 2152

Like
3Likes
Like

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS