texture mesh based on voxel type?

hi everyone , im busy creating a smooth voxel engine , not minecraft like , ive got most things working well but cant seem to figure out how to texture my terrain based on the voxel type , at the moment i create mesh colors based on slope of terrain and wether the normal is up or down , what ive tried so far is setting each color on the vertice based on voxel type but this turned out to be to slow and there arent as many vertices as there are voxels so im kinda stuck on this one , if youd like more code then what im about to ask just ask and ill post it .

thanks.

dudester

 for(int i = 0; i < size; i++)
    				{
    					//This creates a control map used to texture the mesh based on the slope
    					//of the vert. Its very basic and if you modify how this works yoou will
    					//you will probably need to modify the shader as well.
    					float dpUp = Vector3.Dot(normals*, Vector3.up);*

_ float dpdown = Vector3.Dot(normals*, Vector3.down);_
_
//Red channel is the sand on flat areas*_
* float R = (Mathf.Max(0.0f, dpUp) < 0.8f) ? 0.0f : 1.0f;*
* //Green channel is the gravel on the sloped areas*
* float G = Mathf.Pow(Mathf.Abs(dpUp), 4.0f);*
* float B = (Mathf.Max(0.0f, dpdown) < 0.8f) ? 0.0f : 1.0f;*
* //float A = (Mathf.Max(0.0f, dpdown) > 1.8f) ? 0.0f : 1.0f;*
* //Whats left end up being the rock face on the vertical areas*

_ control = new Color(R,G,B,0);
* }*_

@dudester

Hi, I’ve been researching this same conundrum. It’s cool to see someone else interested in this, but i can’t find too much info on it online. I got a little more inside by emailing the guy who does the Unity tutorials on CatLikeCoding.com, though. Based on what I’ve found, I’m thinking about possibly coding it to automatically generate a texture atlas for each chunk that has all the textures that chunk needs. This means of course that we have to regenerate that texture atlas any time a new terrain texture is added to the chunk and possibly when a certain terrain texture is no longer needed in said chunk.

I’m trying to create a system that supports multiple types of voxels. So voxels of materials like dirt and sand are considered terrain and I want to smooth them and blend between them. Building materials like bricks and wood will not be smoothed like the terrain to make a nicer looking world since it looks kind of odd to smooth buildings and such!

Your post is a couple months old but maybe this could still help you out. I’m gonna give it a shot because its the best texturing scheme I know of at the moment, and I haven’t come up with anything better. I also am looking into voxel octrees to decrease the memory usage of my voxel data too.