I found a simple terrain splatting shader from google, and got it to work in Irrlicht! It only supports 3 detail textures and i have no idea on how to make it support more. It works with Irrlicht's terrain, but when i updated to the latest SVN, terrain always makes the program crash, but it does work with older versions of Irrlicht.
You could probably make it support 256 textures if you just used one color instead of three. Like you could make 255/0/0 be one texture, 254/0/0/ be another, 253/0/0/ be a third, etc.
In that meaning could it be posible to split the texture into several subtextures, so, perhaps, a 1024x1024 textures could contain 16 256x256 textures?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Yes, it is possible. I use atlas texture in my engine for terrain splitting. But You have to remember about texture atlases problems: mipmapping, texel size etc...
Yeah you can see mipmapping/fract artifactss in this screenshot:
Its the faint white squares between the boundaries of different textures. I'm not talking about the white grid but if you look at the where the grey part meets the grass on the left you can see lots of white squares where I try to bilinear filter between the two textures. They can be alleviated but it takes some work and sometimes a big performance hit. Although I suppose if you don't want bilinear filtered boundaries it's ok.
EDIT: I'm talking about Mel/Nadro's ideas not this code snippet.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Setting the correct texture clamp mode should fix the bilinear filtering problem, but like blindside said you'll still get ugly borders as they lie in between two pixels at the next mipmap level up.
So unless you disable mipmaps or do expensive multi-sampling in the shader, you're going to have ugly borders.
bitplane wrote:Setting the correct texture clamp mode should fix the bilinear filtering problem, but like blindside said you'll still get ugly borders as they lie in between two pixels at the next mipmap level up.
So unless you disable mipmaps or do expensive multi-sampling in the shader, you're going to have ugly borders.
What about if you have like a 10px border around your texture (so the left border has 5px copied from the right side of the texture etc). Would that get rid of borders?
I still don't think that would completely solve it in all cases. You'd still get artefacts when looking along the edge, it would look worst as you're looking almost parallel to the faces. Anisotropic texture filtering would go some way to fix this I guess.
The best way to do an advanced terrain is a completely custom solution that doesn't work in general cases. A custom editor, file format, custom vertex format, a node that prepares the data and shaders that render it using specially prepared data like 3D textures with manually edited mipmaps. This would be a very big job and would mean modifying Irrlicht too.