terrain

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

terrain

Post by knightoflight »

Myladies and mylords,

Sire Niko put a first very simple terrain code to the download area of irrlicht.
I ask once again for help to tune the code to a get a really nice terrain renderer for all of us irrlicht-fans together (Or someone opens a better code, so we can throw this startcode into the trashcan or /dev/null ...)

Niko suggests that we should open a CVS-Modul in irrlicht.sf.net or a project at sourceforge. The code should be under the irrlicht-licence.
If you help, the help will be described with your name in the header, so everyone will see in future, that it was your help.

Any comment ?
Last edited by knightoflight on Mon Sep 08, 2003 2:43 pm, edited 1 time in total.
Zaelsius
Posts: 38
Joined: Sat Aug 23, 2003 12:02 pm
Location: Alicante, Spain
Contact:

Post by Zaelsius »

It crashes for me. I'm using Irrlicht 0.4 under Windows 2000 and VS.NET. Tried both drivers. If I remove the terrain lines, it works perfectly(but no terrain is showed XD).

Looking at the terrain code, it's quite simple, but well, cleanly coded. I think it would be better to return an OctreeSceneNode instead of an animatedmesh, so that only visible regions of the terrain are drawn.
hearsedriver
Posts: 81
Joined: Fri Aug 22, 2003 12:06 pm
Location: Germany
Contact:

Post by hearsedriver »

Just gave it a try, but I did not see anything more than Nikos Skybox and Water. The debug output tells me:
Direct3D8: (ERROR) :*** Exception in d:\builds\nt32_chk\multimedia\directx\dxg\d3d8\fe\d3dbase.cpp Line: 3447

Direct3D8: (ERROR) :Primitive count or vertex count is too big. Check device caps.

First-chance exception at 0x77e4d756 in terrain.exe: Microsoft C++ exception: long @ 0x0011f860.
Direct3D8: (ERROR) :DrawIndexedPrimitiveUP failed.
Cheers.
matthias gall, lead programmer at sechsta sinn - email matthias@sechsta-sinn.de
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

It helps reducing the .RAW file, to 128x128. Then adjust both

const mapsizex=256;
const mapsizez=256;

in terrain.h to 128. But for sure, this is only a temporary solution.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Hi,
How can we help with terrain engine ?
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

Hi,
to tune the code to be better, maybe we need:
- single textures for single tiles ?
- detail textures for the near ?
- noise textures or other things for deleting the
seams ?
- reflecting water ?
- error handling in the class ?
- change to octtree, like Niko wrote ?
- ...
If you have the idea how one of this or other things could be lead to a better looking and performant terrain, please write some lines of code.

For example the change to use octtree - who answers the following question:
In the 2.quake map-example is written for better performance easy to change to octtree in this way:
[code]nodeterrain = smgr->addOctTreeSceneNode(meshterrain->getMesh(0));
[/code]
But it doesnt work, are the vertices in the quake map in a special format ? But i read the quake map format and saw nothing with octtree???
10.09.2003: ok now i saw that it works, i only have to wait cause 130000 polys are much, and to reduce the FarValue of the camera.
Last edited by knightoflight on Wed Sep 10, 2003 1:48 pm, edited 1 time in total.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Ok,
I'm not a really skilled programmer, but can you comment you code please inside "::renderterrain" function ?
Thanks !
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

im not a really skilled programmer, too,
like i wrote, renderterrain is a hack from Nikos CGeometrycreator, i try:
- in the first for-loops it creates the vertices (three vertex-coordinates and the y comes from the heightmap).
- in the second for-loops it creates two indices for the faces
- in the third for-loops it calculates the normals
Last edited by knightoflight on Tue Sep 09, 2003 8:06 pm, edited 1 time in total.
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

I started playing around with it and swapped a good portion out with ROAM 2.0 algorithms that I found in "Focus on 3D Terrain Programming", but I feel like I'm duplicating the effort in some parts.

If the terrain mesh is cast as an OctTree, then does the irrlicht engine handle culling for me automagically or should I still cull for myself?
Crud, how do I do this again?
Cyber_Sneak

fstream.h?

Post by Cyber_Sneak »

hey there,

"terrain.h" used a file called "fstream.h" which is under the GNU GPL. that would mean all programs using the terrain engine must be GPLed? am i right? :?
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

to fstream.h:

My c-docu says:

> fstream
> #include <fstream.h>
> The fstream class is an iostream derivative specialized for combined disk > file input and output. Its constructors automatically create and attach a
> filebuf buffer object.
Cyber_Sneak
Posts: 14
Joined: Tue Sep 09, 2003 4:48 pm
Location: USA - All your base are belong to us

Post by Cyber_Sneak »

from fstream.h that comes with Dev-Cpp:

// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
[etc]

hm. :?:
If a packet hits a pocket on a socket on a port,
And the buffer's interupted and the interupt's not caught,
Then the socket packet pocket has an error to report.....
FleshCrawler
Posts: 108
Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:

Post by FleshCrawler »

The terrain-renderer works for me, and its nice :)

but is there a way to add collision detection? (still learning, but school makes it kinda impossible atm.)
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

- to fstream.h and sire cyber_sneak:
my fstream.h says:
...
/***
*fstream.h - definitions/declarations for filebuf and fstream classes
*
* Copyright (c) 1991-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the classes, values, macros, and functions
* used by the filebuf and fstream classes.
* [AT&T C++]
*
* [Public]
*
****/
...

but again, the code should be only a startcode and i wrote, please tell if you have ideas to get i better, so sire cyber_sneak, what c++ fileaccess-code should we use instead, please write.


- and to the question for collision-detection:
if you want to use the irrlicht-engine, we first should use octtree, then the irrlicht-collision-detection should be easier - but an other way is to use the heightmap. For example your player is at position x,z and falls from above, then you can easy look in the heightmap, at which height y he should stop and hits the ground...
Last edited by knightoflight on Wed Sep 10, 2003 1:50 pm, edited 1 time in total.
Cyber_Sneak
Posts: 14
Joined: Tue Sep 09, 2003 4:48 pm
Location: USA - All your base are belong to us

Post by Cyber_Sneak »

stupid me :oops: look what comes just after the first part:

// ......Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License.......

i should'a read the rest b4 posting. oh well.
If a packet hits a pocket on a socket on a port,
And the buffer's interupted and the interupt's not caught,
Then the socket packet pocket has an error to report.....
Post Reply