I hate precision issues…
So, better camp sites (more seamless with the surroundings):
And then I decided to tackle a bug that was plaguing me for some time: the world generation on Direct3D and OpenGL were yielding different results:
OpenGL on the left, D3D9 on the right… Way different…
After a load of time and logging, I finally found the problem… Apparently, one of them (not sure which one, to be honest), changes something on the precision of the floating point unit, which meant that on one case a particular calculation (number of terrain splits) was yielding 25.9999999 (so, since I was truncating, it was 25 splits) and the other was yielding 26.000000 (so 26 splits)…
The offending piece of code was:
unsigned long splits=(unsigned long)((1.0f-roughness)*80.0f+10.0f);
I replaced this with:
#define RoundUL(X) ((unsigned long)(floorf((float)X+0.5f)))
unsigned long splits=RoundUL((1.0f-roughness)*80.0f+10.0f);
And the results are the same on both renderers!
This took me way longer than it should considering the end result, but it’s good to have coherent results on both systems!
Now listening to “Rosenrot” by “Rammstein”
Link of the Day: Found some interesting thoughts on multithreaded gameplay code (which is HARD)… I’m not sure if gameplay should be multithreaded (think maybe the multithreaded part might be better exploited and better controlled by putting the rendering/physics/path-finding in it, instead of gameplay), but it’s an interesting read nevertheless: http://bitsquid.blogspot.pt/2015/03/multithreaded-gameplay.html
Comment
You must be logged in to post a comment.