Jump to content
  • Advertisement
Sign in to follow this  
Eternal

Interpolation Problem

This topic is 5036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm currently (since yesterday actually) trying to implement sunrise maps into my planet renderer to get some cheap soft-shadows on my terrain. For each texel in the sunrise map i store the time of sunrise and sunset (scaled to 0..255). At runtime this texture is then passed to a shader which compares the sunrise and sunset values with the current time and then calculates a light-/shadow factor. Now without any filtering/interpolation it works, but produces ugly, blocky and sharp shadows. Now with interpolation things get even more ugly. At time 1.0 the timer wraps back to 0, same goes for the values stored in the texture. So a row storing sunrise times might look like this: ... 252 253 254 255 0 1 2 3 ... without interpolation this is no problem, but with interpolation the values sampled from the texture inside the shader might look like this: ... 254 254.5 255 127.5 0 0.5 1 ... which produces about 1-pixel wide artifacts all over my terrain. Now if this could be "solved" by some/many(?) hacky if-statements, if I wasnt doing this in a pixelshader, where I don't really want to do any superfluous work. Can someone point me to a "real" solution ? I'm not sure if this thread is more about math, graphics or even general programming, so feel free to push it around. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Two things,

Either embrase a finite field, and make 127 your new 255, and make 128 = 126, and so on. up to 255 = 0.

Or you could just get a timer which returns something over 1.

Either way...

From,
Nice coder

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!