Author Topic: terrain detail  (Read 19044 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #30 on: January 04, 2010, 08:01:37 pm »
Almost. I'll upload a zipped version today, if i find the time.

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: terrain detail
« Reply #31 on: January 04, 2010, 09:34:07 pm »
BTW, how did you make the sky in that program?  Are there any articles on creating a good sky?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #32 on: January 04, 2010, 09:59:01 pm »
The sky is a shameless rip from raft's work on Aptal Karga...didn't i gave credit before? I guess, i've forgotten...shame on me... :-[

However, here's the file: http://www.jpct.net/download/misc/terrain.zip

As said, it's pretty hacky. Especially processing of the trees and generating the terrain texturing could be improved. Sources are included, i've put everything into one, uncommented (almost) file. It needs the jpct.jar that's included to run, it won't run with 1.19, because it uses some stuff that i've added for 1.20.

There are some keys:

1+2 : Move the sun. The lens flare doesn't take the mountains into account for performance reasons.
t: toggle trees (on by default)
d: toggle detail mapping (off by default)
CRSR+PGUP+PGDOWN: move
ESC: Exit

FPS will be printed to the console each second.

Edit: Performance on my main machine (Core2 Quad@3.2Ghz, Windows Vista Ultimate 32bit, 4GB, Ati Radeon HD 5870 - 1GB, Java6.something) at the starting position without moving the mouse.

With trees: 83fps (was 55 before optimizing...)
W/o trees: 1200fps

Edit2: Performance on my test machine with Intel onboard graphics (Core2 Duo@2.2Ghz, Windows XP, 2GB, Intel 945G, Java6.something):

With trees: 10fps
W/o trees: 31fps




« Last Edit: January 04, 2010, 11:13:09 pm by EgonOlsen »

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: terrain detail
« Reply #33 on: January 05, 2010, 12:35:26 pm »
However, here's the file: http://www.jpct.net/download/misc/terrain.zip

 Wow. Even on my machine, it runs with a framerate in the 20s or 30s, sometimes 40s or higher.
 Since you provided the sourcecode, I assume we can freely adapt it for our own projects?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #34 on: January 05, 2010, 09:19:13 pm »
Wow. Even on my machine, it runs with a framerate in the 20s or 30s, sometimes 40s or higher.
 Since you provided the sourcecode, I assume we can freely adapt it for our own projects?
Sure. The usual "do whatever you like with it"-license that i'm using for all of my sources applies here too. Just keep in mind, that the whole thing is just written to make it work. There have to be many many ways to do things better than i did in this demo.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #35 on: January 06, 2010, 06:12:16 pm »
BTW: If you have at least a dual core, it can be worth it to set Config.useMultipleThreads in the constructor of Terrain to true. If the graphics card can handle it, the demo scales pretty well (115 fps compared to the 83 of the single threaded renderer).

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #36 on: December 07, 2011, 11:51:58 pm »
Resurrected the old terrain stuff to play around with the shader based splatting method mentioned earlier.

See how the path winds through the mellow hills and the lovely meadows? Looks like Skyrim, doesn't it? Well, maybe not... ;)



BTW: The benefit of doing it this way is, that you can actually "paint" the splatting into a texture instead of relying on the height and some dubious alpha values.

Edit: Changed picture to one with better lighting.
« Last Edit: December 08, 2011, 10:54:51 pm by EgonOlsen »

Offline Hrolf

  • int
  • **
  • Posts: 84
    • View Profile
Re: terrain detail
« Reply #37 on: December 09, 2011, 05:32:47 am »
Oo! Pretty! I wonder if shaders could also be used to fake up some sort of shadows?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: terrain detail
« Reply #38 on: December 09, 2011, 07:55:32 pm »
I tried this by modifying the blend texture (i.e. the one that tells the shader which texture to use where) when planting the trees by placing a dark spot below each tree. It worked so far, but i forgot that i'm not rendering trees in the distance, so there were no trees but the dark spots remained, which made the terrain look like some kind of acne in the distance.