triplanar mapping terrain demo

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

triplanar mapping terrain demo

Post by Mel »

Some people asked me about how to use the triplanar mapping shader i made the other day, so, i thought it would be nice to have a demo that showed the whole thing in motion.

This is an image of it in action.

Image

It is an Irrlicht terrain mapped with this shader, in a foggy environment. I have scaled the terrain so it covers a large area just it doesn't feel as small as the terrain example gives. Irrlicht can display really large terrains on its own, just give it the chance to do so :)

http://omegasection.g0dsoft.com/demos/triplanarDemo.zip

I have tried to make the demo fully portable, but i haven't actually tested it on linux, so no linux binar, only windows. The source code provided has no projects, though it shouldn't be too hard to test. I hope.

And of course, i can't tell if it will work or not, but that is what the source code is there for :). Just in case, the 6 textures version needs irrlicht to be recompiled to support 6 textures at least
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: triplanar mapping terrain demo

Post by Cube_ »

Looks good.... but what is triplanar mapping?
"this is not the bottleneck you are looking for"
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: triplanar mapping terrain demo

Post by Mel »

Triplanar mapping is a technique where the mapping coordinates are aligned to the axes and blended together using the normals of the objects so the textures can avoid parallel projections on the polygons.

I can't explain it simpler... ^^U
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: triplanar mapping terrain demo

Post by hendu »

Haha, way to explain in plain English for the dude who CBA to google :D :D
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Re: triplanar mapping terrain demo

Post by Seven »

this is very cool and I have implemented it into my object system already. Very nicely done!

I am not a shader guru, and would like to know how I would add dynamic lighting capability to this?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: triplanar mapping terrain demo

Post by hendu »

By editing the shaders to run with your lighting system, sadly.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: triplanar mapping terrain demo

Post by Mel »

The system already allows to change the light direction in real time. And to change the colors, you can use the object's material. in fact, i think the best way is to create a triplanar mapping system aimed to a deferred rendering, so you can add as much lights as you want without the need to touch the triplanar code. I could try and figure out that...
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: triplanar mapping terrain demo

Post by Granyte »

look pretty nice but why are you using the vertex normal to select the texture?

with the irrlicht terrain it makes the texture change when you move
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Re: triplanar mapping terrain demo

Post by Seven »

Mel wrote:The system already allows to change the light direction in real time. And to change the colors, you can use the object's material. in fact, i think the best way is to create a triplanar mapping system aimed to a deferred rendering, so you can add as much lights as you want without the need to touch the triplanar code. I could try and figure out that...
I would love to help, but unfortunately, I am just now learning about shaders. I would be interested in seeing any progress that you make however, I MIGHT even be able to add some little thing.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: triplanar mapping terrain demo

Post by Cube_ »

@hendu, I googled "Triplanar mapping" and I could not find anything worth looking at, I found some results for UDK....
But what I was hoping for was something like this https://www8.cs.umu.se/kurser/5DV051/VT ... apping.pdf
*above example is for parallax mapping, obviously.*

And @mel, thank you for the explanation.
"this is not the bottleneck you are looking for"
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: triplanar mapping terrain demo

Post by hendu »

Yeah, those results are kinda bad actually. Anyway in plain english, it helps remove texture stretching on near-vertical terrain.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: triplanar mapping terrain demo

Post by Cube_ »

And now I can thank you too, hendu.
And since know what it is good for I gotta learn how to do it *shouldn't be too hard*
"this is not the bottleneck you are looking for"
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: triplanar mapping terrain demo

Post by christianclavet »

Hi, Interesting...

The only "bad" thing is the LOD of the terrain that change the topology of the terrain all the time when we move. Is it the Irrlicht terrain that's doing that? Or something in the shader.

Looking at it, it seem to change the textures based on the face normals (perhaps). Would have been nice to have a FPS meter to see how much this technique takes...

The 6 textures version is really beautiful (when we don't move)
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: triplanar mapping terrain demo

Post by Mel »

It is Irrlicht doing that, in fact you can apply the shader to any mesh you want.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: triplanar mapping terrain demo

Post by Granyte »

or you can mak the thing use normal map that's how i did it on my planetary generator
Post Reply