PDA

View Full Version : A few Questions..



M109uk
18-12-2004, 01:19 PM
Hi all,

I have a few questions,

Firstly, i want to use an external physics engine to deal with collision detection and other physics, i am looking at ODE and Newton, has any one tried these and if so which do you recommend, and if there are any others i should think about. My at the moment can contain anything from 10,000 triangles to 100,000,000 and more so i would like an engine that can cope with this or a way that i can update the information on the fly.

Secondly, i want to create a height map face, if that makes any sense, basicly like a bumpmap but with physical bumps instead of updating the image all the time, im trying to use a standard height map engine but its not as easy as i thought, basicly i have 2 textures, the first is the normal texture and the second is the heightmap both textures are either 128x128 or 256x256 but of course the face that i want to put it on could be either 10x10 (XY) or 10x100 (XY) so how can i stretch or repeat the height map to the scale of the face? and how can i align the texture to the whole heightmap instead of each triangle/quad?

I am aware theres an extension to do this, but my laptop does not support this extension and i want to support older cards too!

Finally, does anyone know of a fast way of loading textures in to OpenGL, at the moment i have 680 textures (Jpg, png and tga) and it takes about 3minutes to load them all :(.
Im not too worried about this in my engine, because it will only load the textures needed, but in my editors i need to load them all.

Thanx for any help and suggestions

Robert Kosek
18-12-2004, 03:21 PM
I wrote a texture loader (jpg,bmp,tga) that can handle that many images. The unit is based on Sulaco's Textures unit. You can have it for credit, let me know. It's written in delphi 6, using the "TCollection" class, for speed.

About the collision however, with that many polys I dunno. I'd recomend DelphiODE (http://www.cambrianlabs.com/Mattias/).

M109uk
18-12-2004, 11:43 PM
Hi Robert Kosek,

My texture unit can handle them, its just slow, maybe doesnt help putting it in a library, my class doesnt use TCollection or TCollectionItem, instead i just use TList, i find it a lot easier to use, because you can use pointers.
How ever i have problems with supporting jpegs with my class, it loads them fine, but when i load them they are inverted, i have written a function to rotate them but this only seems to work a the odd file and every other i get an access violation lol very strange, i dont have any other problems with my other formats :( saying that my units are never clean :s i probably have to sit down and go through it all some day..
My unit currently supports: Jpeg,tga,png,bmp,tif,rgb,rgba.

As for the pyshics engine, i was thinking that i can update the physics engine with only the polys in the view frustum, but im concerned that it would eat away memory doing it that way?!?

{MSX}
20-12-2004, 07:57 AM
Firstly, i want to use an external physics engine to deal with collision detection and other physics, i am looking at ODE and Newton, has any one tried these and if so which do you recommend, and if there are any others i should think about. My at the moment can contain anything from 10,000 triangles to 100,000,000 and more so i would like an engine that can cope with this or a way that i can update the information on the fly.


I'm using ode in my project. It runs just fine and it's not hard to set up. The only difficoult is to set up the parameters so that the simulation runs as you want. For my car game, that was quite hard :P
About poligons, 100M poly is a great number :P Do you really need them all?
Anyway, ODE has a very optimized trimesh collision detection.
If you need help, just ask.
bye!

tux
20-12-2004, 02:30 PM
i was using ode in my project, but got tired of having to tweak it all to make it work right (it kept exploding). im now using newton and everythings fine :)

that also has a trimesh collision "called tree collision"

{MSX}
20-12-2004, 02:42 PM
i was using ode in my project, but got tired of having to tweak it all to make it work right (it kept exploding). im now using newton and everythings fine :)

Can you explain better what problem did you have and how Newton solves them?
Also, does Newton have Delphi headers ? How do they work ?

tux
20-12-2004, 03:03 PM
the problem with ode was, the simulation kept "exploding" (the result of errors, causing more errors etc) but it didnt happen in c.

delphi does have a newton header, its at http://newton.delphigl.de

newton doesnt need tweaking like ode does, because it doesnt fake the physics (take shortcuts)

ive tryed your funky cars and i really like it :)

M109uk
20-12-2004, 04:42 PM
I'm using ode in my project. It runs just fine and it's not hard to set up. The only difficoult is to set up the parameters so that the simulation runs as you want. For my car game, that was quite hard
About poligons, 100M poly is a great number Do you really need them all?


100Million polys is in an extreme case, but it im planning on designing worlds with a lot more than that, say like in life you have several cities, towns etc and around them you will have rural areas then go to the the next city/town, etc im building that kinda theme in to a single world, so each world will have several islands with cities, etc. Hope that makes sense.


I looked at a few demos with newton, and a few demos caught my eye, the had an example with bullet decals in an FPS style demo, and a few more advanced ones, looking at the source code looked a bit less scary than ODE i'l admit :) And the delphi newton headers give you the option of compiling the DLL in to the exe which would be nice.
Is there any demos that show different aspects of ODE or newton, for example a demo that just shows how to to collision detection another for gravity, etc?!

tux
20-12-2004, 05:00 PM
http://www.geocities.com/delphinewton/

gravity demo there.

if you download the newton sdk then theres samples there

{MSX}
20-12-2004, 06:21 PM
100Million polys is in an extreme case, but it im planning on designing worlds with a lot more than that, say like in life you have several cities, towns etc and around them you will have rural areas then go to the the next city/town, etc im building that kinda theme in to a single world, so each world will have several islands with cities, etc. Hope that makes sense.


I see. Well in that case ODE can be optimized a lot. First, you can try to aproximate each object to a primitive (a house for a box, e tree with a cylinder, etc). I do this in Funkycars and it works good. Also, in some cases i don't want mesh collision (for example the pine geometri is too "sharp" causing bad behaviour on collision. The Cylinder solved the problem).
Another important thing is space hierarchy, which you'll surely want.
With it you can group objects into spaces, and than group spaces too, etc.
When you do collisions, ODE ask you if you're interested in the collision between two space before doing it. So if you group everything in the right way, you can handle all in a quite optimized way (for example you can check if the space of a "city" is interesting and if not discard it at all).
Probably newton too has this (if not, it will be a great miss).

Also, what i like in ODE is that it's extremely well structured, you can define new geometry, new collision routine, etc and integrate all in ode. Also, it decouples the geometry from the physics.

That's it :P Bye!