Terrain version 2.0 - Day/Night cyclus - WIP - [Download]

Note: this version is outdated. new version here: https://discourse.panda3d.org/viewtopic.php?f=6&t=16441

I’m currently working on the second version of my terrain (first version: [url]Tesselated Terrain - Version 1.6 [with download]])

Here are some screenshots of what I have done until now (I’ll update them regulary when I have new versions):

Screenshots


(Full size http://s1.directupload.net/images/131026/y9n4q4z9.png)


(Full size http://s1.directupload.net/images/131011/o4sbavz8.png)


(Full size http://s1.directupload.net/images/131007/tn4c3sjs.png)

For more screenshots, see also my post about atmospheric-scattering: https://discourse.panda3d.org/viewtopic.php?f=6&t=16441

Features

  • Quadtree based, can render 8K heightmaps
  • Screenshot: 8k heightmap

Performance:
Measured with a GTX670 and a i7 3820

  • ~ 600FPS without shadowmap
  • not tested with shadowmap yet

Todo:

  • No vegetation yet
  • Cascaded shadow maps

Thanks

  • to rdb, for helping me with my coding issues
  • to ThomasEgi for helping me to make the terrain more realistic

Source code
You can download the (very outdated!) source here: https://www.dropbox.com/sh/v1pc804ddpk4ecl/W1f8OUyLqr

To be able to use it, download the pyd which matches for your system here: https://www.dropbox.com/sh/0ftre8h3hqcaupu/JIu8cYL36a and replace the shipped “BrainzCore.pyd”.

Wow - looks really impressive.

I’m having some issues with tiling on my own much less impressive terrain. I was thinking of making the detail / tiled texture fade with distance so at least the tiles will be less apparent on far terrain. (So just let the low detail colour map show instead). Would still have problems with near terrain though :slight_smile:

I’ve heard of other ways like placing another noise texture over the detail ones to break up tiling a bit - but not sure if that’ll work in anger.

I’ve been using some textures from the packs here: nobiax.deviantart.com/art/Free-3 … -243349578. But I feel they probably don’t scale to large terrains.

Thanks!

I thought about switching texture size at a certain view distance … I will include it in the next sample … thanks for that hint!

I’m already placing a noise texture over the terrain, but too much noise won’t look good I think …

The textures you linked are for smaller models I think … I don’t think they are that well tileable …

Tobias

Very impressive indeed! The realism and solidity of the terrain is very well-done, I feel. :slight_smile:

Thanks!

UPDATE

  • Shadowmapping implemented

Beautiful terrain. Hope you share final code )

btw, for the previous version I made GLSL variant of your terrain_engine.cg to run it on the non NVIDIA cards.

Thanks, of course I’ll share the code :slight_smile: The reason why there are no builds yet are simple: I don’t want to upload 230MB every time I make a change … I of course could use a version controll system but that’s a bit oversized.

If you ported it to glsl, It would be really neat if you could share it (maybe in the original thread?), as many user could not run the cg sample …

Wow!

Tell me please: how are you currently defining the terrain map? Is it entirely random, or can it take a heightmap? Do you yet have a tool for creating terrains (or support for one), or plans for developing one in the future?

I’ll admit that I’d love to use a terrain system like this at some stage!

The terrain is defined by a heightmap and multiple other maps … I’ll make a short list of used assets here:

Terrain:

heightmap.png - 4096 x 4096 grayscale (16 bit)
normals.png  - 4096 x 4096 rgb (16bit -> will get scaled to 8 bit when I have some time)
texturemap.png - 4096 x 4096 rgba (16 bit , see normals)
----
~ 130 MB

Materials:

5 Different materials (grass, rock, snow, gravel, sand), each:
- name.dds 2048 x 2048 (DXT1)
- name_N.dds 2048 x 2048 (DXT1)
- To implement: name_H.png (parallax occlusion) 1024 x 1024 (DXT1)
----
~ 90 MB

I use World Machine 2 to generate the terrain, normals and texturemap, it’s an awesome tool used by many big studios (DICE, Unigine, etc.). It’s a bit difficult to get a start, but when you have done that, you have an awesome list of tools to create, filter and sculpt your terrain (fully procedural! that’s what I like as a programmer).

One can download world machine from http://www.world-machine.com/. I’ve attached my project file, if one is interested in it. (Please don’t hate me for not attaching the build result, but 8GB are just too much! You’ll have to build it on your own … )

When the terrain is final, I’ll of course share the source. The problem yet is the size of the assets, the code is a mess (without comments), and It requires a C++ module which is only compiled for windows (& Panda3D Dev-Build) yet. I had no time to make it work on linux yet.

There’s an editor in work, but it will be more a game editor than a terrain editor, and is by way not finished.
terrain v2.zip (5.89 KB)

Ah, fair enough; overall this looks rather promising. :slight_smile:

If you do get the code cleaned up to your satisfaction, I think that I’d love to see it included in the official Panda code-base.

I’ve started with cleaning up the code … its in progress but not finished yet … maybe I’ll upload some dev build this weekend

Hi Tobias,

I would be very interested to see if I can turn this into a plugin so that it works with my editor for the community, so I’ll be waiting for the source with much anticipation :slight_smile:

Well, the source is not that big problem, as I’ve cleaned it up now. I’ll upload the assets and source to dropbox this afternoon I think … but the real problem is, it requires a c++ extension (for the quadtree, because of performance).

I will include the visual c++ project and the bat files to compile interrogate, and also 2 precompiled versions (one for windows, latest panda sdk, and one for windows, latest panda dev build). If you are on linux, you will have to build the plugin yourself, or use another method to generate the heightfield.

I have also a python version of the quadtree, but it is not so performant with 4096x4096 heightmaps, you would have to switch to a 2048x2048 heightmap or so … but as fallback it might be worth a try.

I’ve uploaded a dev-build now. To be able to use it, you have to build the quadtree-module for your system (except you use windows with the latest panda3d dev-build, then you can leave it as is). You can get the source for the module here: https://www.dropbox.com/sh/evs9ak22nhbqqrm/UXn1ycMl7D

You can download the terrain source here: https://www.dropbox.com/sh/v1pc804ddpk4ecl/W1f8OUyLqr

Hi Tobias,

I’m not really familiar with building stuff from source. I tried running CompileInterogate - 1.8.1.bat and got the following:

Interrogate
  *** Error in BaseQuadtree.h near line 15, column 25:
  parse error
Error parsing file: 'BaseQuadtree.h'
Interrogate Module
Referencing Library BrainzCore
Press any key to continue . . .

Do I need to do anything special in order to get this to build on win7? Thanks!

Which panda3d version are you using? I can provide builds for windows (Panda3D 1.8.1 & Dev-Version), so you wouldn’t have to recompile it.

If you still want to try it yourself, follow this guide: [url][Guide] Interrogate in 8 steps].

Running 1.8.1. If you have the .bins that would be great!

Edit:

Wait a second, what am I talking about. You’ve already included the .pyd in the previous package right? I wonder why it’s not working then :S

No, you’re right, I’ll compile a version for 1.8.1 now … just having some trouble with interrogate

It does not run because it’s compiled against the dev build, so it’s not compatible with your sdk, nothing wrong there :slight_smile:

Edit:

I’ve uploaded the built dlls here: https://www.dropbox.com/sh/0ftre8h3hqcaupu/JIu8cYL36a
Just download the .pyd which matches for your os and panda3d version, and replace the original “BrainzCore.pyd” …

I’ll update the terrain demo when I have some time so that all builds are included and the matching one is selected automatically.

Ok, this is seriously cool. Great work, and keep it up!

I’ll see if I can create a wrapper for this in my editor. :slight_smile:

Did the demo work for you? If yes, how was the performance? :slight_smile: