Valid HTML 4.01!

Valid CSS!
www.oisyn.nl news whois projects forum new user

questa at 1-03-07 15:23
AAADDDS! * click

Woudloper at 24-01-07 11:58
Zag de ads! Heb er nog op één geklikt omdat er iets interessants tussenstond :)

.oisyn at 23-01-07 15:46
Aangezien ik zowaar visitors heb, even wat ads toegevoegd :+

Woudloper at 8-01-07 8:02
Met de UBB Parser aan het stoeien

Woudloper at 5-01-07 10:22
Nieuwe reactie toegevoegd bij het artikel over UBB Parser

Spockz at 31-12-06 12:42
Ja, dit werkt nog hoor. :)

.oisyn at 28-12-06 16:37
Werkt dit nog?

questa at 21-11-05 15:15
*gaap

Grubolsch at 9-06-05 17:12
Bedankt om dit alles open source te maken, ik vermeld je zeker op mijn website! Echt knap werk!

Grubolsch at 9-06-05 17:12
.oisyn, ik moet zeggen dat ik je parser enorm knap vind, en ook je syntacs highlighter!

questa at 8-02-05 13:52
Jammer dat het nooit af komt, maar vertel is meer over je nieuwe baan!!!

.oisyn at 17-05-04 15:28
Dat laatste, weinig tijd enzo. Eerlijk gezegd denk ik niet dat het ooit nog geimplementeerd wordt :/

koli-man at 11-05-04 22:38
Is er eigenlijk nog Orbb nieuws of staat project een beetje stil?

.oisyn at 2-04-04 18:38
/me doet maar weer eens een update :P

eamelink at 1-02-04 11:27
*kick* ;)

questa at 8-12-03 22:16
Kom op, pronken met die zooi!!!

curry684 at 4-12-03 14:04
En waar is de sourcecode van Orbb? Doe eens treehugging opensource hippie uithangen!

questa at 1-12-03 12:49
Damz.. dan maar even hopen dat de compiler snel aan ze 1.0 versie komt :) dan is Questa weer blij!

coubertin119 at 12-11-03 18:32
Pff, ik ben gewoon ongeduldig ;)

.oisyn at 12-11-03 18:29
Wat boeit dat? Je hebt er toch niets aan zolang er geen compiler is ;)

Active articles#

Kol Q l8or 2 beta 4
Code syntax highlighter (php module) 21
UBB Parser (PHP code) 9
Compile-time sqrt in C++ 3
Experiment #1 2
More dynamics :) 3
Interfacing Orbb with C++ 1
Site migrated 0
Integer division using binary long division method 0
Nieuwe forum online 0
Not logged in

Projects / 3D Landscape experiments / Experiment #1


Experiment #1
Tue 21 Oct 2003 4:02 by .oisyn

I've been experimenting with my landscape engine. Well, not much of an "engine" right now, but it does some adaptive tesselation.


(click for a larger version)

The scene on the left consists of 65k polygons, but that's on full LOD. The image on the right shows the same terrain with a lower LOD. For LODing I use a geomipmapping technique where each group of 4 quads (8 triangles, 9 vertices) are converted to a single quad (2 triangles, 4 vertices) recursively. The amount of subdivision is determined by the difference in height of the specific area, and the amount of pixels that correspond with the height when the terrain is rendered. So terrain near the viewer is rendered at full detail, while distant parts of the terrain are rendered with much less polygons.

The height of the terrain is needed in this calculation to keep the terrain's natural shape. If you just base the LODing on the distance to the viewer, you get popping artifacts from mountain peaks, for example, because that information can be lost at lower LOD levels.

As the LOD tree is implemented as a quadtree, it can easily be used for visible surface determination (which I have not implemented yet).

For terrain generation I used a regular fractalterrain algorithm where you recursively devide the working area by 4 (starting with the full terrain), and then interpolate between the corners of the working area and add some random value.
It basically looks like this:

c++:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#define INDEX(x,y,s)    (((y) % (s)) * (s) + ((x) % (s)))
void generate_heightmap (std::vector<float> & mapint sizeint xint yint work)
{
    if (work < 2)
        return;

    int hwork = work/2;

    float h = map[INDEX (xysize)] + map[INDEX (x + workysize)] +
        map[INDEX (xy + worksize)] + map[INDEX (x + worky + worksize)];
    h *= 0.25f;
    h += (frand (-11) * work) / size;
    map[INDEX (x + hworky + hworksize)] = h;

    if (map[INDEX (x + hworkysize)] == -1)
    {
        h = (map[INDEX (xysize)] + map[INDEX (x + workysize)]) * 0.5f;
        h += (frand (-11) * work) / size;
        map[INDEX (x + hworkysize)] = h;
    }

    if (map[INDEX (x + hworky + worksize)] == -1)
    {
        h = (map[INDEX (xy + worksize)] + map[INDEX (x + worky + worksize)]) * 0.5f;
        h += (frand (-11) * work) / size;
        map[INDEX (x + hworky + worksize)] = h;
    }

    if (map[INDEX (xy + hworksize)] == -1)
    {
        h = (map[INDEX (xysize)] + map[INDEX (xy + worksize)]) * 0.5f;
        h += (frand (-11) * work) / size;
        map[INDEX (xy + hworksize)] = h;
    }

    if (map[INDEX (x + worky + hworksize)] == -1)
    {
        h = (map[INDEX (x + workysize)] + map[INDEX (x + worky + worksize)]) * 0.5f;
        h += (frand (-11) * work) / size;
        map[INDEX (x + worky + hworksize)] = h;
    }

    generate_heightmap (mapsizexyhwork);
    generate_heightmap (mapsizex + hworkyhwork);
    generate_heightmap (mapsizexy + hworkhwork);
    generate_heightmap (mapsizex + hworky + hworkhwork);
}
#undef INDEX


(sorry, I don't do comments ^_^)
frand (min, max) is a function that returns a random floating point value in the range min <= x < max

The landscape uses 4 textures: dirt, grass, moss and rock, and it interpolates between based on the height of the vertex. It also takes steepness into account, which produces more rocky surfaces for steeper mountains.

I also want to generate a normal map and a shadow map (using the alpha channel of the normal map) so that lighting calculations are looking the same at lower LODs, but that's something for tomorrow (as well as a scenegraph framework), as it's already 4:00 am and I desperately need to get some sleep

2 comments - 1 page
Post comment


Comments


Tue 28 Oct 2003 14:03 by coubertin119

Hijs fantastisch oisyn .
Mon 1 Dec 2003 12:53 by questa

Er is hier best wel even over te zeggen dat ie best wel dat je zegt van goed in elkaar zit.
Keep Going and get some Sleep


Post comment


You must be logged in to post a comment