terrain detail

Started by draga, December 15, 2009, 04:18:27 PM

Previous topic - Next topic

Grandmaster B

No there was no LOD, the terrain layer meshes were used for blending the borders by using the alpha color of the outer vertices, invisible polygons on a layer were removed for the layer mesh. So there were several unique independent meshes that made the whole terrain. If you use a texture for blending the layers and a single terrain mesh, LOD should be doable like in a normal terrain.

Here is the basic layout for multilayer terrain with a shader (LOD-able, fast on decent Hardware):

- Lets say you have a single terrain mesh, and you have 3 layer textures you want to blend into the terrain.
- You also have one blending texture with RGB channels. The R part is for blending layer 1, B is for 2, and C is for 3.
- The blending texture must be UV mapped / stretched to the whole terrain. The layer textures use this UV coordinates but multiply/scale it in the shader to tile more than once.
- Assign the textures to the texture channels of the hardware, both the layer and the blending textures. This takes 4 texture channels in this example.
- Now use a shader to blend the layer textures. This is realy simple shader that just combines the layer textures based on the blending texture and scale the UV for the layer textures.

I haven't used that myself tho.

EgonOlsen

Nice idea. The shader shouldn't be too hard to write, but how do you create the blending texture? Do current 3d editors have support for this?

Grandmaster B

The blending texture must be created with a painting program i guess. Blender supports stencil textures to "paint" terrain in realtime but only one channel (one blending-texture per layer), not the packed R-G-B style described below. Its also possible to auto-generate a blending texture based on the slope/normal and height of the terrain.

EgonOlsen

Inspired by this thread, i've played a little with the vertex alpha method (i.e. no shaders). I had to add two methods to actually assign them and fix one bug on the way. Next i'm going to add trees. This is how it looks now:

High noon at the lake:


Sun down:

Grandmaster B

 :o
Wow, already looks amazing!! Do you have a game idea in mind or are you just playing?

enbe11_3

#20
awesome graphics!!! are you going to post the source code? ;)

JavaMan

wow, that's beautiful. I love the water.

EgonOlsen

#22
Some trees are in. Approx. 1300 of them (with 690 vertices each) are in the view. They really hurt performance even on my Radeon 5870... ;D I'm still not sure why...however, it's still "playable".

To the questions: No, i don't want to make a game of it. It's just for fun and maybe as an additional test bed for the engine. I may post the sources later, but they are really hacky. It's all in one class. The water is pretty simple: Just two textured layers that move up and down while rotating slightly. Looks pretty good considering that it doesn't use any pixel shaders at all.




AW999

Wow.  What method are you using to generate the terrain, and how far does it extend in any given direction?

EgonOlsen

It's an OBJ-file created with Treegen. You can see maybe 30% of its width in the screen shot, so it's not very large. Terragen can't export anything larger ATM.

AW999

#25
Could you put an applet version of it online so we can see it, or a downloadable jar file ?
(I mean so we can see it in action....)

EgonOlsen

I will do later. Currently, i'm still optimizing some parts of jPCT for it. It's a pretty good test case... ;D

AW999

Quote from: EgonOlsen on December 23, 2009, 07:27:26 AM
I will do later. Currently, i'm still optimizing some parts of jPCT for it. It's a pretty good test case... ;D

  When are you going to put it online (via an applet or whatnot) so we can see it ?   :)

EgonOlsen

I hope to manage that within a week. I'm a bit short on time right now and i'm still optimizing jPCT for this usage. I've already increased performance of that test case by 50%, so it should be worth the wait.

AW999

Quote from: EgonOlsen on December 28, 2009, 11:33:12 PM
I hope to manage that within a week. I'm a bit short on time right now and i'm still optimizing jPCT for this usage. I've already increased performance of that test case by 50%, so it should be worth the wait.

  Is it done yet ?