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 » Mon Jun 21, 2004 5:33 am

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!
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Post by sinbad » Mon Jun 21, 2004 1:22 pm

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)?
0 x

User avatar
houssem_bdioui
Kobold
Posts: 31
Joined: Tue May 11, 2004 8:09 am
Location: Tunisia

Post by houssem_bdioui » Mon Jun 21, 2004 1:58 pm

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:
0 x

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Post by Kencho » Mon Jun 21, 2004 6:07 pm

hehehe, Daikatana II, or maybe Doom IV 8)
0 x
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 » Mon Jun 21, 2004 6:41 pm

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)
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Post by sinbad » Mon Jun 21, 2004 8:57 pm

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. ;)
0 x

poe
Gnoblar
Posts: 4
Joined: Wed Jun 09, 2004 6:24 am
Location: Atlanta, GA USA

Post by poe » Tue Jun 22, 2004 3:57 am

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.
0 x

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

Post by tuan kuranes » Thu Jun 24, 2004 11:52 am

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.
0 x

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

Post by tuan kuranes » Sat Jun 26, 2004 10:05 am

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))
0 x

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

Post by tuan kuranes » Sat Jun 26, 2004 10:13 am

here's a picture in action :

Image
0 x

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

Post by tuan kuranes » Sun Jun 27, 2004 8:56 am

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...
0 x

poe
Gnoblar
Posts: 4
Joined: Wed Jun 09, 2004 6:24 am
Location: Atlanta, GA USA

Post by poe » Sun Jun 27, 2004 8:52 pm

Looks good tuan. I'll check out your work when I get back to landscapes...
0 x

User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1140
Joined: Tue Jul 06, 2004 5:57 am
x 15
Contact:

Post by spookyboo » Thu Jan 06, 2005 7:35 am

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.
0 x

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

Post by tuan kuranes » Thu Jan 06, 2005 9:35 am

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
0 x

User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1140
Joined: Tue Jul 06, 2004 5:57 am
x 15
Contact:

Post by spookyboo » Thu Jan 06, 2005 10:28 am

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.
0 x

User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1140
Joined: Tue Jul 06, 2004 5:57 am
x 15
Contact:

Post by spookyboo » Thu Jan 06, 2005 9:10 pm

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
0 x

User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac » Thu Mar 24, 2005 6:17 am

Does anyone have a copy of this they can upload, the orig link is a 404 :\
0 x
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
Contact:

Post by Falagard » Thu Mar 24, 2005 6:24 am

As tuan said above, it's including in paginglandscape now.
0 x

User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac » Thu Mar 24, 2005 6:39 am

ah, missed that :P
0 x
phear hingo

My Webpage

Post Reply