vendredi 14 décembre 2012

Planet renderer artifacts corrections


I Recently made 2 bugfixes concerning planets renderings artifacts:

On earth-like planets, sometimes appeared unrealistics (unnatural) linear edges between desertic textures and temperate climate zone (green texture)





The reason for that : the desertic zones repartition on the equator is controled with a fractal function, and there was a break in the fractal result continuity all over the sphere due to non taking account of the orientation of each of the 6 curved cubes faces (the unrealistic linear edge was positionned on the limit between two curved cube faces indeed). Now fixed (and that's cool).

The other bug was (again) a z-buffering conflict resulting in very eye-unpleasant artifact over coast land.





The problem was that, the ocean model meshe grid is not interrupted under the land meshe, and as coast land gradually come down to the sea level, some land meshe triangles are very near to some ocean meshe triangles, which result in zbuffer imprecision artifact







Fix of the problem is done with a small modification the planet shader; the trick is to clip all ocean meshe pixel located UNDER land meshe. Each land meshe vertex altitud is provided to the shader through an unused texture coordinate register

if( ocean_role )
{
    // input.TexCoord2.x -> altitude du terrain

    // ne pas dessiner le pixel quand l'altitude du terrain est au dessus de l'ocean ( > 0 en fait)
    // (rappel : clip quand argument negatif)

    clip( - input.TexCoord2.x );
}






And then, it works ! And that's pretty, pretty cool :)





And, to finish, a little view of clouds over some islands (just for the fun ;) ).




2 commentaires:

  1. Bloody grand !

    thought the 1st picture was a real one used as example :)

    I can't wait to see mountains.

    RépondreSupprimer