# Splat alpha weightings problem

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

## Recommended Posts

Hey all! Once AGAIN (!!!) I have decided to slightly rework my terrain engine. My new method is faster and looks a lot better than any previous method, but I'm having a problem with alpha blending. If anyone can help me out of this one, then I might even be tempted to write an article on my very long journey through many methods of terrain texturing! Now I'm using a method similar to splatting, except that I am calculating blend factors slightly differently and rendering in a slightly more efficient way. I have a base layer which consists of tiles rendered with a given texture. I then proceed for every texture to render transition quads, which are alpha blended onto the terrain to provide transitions. I am stuck, in that every time I paint a splat onto my terrain, I use a falloff equation to generate weights based on distance from the brush centre. Now this works fine with one or two textures, but I have problems in areas where there are multiple transitions quads blending in the same space. If I have two transitions quads being alpha blended over one another, the weightings are thrown out and it produces visual anomalies where the wrong transition appears on top of another. I think this is because the blend factors are not calculated with the other transition quads in mind. I'm guessing that I need to somehow normalize the blend factors so they sum up to 1, but I'm not sure how. Say I have 2 transition quads Grass - Weight 0.7 Rock - Weight 0.2 Also one base quad rendered without alpha blending. Now I'm guessing that for every extra transition quad added, any blending weights below it would have to be multiplied by the inverse weight(1.0-BlendWeight) of the layer directly above it. This would produce the following blends, assuming that the base layer effectively takes on an alpha value of (1.0 - FirstLayerFalloffBlendFactor ... 1-0.2 in this case) Grass - 0.7 Rock - 0.2*0.3 = 0.06 Base Layer effective alpha (though it is rendered without blending) = (1-0.2)*0.3 = 0.24 0.7 + 0.06 + 0.24 = Total of 1.0 Alpha This method seems to normalize the alpha values, but I’m not sure if it results in the correct ratio of blends for each transition to remove the visual artefacts. I hope this is making sense, anyway, if anyone can tell me if this seems right or suggest a correct way, I’d appreciate it a lot. Once it’s sorted I might even get started on an article ;) Cheers, Steve PS I'm using DirectX and blend mode: D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA

1. 1
2. 2
Rutin
23
3. 3
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633653
• Total Posts
3013160
×