Is there a way to render a scene frame by frame ?
The scene has no behaviors but I modify the object transforms each frame.
Mik
Is there a way to render a scene frame by frame ?
The scene has no behaviors but I modify the object transforms each frame.
Mik
I better explain the problem:
Java3D has an asynchronous design and modifications to the scene (i.e. changing the contents of the Appearance of an object) are applied to the scenegraph by asynchronously queuing update requests through a thread based message system.
While this is ok and welcome when onscreen, it makes life a bit difficult for those, like me, willing to take snapshots of an offscreen Canvas3d and still be sure that the scene is completely up to date before taking the snapshot.
What I presumably need is a mechanism that waits until the scene is up-to-date and then start the rendering, wait for the rendering, take a snapshot.
Any suggestion is welcome.
So long as you only use a single behaviour, such as elapsed frames, and make sure you do all of your modifications to the scene graph while that is being called, you can guarantee that all the changes are made at the same time. However, you will still have a problem with the multiple bugs inside J3D where updates don’t propogate through at the same time. For example, making a transform and geometry change in the same frame takes 1 frame for the geometry and 2 frames for the transform to make it to screen.
Mithrandir you’re outlining a terrible scenario.
I’ll throw one month work (and my java3d project) away if I don’t find a good solution in close time.
Is there any single way to prevent automatic scene updates and collapse them in a single synchronous method call (i.e. updateAll()) ?
why not simply wait for 2 elapsed frames as Mithrandir suggested before taking the snapshot?
If this is all offscreen, what stops you doing Canvas3D.stopRenderer() then calling Canvas3D.renderOffscreenBuffer() over and over?
Kev
From the docs
Throws:
java.lang.IllegalStateException - if this Canvas3D is in off-screen mode.
Uh Oh,
I added:
objRoot.addChild(new ColorCube(.0000001));
to my scenegraph and all my scene synchronization problems disappeared magically !
Is this a nice bug of Java3D 1.3.x ??
[quote]Uh Oh,
I added:
objRoot.addChild(new ColorCube(.0000001));
to my scenegraph and all my scene synchronization problems disappeared magically !
Is this a nice bug of Java3D 1.3.x ??
[/quote]
and universe.setJ3DThreadPriority(1); did not change anything?
[quote] and universe.setJ3DThreadPriority(1); did not change anything?
[/quote]
Yes, it helped to make gui -> scene updates 1:1
Without setJ3DThreadPriority() the rendered frame sometimes does not reflect the gui settings (i.e. rotation, scale, etc.) expecially on complex scenes.
The "objRoot.addChild(new ColorCube(.0000001)); " trick is only needed when using an offscreen canvas3d and java3d 1.3.x.
With onscreen canvas3d or with java3d 1.2.x everything works correctly.
I cannot figure how it can be possible ! Maybe is the nature of my scenegraph. I’ll try to dump it and send to the java3d team.