Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / add LOD to object...

Author
Message
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 24th Jul 2009 10:38 Edited at: 24th Jul 2009 11:29
Im currently working on a simple terrain system, was wondering if anybody knows if the darkbasic pro commands for adding LOD to objects are available in GDK ?

I've not found them in the header's but they could be un-prototyped I guess.

The only LOD related commands Ive found so far are related to Mipmapping.

So... is it going to be a case of manually calaulating and LOD ? either by manually editting the mesh(which I dont really want to have to do real-time) or using a lower poly object(which i can generate with my terrain alg) and hiding/showing at certain distances ?

Any ideas are greatly appreciated, LOD is something i havent look at much before.

EDIT : I've noticed these commands in the GDK headers, has anybody used them before that can give me a quick idea of what they are doing before I spend too much time playing with them ?

dbReduceMesh
dbMakeLODFromMesh

Im thinking they may be able to be used in conjunction with some other commands to give my objects some basic LOD.

If it ain't broke.... DONT FIX IT !!!
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 24th Jul 2009 12:06
GOOD NEWS

I added :



to my project as a forward decleration, and it compiled, linked and ran.... and get this.. IT WORKED

I have so far added 2 levels of LOD to my terrain with it, am just experimenting with wireframe/textured.. as atm im adding the LOD objects as a wireframe mesh, but when it changes to that level of detail, its showing as wireframe, which makes it easy to see its working, but doesnt look very nice lol

If it ain't broke.... DONT FIX IT !!!
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 24th Jul 2009 13:05
Very interesting. Could you please keep us informed of any issue you encounter?

Also, here are the named parameters:


Don't know what the 'Level' parameter is for, oh well.

Another point would be how fast is to execute this command, with the objective of changing the last parameter, lod distance. If it cost many frames, I want to warn about the fact that it wouldn't work too well for different camera FOVs.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 24th Jul 2009 13:12 Edited at: 24th Jul 2009 13:14
Only issue I have so far, after sorting object origins for culling/clipping is seams lol... and they seem to be every1's problem with terrain LOD from what ive read.

Ill do some more experimenting with the way Im adding the LOD, i have an idea about reducing the mesh manually, while keeping the edges of each grid lined up with the hi-res meshes....(which is where the seams are a problem, when you have a lower res LOD object joining a higher poly one, the seams dont line up exactly)

Thanx for the proper naming of the parameters too

and the "Level" argument is for the level of detail object in the series... for example :

you have 3 LOD objects... ob1 - hi poly ... ob2 - med poly and ob3 low poly...

ob1 is the object that LOD is being applied to...

ob2 is "Level 0" distance 100
ob3 is "Level 1" distance 1000
etc etc for as many LOD levels as you add.

level 0 will be the first level of detail to show at its distance, level 1 the next and so on...

There may be more to it, but that is what I have deduced so far

If it ain't broke.... DONT FIX IT !!!
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 5th Sep 2009 09:59
@ syuan@charter.net - Hey, im not sure of your GDK forums username, so I just used the one that came to me in the email, hope tahts ok....

Anyway, here is the attachment of the LOD Terrain you emailed me about earlier, sorry again that it wouldnt go through your email, I guess 25mb is a little larger than most email's standard allowance...

As I said in the email, there are a HEAP of bugs in here and I havent gone through and fixed hardly any of them, you can see where I have removed sparky's and Tree Party and some other bits and pieces aswell before I posted it here.

I figured this was the best place to post it, as other's can also have a look and maybe learn something...

NOTE : It seems GDK 7.4 has changed it's LOD algorithms a bit, the terrain seaming that was very very apparent in GDK 7.3 and lower with dbAddLODToObject() between LOD meshes is greatly reduced, to the point that I could only notice that the normals were not right, but there was no seaming like previously(I didnt test that too much, so could just be the terrain I was using didnt show seaming much lol)

Please also note that the attachment is 25mb zipped, around 50 unpacked, most of that is the float data for the USGS terrain. All of the actual Terrain generation, USGS and heightmap loading is working fine and the LOD is being generated properly.... the main bugs that you will notice has to do with applyingthe terrain shader to larger USGS terrains, I havent managed object ID's at all, and I believe the water is being treated like terrain in some places because of it lol....

Again, i AM aware of all the little/large bugs in this, its just being stuck here as I was specifically asked by another user to post it for them

If it ain't broke.... DONT FIX IT !!!

Attachments

Login to view attachments
Potassium
15
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 5th Sep 2009 15:21 Edited at: 17th Aug 2010 21:54
...
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 5th Sep 2009 18:39
Ahh Potassium, cool I really should have checked lol, but it didnt bother me... Some of the code in that example is kind of obsfucated and not really related to LOD lol...

Like I said in the email, the GDK LOD functions are best used for objects, like trees or lamp posts etc, rather than terrain just because of the seaming and normals issues with the GDK native commands. I think it would be a little easier to roll your own LOD algorithm where terrain is concerned, that way you could have it behave exactly how you want it to...

If you are interested in that, or even just to have a look at other peoples techniques for it, search google for something like "C++ DirectX Terrain LOD Tutorial" and you should get a few links to various places(I had a look before and got a few cool looking tuts) ... I only use the Term DirectX as some of the examples I found were built with OpenGL and its a little harder to relate to GDK than directX(at least for me lol, never learnt any native openGL or GLUT or anything) not that much harder, but still, most of the relevant bits are in the terrain generation anyway, if you find a directX example, you can use the techniques to generate your own directX mesh, then use GDK functions to make it a GDK object(there is one in D3DLIB and D3DFunc if you have it to make GDK object's from DX meshes)

Good Luck

If it ain't broke.... DONT FIX IT !!!
Potassium
15
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 5th Sep 2009 18:45
I'm reading the OpenGL Official Programming Guide (5th edition). Yeah it does cover GLUT and OpenGL 2.0, and some of GLSL.

Sorry for being a bit lazy, but could you give me some links to those tutorials that you mentioned? I'd like to see it both implemented in both Direct3D and OpenGL.

There are 2 ways to develop for the N64:
1. Develop C code with PsyQ SDK and illegal Nintendo libs
2. Develop C code with legal kits, such as the Ground Zero devkit (g0dev.zip)
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 5th Sep 2009 19:04
Hey Here are those links you asked for to Terrain LOD Tuts, some are OpenGL, some are DirectX some are XNA and some are general theory... all sorts of techniques I hope they help you...

"Really Simple LOD" :
http://www.swiftless.com/tutorials/terrain/7_lod/7_lod.html

"Chunked LOD Terrain XNA Tutorial" :
http://www.ziggyware.com/news.php?readmore=818

"Continous Terrain Mesh with Quadtrees" :
http://www.gamasutra.com/features/20000228/ulrich_pfv.htm

"R-O-A-M Tutorial" :
http://www.gamasutra.com/features/20000403/turner_01.htm

"Simple Native DX9 Terrain Rendering - Brute Force method(no lod)"
http://www.two-kings.de/tutorials/terrain/terrain01.html

"Various links to Terrain LOD Implementation with Source code" :
http://www.vterrain.org/LOD/Implementations/

"GameDev.net forum discussion on Terrain" :
http://www.gamedev.net/community/forums/topic.asp?topic_id=296554

Hope some of those help, they should cover just about everything lol..

If it ain't broke.... DONT FIX IT !!!

Login to post a reply

Server time is: 2024-10-01 12:40:09
Your offset time is: 2024-10-01 12:40:09