Page 1 of 1

alpha splatting sample

Posted: Mon Jun 21, 2004 5:33 am
by poe
For those interested in experimenting with terrain alpha-splatting, I have a small sample package online. You can get it at ...


It mainly includes a couple of materials for Ogre's terrain plug-in (OctreeSceneManager). If you are unfamiliar with alpha splatting, in short it is an efficient method for making terrain meshes appear more varied and detailed using high resolution textures. Charles Bloom has a fine explanation at his website

This is meant only to be a quick introduction to one way to do alpha-splatting. There are other, and likely much better, ways of doing alpha-splatting. For instance, I notice that the most recent version of the PagingLandscape plugin uses splatting, which appears to be generated programmatically, although I have not thoroughly investigated it. In the end, if you want alpha-splatting, it will be necessary to somehow generate the alpha splats according to your needs.

The alpha_splat_test.material contains two techniques: alpha_splat_test_1_pass, which applies 4 textures (+ 3 alpha splat masks ) in one pass; and alpha_splat_test_4_pass, which applies 4 textures (+ 3 alpha splat masks ) in 4 passes.


I am assuming you have the latest (June 2004) cvs version of the terrain in OctreeSceneManager.

1) Put the textures including the alpha masks in your texture directory
2) Put the alpha_splat_test.material in your material directory
3) Put terrain.cfg in your working directory, or modify your current one with the last line referencing the desired material. I.e.,


Good Luck!

Posted: Mon Jun 21, 2004 1:22 pm
by sinbad
You dude! :) This was something on my list to do, although I don't actually need it for the project I'm working on right now so I might not have got around to it.

I haven't downloaded yet, do you also do the single-texture approximation in the distance, which can also serve as the base texture (Bloom mentions this in his paper)?

Posted: Mon Jun 21, 2004 1:58 pm
by houssem_bdioui
sinbad wrote: ... the project I'm working on right now ...
Hmm, I'm quiet interested in which kind of projects Sinbad is working on. :wink:

Posted: Mon Jun 21, 2004 6:07 pm
by Kencho
hehehe, Daikatana II, or maybe Doom IV 8)

Posted: Mon Jun 21, 2004 6:41 pm
by leedgitar
Well, he probably didn't want you to know this, but I heard he was boning up on his C# skills....

(that outta get him to talk :D)

Posted: Mon Jun 21, 2004 8:57 pm
by sinbad
Hehe. :D

Well, you obviously know it involves enhancing the standard terrain manager, but beyond that I can't elaborate. It's a bit of commercial work, I'll be back on Ogre full time (well, full time of my part time) at the beginning of August. In the meantime I'm largely just doing bugfixes on Ogre except for things that naturally make their way back here from that work. And answering all your persistent questions, of course. ;)

Posted: Tue Jun 22, 2004 3:57 am
by poe
I'm glad I could help carry some weight, if true.

I have not implemented "single-texture approximation" for Ogre (indeed, I've only added materials). In my pre-Ogre engine, remnants of which are still visible at ... ixotic.htm, I had attempted to collapse layers into a base texture for distance, but I could never get it to look right without gobs of fog. Instead, I decided to fade out a few layers for very distant pieces, which gained a few frames per second.

Note, again, that the PagingLandscape plugin does some "single-texture approximation" and maybe the excellent programmers there can help, but I think their method is still heavily dependent on fog--which I personally have grown to dislike intensely.

Posted: Thu Jun 24, 2004 11:52 am
by tuan kuranes
Here is the tool we use for paginglandscape2 :
(not yet in ogreaddons cvs)

There is surely some common code for the 2 scene manager

It can generates the alpha maps you need for splatting.
(and much more... normal maps, lightmaps, pvs, etc...)

In the plugin there is now multiple ways of splatting, all with a lod distance that use a single texture (base texture) in distance. Try splatting2, splatting3, etc...
If your scale is not too high, you can use the Colormap generated (though it need some work too, to scale the splats texture...)

Check the source code or the thread for more info.

Posted: Sat Jun 26, 2004 10:05 am
by tuan kuranes
Here's one with shadows,
generated with mappsplitter.
(should be unzipped on the poe's zip data )

It even has the single texture approximation using lod_distance, but doesn't seems to work.

(Lightmap data could go into RGB data of the "alpha splatting map", therefore be used with a color_op_ex modulate... and save all passes that it added. ( and finally uses all bits of 32 bits alpha splatting maps))

Posted: Sat Jun 26, 2004 10:13 am
by tuan kuranes
here's a picture in action :


Posted: Sun Jun 27, 2004 8:56 am
by tuan kuranes
Zip updated with the lightmap idea.

So same number of TU and number of pass, but lighted.

( this one also updated with generation of "alphasplatlightmap"

Opengl doesn't give any result with those material files...

Posted: Sun Jun 27, 2004 8:52 pm
by poe
Looks good tuan. I'll check out your work when I get back to landscapes...

Posted: Thu Jan 06, 2005 7:35 am
by spookyboo
Does anybody still have this material file, because the link is broken? I tried splatting in the TerrainSeneManager, but my splatting is done in multiple passes. I'm curious how splatting of multiple textures is done in just one pass, because the framerate drops significantly with each extra pass.

Posted: Thu Jan 06, 2005 9:35 am
by tuan kuranes
It's in ogreaddons paginglandscape material files.
You can test in PLSM2 with
in paginglandscape2.cfg

Posted: Thu Jan 06, 2005 10:28 am
by spookyboo

I've tried something similar, but could only create 1 base texture and 1 splat in 1 pass. I guess I must have done something wrong. I will give it another try.

Posted: Thu Jan 06, 2005 9:10 pm
by spookyboo
I've got all textures in 1 pass and the result looks really good, but the framerate doesn't differ that much if I use 3 passes.

@ tuan kuranes
Thanks again

Posted: Thu Mar 24, 2005 6:17 am
by Robomaniac
Does anyone have a copy of this they can upload, the orig link is a 404 :\

Posted: Thu Mar 24, 2005 6:24 am
by Falagard
As tuan said above, it's including in paginglandscape now.

Posted: Thu Mar 24, 2005 6:39 am
by Robomaniac
ah, missed that :P