Project 130: Computational Fluid Dynamics: Texturing and Basic Shading options

 

 

I have now sucessfully textured my fluid mesh. I am currently using standard T3D Materials, which do not offer custom shader support, but they do have several shaders and effects that I can use for demonstration purposes, as well as full texture support. I think the project is looking very good at this stage.

The only problem is the shortcut I took for adding the texture coordinates to the metablobs. I didn't realise that adding texture coordinated to a dynamic mesh like this is actually very complex. This is because the mesh is not flat it, and so applying a texture that looks good from one angle, may have streaks when viewed from another angle. The most preferred solution seems to be "Triplanar Texturing". This is essentially where three textures are used, and, depending on the angle of the vertex normal, the texture which will result in the least distortion at that point is chosen. I may have to implement Triplanar texturing or something like it (for example spherical mapping) eventually, but for the moment I implemented a very simple shortcut:


s = x + z;

t = y + z;


or, in code:

pVert->texCoord = Point2F(pVert->point.x+pVert->point.z,pVert->point.y+pVert->point.z);


This is a very simplistic solution, but the results are acceptable. Depending on the angle and the texture used, however, there can be noticeable stretching.

 

I also had to implement a primitive buffer in order to get textures working, but luckily this was not difficult.

Finally, some videos:


 

 

 

You must be a member of this blog to see the comments. Log in now!