alpha splatting sample

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
poe
Gnoblar
Posts: 4
Joined: Wed Jun 09, 2004 6:24 am
Location: Atlanta, GA USA

alpha splatting sample

Post by poe »

For those interested in experimenting with terrain alpha-splatting, I have a small sample package online. You can get it at

http://edgarapoe.home.mindspring.com/qu ... atting.zip

Image

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 http://www.cbloom.com.

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.


Instructions:

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.,

CustomMaterialName=alpha_splat_test_1_pass

Good Luck!
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post 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)?
User avatar
houssem_bdioui
Kobold
Posts: 31
Joined: Tue May 11, 2004 8:09 am
Location: Tunisia

Post 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:
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

hehehe, Daikatana II, or maybe Doom IV 8)
Image
User avatar
leedgitar
OGRE Community Helper
OGRE Community Helper
Posts: 61
Joined: Wed Jan 22, 2003 1:58 am
Location: Baltimore, MD
Contact:

Post 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)
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post 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. ;)
poe
Gnoblar
Posts: 4
Joined: Wed Jun 09, 2004 6:24 am
Location: Atlanta, GA USA

Post 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 http://edgarapoe.home.mindspring.com/qu ... 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.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

Here is the tool we use for paginglandscape2 :


http://tuan.kuranes.free.fr/paginglandscape2.zip
(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.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

Here's one with shadows,
generated with mappsplitter.
(should be unzipped on the poe's zip data )


http://tuan.kuranes.free.fr/alphasplat.zip

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))
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

here's a picture in action :

Image
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

Zip updated with the lightmap idea.

http://tuan.kuranes.free.fr/alphasplat.zip

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

( this one also updated with generation of "alphasplatlightmap" http://tuan.kuranes.free.fr/paginglandscape2.zip)

Opengl doesn't give any result with those material files...
poe
Gnoblar
Posts: 4
Joined: Wed Jun 09, 2004 6:24 am
Location: Atlanta, GA USA

Post by poe »

Looks good tuan. I'll check out your work when I get back to landscapes...
User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1141
Joined: Tue Jul 06, 2004 5:57 am
x 151
Contact:

Post 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.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

It's in ogreaddons paginglandscape material files.
(samples/media/paginglandscape/splat/alpha_splat_material)
You can test in PLSM2 with
#TextureFormat=Splatting7
in paginglandscape2.cfg
User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1141
Joined: Tue Jul 06, 2004 5:57 am
x 151
Contact:

Post by spookyboo »

Thanks,

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.
User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1141
Joined: Tue Jul 06, 2004 5:57 am
x 151
Contact:

Post 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
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

Does anyone have a copy of this they can upload, the orig link is a 404 :\
phear hingo

My Webpage
User avatar
Falagard
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2060
Joined: Thu Feb 26, 2004 12:11 am
Location: Toronto, Canada
x 3
Contact:

Post by Falagard »

As tuan said above, it's including in paginglandscape now.
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

ah, missed that :P
phear hingo

My Webpage
Post Reply