• Advertisement
Sign in to follow this  

Multiplying 3 textures on a dual-texture GPU

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

I'm redoing my terrain texturing and colouring system for my heightmapped terrain and have decided what I want to do. But now I've suddenly realised there are problems with getting it to work on the target low-end hardware. I'm hoping someone with better knowledge of D3D render states and texture stage states can suggest something... I have 3 textures which need to be used: Firstly a colourmap which supplies the basic colour over the terrain - mostly greens and browns. This has a resolution of 0.5-1m - not high detail. Secondly I have a set of detail maps, one for each ground type ie grass, pebbles etc. Triangles using these are drawn with vertex alpha so that different detail maps can be blended where grass meets mud for example. These textures are greyscale as the colour information comes from the colourmap - this is just the very small-scale detail. Finally I have a cloud texture. This is a simple greyscale texture which is used to get a slow-moving cloud-shadow over the landscape. The basic output I require is : colour output = cloudmap * colourmap * detailmap. However my target lowend hardware is a TNT2 or GF2 which have only 2 texture units. So I must use more than one pass. However I can't see that it's possible to use alpha blending to multiply the output of the previous pass with the current one. It sees I'm limited to the form: alpha blended output = source factor * source + destination factor * destination. Is it possible to modulate 3 textures in 2 passes? The extra complication is that to blend the detail textures, during this part I need the alpha blending set up a particular way or it doesn't work. Any ideas/tips/advice?

Share this post


Link to post
Share on other sites
Advertisement
modulate:
SRCBLEND = DESTCOLOR
DESTBLEND = ZERO

ie:
oldcolor * newcolor + 0 * oldcolor

modulate2x:
SRCBLEND = DESTCOLOR
DESTBLEND = SRCCOLOR

ie:
oldcolor * newcolor + newcolor * oldcolor

so, in pass 1 render without blending, detail * colormap.
In pass 2, enable blending, using srcblend=destcolor, and render the clouds.

pass 1:
color = detail * colormap
pass 2:
color = clouds * (detail * colormap)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement