Terrain Screenshots

Started by
138 comments, last by JD 19 years, 9 months ago
Here''s mine that looks like crap. I made this in about 2 hours just for the hell of it. I cheated abit though because I displaced the mesh in a 3d editor and loaded the result into my program instead of creating the geometry programatically. I''m so bad at math it''s not even funny. I can''t really move around it yet as easily as I want to. I can move foward and backwards, and side to side, but when I want to rotate sideways, I always do it around the center.

http://img75.photobucket.com/albums/v227/Vampyre_Dark/Crappy%20Terrain%20Engine/

Advertisement
Well, I''ll give a shot at explaining how I turned my first terrain project from nothing to something...

I first started out with my heightmap, 1024x1024, with "depth" values and seeds at every edge of the cells in the heightmap. The depth controls the roughness of the fractal details and the seeds control the procedural details generation.
I went for a quadtree with geo-mipmapping to start with, 64x64 I think with vertices for every meter in the highest detail patches. I wanted atleast a 2 km view, preferrably more. Therefore, geo-mipmapping alone wouldn''t cut it, patches far away would get too numerous and bog down the rendering with the heapload of calls. Thus, when I found nodes high up in the quadtree that had children with the same LOD levels, I bunched them up into one patch, using the same index buffer as the detail patches used. Dunno how much this speeded up everything, say from 50 to 500 FPS
Now, to the general LOD generation. You have your source heightmap and want to generate LODded patches to render. You stitch up your heightmap into, say, 16x16 samples and make one patch for the highest detail level. For the next level, you''d store every second vertex. For the third level, you''d take only every fourth and so on. In my case, I took four samples from the heightmap and created one patch and added the detail depending on the LOD level (and perhaps bunched up the patches if they covered a big area).

That''s the longest post I''ve posted in these forums... Anyway, the best way to get started is to just start somewhere. When you''re knee deep, there''s no way out
quote:

Darkwing said:

Hey RipTorn, that looks nice. I just tried the demo but it doesn''t work right on gf-fx (water doesn''t show up). But it looks very good on screenshots. Just a few quick questions: What resolution do you use for rendering reflections and refractions. Is water animated?



resolution for both is 512x512. You don''t really notice since it''s all distorted... The water surface is not animated but the ripples, etc, do move. I''m thinking about ways to do dynamic rippling when things hit the water but I''m not too sure about this. probably not worth the effort. The reflection/refraction is also depth dependant which isn''t that easy to do efficiently but really makes a huge difference to how convincing it looks.

Yeah that demo is getting quite old. You will probably find it breaks when running in D3D too. (the D3D path is 10x better now - in fact it works better than the GL path)
Unfortunatly, geforces had lots and lots of problems with the demo (in really strange ways).. Most have been fixed now, but a few still remain (if you remember I posted about clip planes a while ago - frankly I''m still really irritated having to fix bug after bug that crop up because on the nvidia systems it just doesn''t want to do something)... *sigh*..

Yeah. so the next alpha will look much better on nvidia hopfully. but still not as good as ati since I''m going to have to cut out a few things so it works (mostly shaders).

No new demo for a while though since I''m off to graphite in singapore in a couple of days. ***yay***

| - My project website - | - email me - |
Howsit everyone,
Thank you for all your replies, If anyone doesn''t mind emailing me their source code so that I can look at how you guys implemented your Terrain rendering algorithms.

I am really stuck on how to implement the LOD/GEOMIPMAPPING Algorithms in the source I pasted earlier.

I thank everyone for contributing their screenshots and demos to this thread. It''s been really inspirational. Let''s not stop it here but carry on.

Best Regards

---DirectXSA---
Lachdannan Corp.
www.lachdannan.za.net
Since everybody else is posting screenies, here''s a little something:



It''s all pretty simple stuff and the texturing isn''t final, but I like the way it looks at sunrise It uses dot3 lighting and (sort of) geomipmapping with triangular patches.
Good evening once again, Fabulous screenshots everyone.
can someone direct me in the next direction to go?

I basically have my terrain.
This is a wireframe screenshot
<br>http://www.lachdannan.za.net/images/terrain_wireframe.jpg<br>

I would like to know how to implement LOD or Geomipmapping?
what is the best to start off with and can someone give me a push start by looking at my code?

basically I build my terrain like so

void CTerrain::Create(char* heightmap, IDirect3DDevice9* pDevice) {    unsigned char* aHeightMap = new unsigned char[numTerrainVertices];    {        ifstream f(heightmap, ios::binary);        f.read(reinterpret_cast<char*>(aHeightMap), numTerrainVertices);    }    TERRAINVERTEX* pVertexData = 0;    pDevice->CreateVertexBuffer(sizeof(TERRAINVERTEX) * numTerrainVertices, D3DUSAGE_WRITEONLY, TERRAINVERTEX::fvf, D3DPOOL_MANAGED, &m_pTerrainVB, NULL);    m_pTerrainVB->Lock(0, 0, (void**)&pVertexData, 0);    DWORD pos = 0;    for (int y = 0; y < terrainHeight; ++y) {        pos = y * terrainWidth;        for (int x = 0; x < terrainWidth; ++x) {            pVertexData[pos].x = (float)x * cellScale;            pVertexData[pos].y = getScaledHeight(aHeightMap[pos]);            pVertexData[pos].z = (float)y * cellScale;            pVertexData[pos].u = (float)((terrainWidth - 1) - y) / (terrainWidth - 1);            pVertexData[pos].v = (float)(x) / (terrainHeight - 1);            ++pos;        }    }    m_pTerrainVB->Unlock();    delete []aHeightMap;    unsigned short* pIndexData = 0;    pDevice->CreateIndexBuffer(sizeof(unsigned short) * numTerrainPrimitives * 3, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &m_pTerrainIB, NULL);    m_pTerrainIB->Lock(0, 0, (void**)&pIndexData, 0);    for (int y = 0; y < terrainHeight - 1; ++y) {        for (int x = 0; x < terrainWidth - 1; ++x) {            *pIndexData++ = y * terrainWidth + x; //v1            *pIndexData++ = y * terrainWidth + x + 1; //v2            *pIndexData++ = (y + 1) * terrainWidth + x + 1; //v4            *pIndexData++ = y * terrainWidth + x; //v1            *pIndexData++ = (y + 1) * terrainWidth + x + 1; //v4            *pIndexData++ = (y + 1) * terrainWidth + x; //v3        }    }    m_pTerrainIB->Unlock();}



so what I do is just basic brute force terrain rendering/creation
I understand some of the concepts regarding ROAM and LOD but somewhat struggle on how to implement it.

It would be gratefull if someone can maybe send me their source code or paste it here for me to have a look at it.

Thanks for the replies in advance and all your help


---DirectXSA---
Lachdannan Corp.
www.lachdannan.za.net
Heyas All,

Here's a clicky to my terrain screenshots using an adapted version of Charles Blooms' splatting method, though it's an earlier version of my editor than I currently use, and some shots are only low res, taken while debugging (as I wanted higher framerates to debug with).

Clicky!

A sample image (sorry it's not thumb-nailed as I've only just set up my webspace) :



Cheers,

Steve AKA Mephs

[edited by - mephs on June 5, 2004 8:02:05 PM]
Cheers,SteveLiquidigital Online
Fingers_ :
Very nice terrain. The lighting is so cool, and so is the texturing. What algorithm do you use to texture the terrain? Does dot3 lighting means using a normal map?Do you have a runnable demo or something? I cant wait to try it, if possible!
i found it hard, it's hard to find, oh well whaterver nervermind.
Some free time can do wonders:

// Adaptive quadtree pseudo-codenode {    int     x1, z1, x2, z2,            last_lod;    void    *patch;};function terrain(node) {    if !inside_frustum then {        // Adaptive quadtree, remove subtrees that are invisible        if (node->c0 != NULL) delete_subtree(node);        exit;    }    if (node->type != leaf) {        if (node->c0 == NULL)            // Partitions parent and sets last_lod = undefined            set_children(node);        terrain(node->c0);        terrain(node->c1);        terrain(node->c2);        terrain(node->c3);        exit;    }    lod = calc_lod(node, viewpoint);    if (lod != node->last_lod) {        create_patch(node);        node->last_lod = lod;    }    render_patch(node);}terrain(quadtree)


Don''t take this one too seriously, I don''t have any code around plus I just woke up
Thank you for your reply coelurus,
If you have time and your have irc I would like to talk to you about ROAM / LOD algorithms.

Irc server : storm.zanet.net
Channel : #54

here is a new screenshot of my terrain without LOD/ROAM and just a nice texture with lightmap implemented
<br>http://www.lachdannan.za.net/images/terrain_engine.jpg<br>

---DirectXSA---
Lachdannan Corp.
www.lachdannan.za.net

This topic is closed to new replies.

Advertisement