Interpolation Problem
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
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement