Jump to content
  • Advertisement
Sign in to follow this  
Christopher Harris

Multi-Texturing (via shaders)

This topic is 4549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!