Jump to content
  • Advertisement
Sign in to follow this  
niazware

multitexture issue

This topic is 4438 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

hi friends I want to make a terrain with 6 texture layers, I'm going to use the multitexturing technique used in the effect file provided by Mr. Frank Luna, but this effect can use only 3 textures for multitexturing, of course it generates really great results, but I need 6 textures, can I use this technique, how should I modify it? or should I use something else, here is the pixel shader used in this effect: // Layer maps are tiled float3 c0 = tex2D(LayerMap0Sampler, tiledTexC); float3 c1 = tex2D(LayerMap1Sampler, tiledTexC); float3 c2 = tex2D(LayerMap2Sampler, tiledTexC); float3 c3 = tex2D(LayerMapCloudSampler, cloudTexC); // Blendmap is not tiled. float3 B = tex2D(BlendMapSampler, nonTiledTexC); // Find the inverse of all the blend weights so that we can // scale the total color to the range [0, 1]. float totalInverse = 1.0f / (B.r + B.g + B.b); c0 *= B.r * totalInverse; c1 *= B.g * totalInverse; c2 *= B.b * totalInverse; // c3 *= B; float3 final = (c0 + c1 + c2 + c3) * shade; return float4(final, 1.0f); in this effect, the blend image should have 3 colors including pure red, pure green and pure blue. how should I make my blend image? what colors should it have? can I use R, G, B, RG, RB, GB? please help me thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
A little off topic, but if you're going to use 6 texture stages, you're going to limit the number of cards that will be able to work with your application. For instance, my GeForce 4 can only handle 4 texture stages.

Share this post


Link to post
Share on other sites
I haven't seen Frank Luna's particular code before, but it seems that it blends 3 texture maps using the weights coded into another texture map. To blend 6 textures you'll need two textures to code the weights. The adaptation seems straightforward from that.

Shader model 2 cards and up support 16 textures, so you shouldn't have a problem with the number of textures. Older cards won't be able to run it, and won't even be able to run the shader you posted, so you're not limiting yourself any more than you already are. (Although the shader should be adaptable to SM1.4 cards by pre-normalising the blend texture, SM1.3 and down can't handle the 5 textures it already accesses.)

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!