Texturing splattering on terrain using blending.

Blitz3D Forums/Blitz3D Programming/Texturing splattering on terrain using blending.

What can i say i found a sweet loog 3 years old :/ depressing about texture blending.


sswift (Posted 3 years ago)

Unfortunately, due to the way texture blending modes work, you can't have a masked texture affected by a light.

What you are doing is this:

1. Apply light to white pixel.
2. Multiply first texture color with lit pixel color.
3. Replace pixel with mask texture pixel where mask is opaque.

As you can seem the lighting information is lost where the mask replaces the color of the pixel below it.

You would need to be able to apply the pixel lighting as the last step rather than the first for this to work. However, I don't know if it would be possible to do that at all, and Blitz certainly does not support it. In addition, doing that would make other effects, such as making parts of a mesh glow despite not being lit, impossible.

To achieve the effect you want, what you will have to do instead is use a second surface with the masked texture on it. Then it will have it's own untarnished plain lit pixel to multiply with, resulting in the appearance of being lit like the rest of the mesh.

Unfortunately, each surface comes at a great cost, and you will be limited to around 200-400 surfaces visible at once on the screen in your game if you want to maintain an acceptable framerate.

Personally I reccomend that you just make two textures, one with moss, one without. It's much simpler, and you're not very likely to run out of texture ram unless you are making a huge project.