Sign in to follow this  
Christopher Harris

Multi-Texturing (via shaders)

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 this post


Link to post
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;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this