Hello~~
I have developed a first person Applet game with Java 3D and it contain 80 3d trees(.X file) ,a 128*128 size hill,7 buildings and a gun attach to view in the scene, but it seem to run slow when using transformGroup.setTransform(transform3D) running in the thread especiallly rotating the camera. So, I want to know how to improve the efficiency in such situation.
Thank~~
How complex are the shapes in question- what kind of polygon count are we talking about?
This is an Applet and it has 80 loaded objects?
The first and msot obvious suggestion is to use LOD as I can’t believe if they are all onscreen at once in an applet then msot of thema re mreo thena few pixels across.
BUT thats not the advice Im going to give you.
The advice Im going to give you is this… unelss you have run a profiler you have NO idea why your applet is slow. It may have nothing whatsoever to to do with J3D. I could tell you a story abotu a “slow” J3D app where it turned out a simple swap in the order of two operations Iw as doing made all the difference. (Calculating normals before rather then after subdividing polygons.)
Profiling is the first step in ANY applet or application tuning. Until then you are stabbing in the dark with a very small toothpick. I’d recommend reading at least the “Stratagies” section of Steve and my Java peformance tuning book. Its all online these days at http://java.sun.com/docs/books/performance .
Jeff, Do you have any specific tips for profiling Java3D applications? I used a profiler and when I included both my packages and j3d, my packages contributed only about 3% of the time. Ultimately, the solution was to simplify geometries, but it sure was not very obvious from profiling.
Mike
[quote]Jeff, Do you have any specific tips for profiling Java3D applications? I used a profiler and when I included both my packages and j3d, my packages contributed only about 3% of the time. Ultimately, the solution was to simplify geometries, but it sure was not very obvious from profiling.
Mike
[/quote]
Hmm. Profilign is always some aprt detective work. I’ve ahd no trouble profiling with my J3D based apps. I coudl generally tell from the entry point of the J3D code why it was slow. (In the xampel above, sicne msot of the tiem was being eaten by the normal generator I clearly had to do something to reduce its work-load.)
Although I’ve never had to do this, if I needed more detailed info on why a given entry poitn was paritucalrly slow I thin kI’d do two things:
(1) Bother Kevin or Paul about it. Now I realize you dotn have them just down the hall like i do BUT they both minoitor the J3D interest list so thats a great place yto post “why is this routine eating 76% of my time?” questions.
(2) As J3D is now open source, DL the source and actually profile into the J3D code itself.
As I say i havent ahd to resort to these but they’d be my resources of first resort if I did.
[quote]Jeff, Do you have any specific tips for profiling Java3D applications? I used a profiler and when I included both my packages and j3d, my packages contributed only about 3% of the time. Ultimately, the solution was to simplify geometries, but it sure was not very obvious from profiling.
Mike
[/quote]
Hmm. Profiling is always some part detective work. I’ve had no trouble profiling with my J3D based apps. I could generally tell from the entry point of the J3D code why it was slow. (In the example above, since msot of the time was being eaten by the normal generator I clearly had to do something to reduce its work-load.)
Although I’ve never had to do this, if I needed more detailed info on why a given entry poitn was paritucalrly slow I thin kI’d do two things:
(1) Bother Kevin or Paul about it. Now I realize you dotn have them just down the hall like i do BUT they both minoitor the J3D interest list so thats a great place yto post “why is this routine eating 76% of my time?” questions.
(2) As J3D is now open source, DL the source and actually profile into the J3D code itself.
As I say i havent had to resort to these but they’d be my resources of first resort if I did.
p.s
tree - about 2500 vertex
gun - about 3000 vertex
hill terrain - 64*64 vertex
buildings - 28 planes
except for trees,all render with texture
Thats nice and useless info.
What does your profiler tell you???
/me has the feeling someone isn’t listening.