Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

GLSL - single texture skydome

4: Adsense

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   

240
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,

#2 Kaptein   Prime Members   

2216
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.