## Recommended Posts

Hello! I'm building a 2D paradox scroller and instead of using tiles I'm using triangle lists. The reason for this is more control over the over-all shape and style of the level, as well as for physics. I'm curious as to how to do multitexturing. I'd like to be able to blend between dirt, grass, sand, and any other texture you can think of - or the max possible number of textures. I assume this would be done using a pixel shader, but other than that I have no idea where I'm going with this. I realize that you can also use the fixed function pipeline for such multi-texturing, but I would rather use shaders as I'm going to have to learn them sooner or later. Fixed-function pipeline and shader solutions are both welcome, however :). Thanks in advance!

##### Share on other sites
You can check the Frank Luna's Tutorial for multitexture terrain, it is for 3D but i think you could use the shader in 2D if thats what you want..

here is the link to the pdf
And this is the sample code for the paper

i hope that helps

##### Share on other sites
A method.

Create an alpha map, an RBGA texture that holds the blended weight for each texture, the sum of which should equal one.

float4 n = tex2d(amap,pos)return tex2d(t1,pos)*n.x+tex2d(t2,pos)*n.y+tex2d(t3,pos)*n.z+tex2d(t4,p1)*n.w;

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628350
• Total Posts
2982211

• 10
• 9
• 24
• 11
• 9