get polygons at point x, z

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

get polygons at point x, z

Poehli
Hi everyone,
I'm new to j3d and am trying to programm a game, where I need to run on a uneven surface.
for that purpose I added every single polygon of the worldmap to an ArrayList<Polygon>, where Polygon is a self written class which contains some important methods.
But with this setup, it's not only way too slow, but also uses tons of memory. In fact, I get a OutOfMemoryException when I load an object with about 3million polygons, which is a nogo ;).
Now I'm looking for some alternative to get the polygon from x and z coodinates of an object I created in blender. I'm sure, that this polygon is in rendering region, but how to read this region?

Hope you guys can help me here :)

Poehli
Reply | Threaded
Open this post in threaded view
|

Re: get polygons at point x, z

jmaasing
I think you will be better off using a game engine like Ardor3D or jMonkeyEngine (http://hub.jmonkeyengine.org) that has a lot of game related things built in, for example collision detection, model loading and terrain handling.
Reply | Threaded
Open this post in threaded view
|

Re: get polygons at point x, z

Poehli
Yes, but since I have no choice, but to use j3d, I will do so ;)
This is one requirement of my university for this project.
Reply | Threaded
Open this post in threaded view
|

Re: get polygons at point x, z

gouessej
Administrator
Use smaller objects then.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: get polygons at point x, z

Poehli
This post was updated on .
This is not helpful at all...
There must be a way to do so, without changing the objects...

Could you explain, how the interleaved array is actually arranged? Maybe I can predict, where the point is from that array.
I only know that 6 indices build a point, with the last 3 indices as their normals. The polygon is made of three points, so one polygon takes 18 places in the array, in my case
But how are the polygons sorted?
Reply | Threaded
Open this post in threaded view
|

Re: get polygons at point x, z

gouessej
Administrator
I thought I already indicated you how the vertices are stored in your question on StackOverflow, didn't I?
http://stackoverflow.com/questions/25714777/java3d-read-each-polygon-of-an-3d-object/25727944#25727944

and you should look at the PDF under my main reply too.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: get polygons at point x, z

Poehli
Well you did tell me what an interleaved array is, but not how the polygons are sorted.

When I said, that this array contains 6 values for one point, I meant in my case. It's using Normas as extra information

And the link from stackoverflow is very helpful as well, but still doesn't explain, how the polygons are sorted.
Reply | Threaded
Open this post in threaded view
|

Re: get polygons at point x, z

gouessej
Administrator
Maybe you should look at the source code of intersection tools for Java 3D in order to check which assumptions are done on the way polygons are sorted:
http://code.j3d.org/using/geom_intersect.html
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: get polygons at point x, z

Poehli
If I understood the code correctly - and I'm not sure I did - there is no prediction at all...

Nevertheless, I optimized my code in that manner, that it will load all objects, that ObjectFile can handle as well, that is good enough for now. The calculation of huge objects now takes about 3-5 ms, but it's allright, for it's way below the minimum framerate.