Jump to content
  • Advertisement
Sign in to follow this  

Texture splatting with texture stages algorithm

This topic is 4229 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 I'd like to have an algorithm to render texture splatting with as many texture stages as the hardware supports. The first layer should always be opaque, the following N layers should be blended with their own alpha map. I have tried to do this, but I haven't been able to figure out how to do this with the texturing stages and my HW doesn't support high enough PS. My card only supports four textures per pass so it will have to be some sort of loop. But the number of textures varies with diffrent HW. How could this be coded nicely without coding each 100 explicit cases?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
http://www.gamedev.net/reference/articles/article2238.asp
here is link where you can fin a demo with and widouth PS but the concet suport a maximum of 4 textures.. if you want to use more get apply the code twice for diffrent textures

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
http://www.gamedev.net/reference/articles/article2238.asp
here is link where you can fin a demo with and widouth PS but the concept suports a maximum of 4 textures.. if you want to use more get apply the code twice for diffrent textures

Share this post


Link to post
Share on other sites
The alpha values have locally to sum to one to avoid overdriving the luminance. That is independent on how many textures you blend, and it is independent of how many iterations you use to do. Of course, you have to preserve the order of textures.

Roughly, you have to set-up the available texture stages in blocks of the splatting textures. If N stages are available, then iterate and set-up the textures {0,N-1} with the 1st iteration, textures {N,2N-1} with the second iteration, and so on until all blend texturings are performed:

(0) Ask DirectX for the amount of stages.
(1) Set-up the stages for the next min(N,M) textures, where M ist the amount of not yet processed textures.
(2) Render.
(3) Goto (1) if there are remaining textures.

If you don't use the FFP but shaders then you have additionally take care of selecting the appropriate shader, or even better to push an appropriate shader parameter to control how many blendings the shader performs (simple if conditionals were sufficient).

Share this post


Link to post
Share on other sites
I've seen that article many times, howerver it doesn't take advantage of the graphic card's multi-texturing abilities. I need some way to use multitexturing with the FFP in the most optimal way. Ie if the HW support 4 bound textures like mine do and the terrain patch use 5 textures, then first pass with be a opaque base layer then layer 2 blended. Second pass will be layer 3 and 4 blended above the previous pass. And finally the last pass will only contain one single texture layer that will be blended over all previous passes.

I can't figure out any good way how to structure this and how to setup all the texture passes. Anyone ever done this before? I'd love a code snippet! :)

Share this post


Link to post
Share on other sites
Also, it's frequently better to just do the splatting once to a composite texture, and then using that composite texture. Depends on your circumstances, but usually the splatting requirements don't change from frame to frame, so referring all those resources every frame can be a waste.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!