"Marching cubes" voxel terrain - triplanar texturing with depth?

Posted by Dan the Man on Game Development See other posts from Game Development or by Dan the Man
Published on 2012-10-28T17:46:38Z Indexed on 2012/10/28 23:23 UTC
Read the original article Hit count: 427

I am currently working on a voxel terrain that uses the marching cubes algorithm for polygonizing the scalar field of voxels. I am using a triplanar texturing shader for texturing. say I have a grass texture set to the Y axis and a dirt texture for both the X and Z axes. Now, when my player digs downwards, it still appears as grass. How would I make it to appear as dirt? I have been thinking about this for a while, and the only thing I can think of to make this effect, would be to mark vertices that have been dug with a certain vertex color. When it has that vertex color, the shader would apply that dirt texture to the vertices marked. Is there a better method?

© Game Development or respective owner

Related posts about shaders

Related posts about voxels