Author Topic: terrain detail  (Read 9623 times)

Offline Grandmaster B

  • byte
  • *
  • Posts: 11
    • View Profile
Re: terrain detail
« Reply #15 on: December 18, 2009, 10:53:54 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #16 on: December 19, 2009, 10:21:12 pm »
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?

Offline Grandmaster B

  • byte
  • *
  • Posts: 11
    • View Profile
Re: terrain detail
« Reply #17 on: December 20, 2009, 05:12:36 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #18 on: December 20, 2009, 11:12:29 pm »
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:

Offline Grandmaster B

  • byte
  • *
  • Posts: 11
    • View Profile
Re: terrain detail
« Reply #19 on: December 21, 2009, 12:06:03 am »
 :o
Wow, already looks amazing!! Do you have a game idea in mind or are you just playing?

Offline enbe11_3

  • byte
  • *
  • Posts: 17
    • View Profile
Re: terrain detail
« Reply #20 on: December 21, 2009, 04:06:26 am »
awesome graphics!!! are you going to post the source code? ;)
« Last Edit: December 21, 2009, 04:11:14 am by enbe11_3 »

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Re: terrain detail
« Reply #21 on: December 21, 2009, 03:09:21 pm »
wow, that's beautiful. I love the water.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #22 on: December 21, 2009, 11:30:47 pm »
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.



« Last Edit: December 23, 2009, 12:44:18 pm by EgonOlsen »

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: terrain detail
« Reply #23 on: December 22, 2009, 12:01:56 pm »
Wow.  What method are you using to generate the terrain, and how far does it extend in any given direction?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #24 on: December 22, 2009, 02:47:19 pm »
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.

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: terrain detail
« Reply #25 on: December 22, 2009, 09:43:16 pm »
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....)
« Last Edit: December 22, 2009, 11:26:27 pm by AW999 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #26 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

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: terrain detail
« Reply #27 on: December 28, 2009, 10:45:51 pm »
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 ?   :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #28 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.

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: terrain detail
« Reply #29 on: January 04, 2010, 07:52:34 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 ?