• entries
    436
  • comments
    1179
  • views
    764018

New Golem3D terrain blending scheme

Sign in to follow this  

2049 views

I finally got around to re-vamping the Golem3D tile blending scheme. Initially, it used the same sort of tile blending scheme that the Accidental Engine currently uses, ie separate alpha mask textures are combined with a terrain texture using multi-texturing in order to create the terrain blends. This results in the cruddy blocky textured look you can see in these screen shots:


Old Golem3D blending style (featured in the G3D editor, here)



The same blending scheme applied to the strictly 2D Accidental Engine


The new scheme eliminates this squarish blockiness. The tiled approach blending has been replaced with a vertex-by-vertex approach (as I should have done initially). In this new method, each vertex is assigned an alpha value for each of the terrain layers. This alpha value is stored in 8 separate arrays or VBOs, and is passed to the terrain-rendering shader as a vertex attribute. The shader replaces the alpha for the final color with this attribute. (This lets me upload vertex and normal data to a VBO once, then never touch it again, and I can change the alpha map just by switching buffer sources.) The end result is terrain transitions that are vastly more pleasing to the eye, smoother, and not restricted to large tilish blocks. I can also manipulate the alpha values to sharpen or blur terrain transitions as desired. All in all, it's a large improvement, and it only took a few very minor modifications to the code.

Here is an example of the final result. Note that this shot does not manipulate the alphas to smooth the blend between types; each vertex is assigned either a 1 or a 0 for a given layer's alpha. Much smoother transitions are possible. In this first shot, the terrain is flattened, in the second it is elevated to see how it would look in-game.




A very trivial change, but I think the result is well worth it. I have in mind as well a few ideas to further optimize it, even though it already runs pretty fast.
Sign in to follow this  


4 Comments


Recommended Comments

Quote:
A very trivial change, but I think the result is well worth it.

Definitely[attention] - Looks awesome.

That's some good work there. Care to add a journal entry about how exactly (within reason!) you designed the algorithm? We get a load of these sorts of questions in the DX forum, would be cool to have a "case study" to point at [smile]

Good entry

Cheers,
Jack

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now