Mixing 2D and 3D

August Lammersdorf, InteractiveMesh sdn at interactivemesh.com
Sun Jul 28 10:14:53 PDT 2013


 "Simultaneous viewing based on Node.snapshot - proof of concept"

 Chien,

 certainly you remember Java 3D's multiple view concept based on 
 ViewSpecificGroup (not easy to apply but powerful). It allows to assign 
 the entire graph or sub-graphs or even single nodes to one or several 
 cameras/canvases simultaneously. Animations (Behavior) are executed only 
 once. Then the engine renders individually the assigned/extracted 
 sub-scene for each camera/canvas.

 The current JavaFX Scene/SubScene-design leads to an exclusive 
 one-to-one-relationship of a 2D/3D-scene-graph and a camera.

 Simultaneous views require at least individual lighting (headlight) per 
 camera to avoid 'overexposure' or unwanted shading effects.

 Thanks for your 'Node.snapshot' implementation hint and code example.

 So, I tried to apply this approach to FXTuxCube and added a second 
 camera. It works to some extend:

 1st camera
  - some flicker for higher cube sizes during mouse navigation
 
 2nd camera
  - one frame delayed
  - only default lighting/headlight, no individual lighting (?)
  - AmbientLight doesn't seem to be applied
  - no individual extraction of sub-graphs
  - currently permanent running AnimationTimer for repainting

 The first result - FXTuxCubeSV - can be launched and downloaded here:
 www.interactivemesh.org/models/jfx3dtuxcube.html#simview

 August

 Am Freitag, den 26.07.2013, 17:43 +0200 schrieb Chien Yang 
 <chien.yang at oracle.com>:
> Hi August,
>
>    John Yoon, Richard and I have a private discussion on the
> possibility of avoiding "cloning" for your use case. We wonder do you
> ever need to interact with the 3D scene via the various sub views? Or
> these sub views are purely for viewing the 3d scene with different
> cameras? If  this is your use case scenario, have you thought of 
> using
> Node.snapshot()?
>
>     public WritableImage snapshot(SnapshotParameters params,
> WritableImage image) {
>
> Where you can call snapshot on the node with a specified camera (in
> the snapshot params).  It will then render the node from that 
> camera's
> viewpoint and put the result in an WritableImage. You can then add it
> into the scenegraph using an ImageView.  I have attached a very 
> simple
> example on how snapshot can be used with an ancillary camera. Please
> let us know of your progress in this work. We would hope to learn 
> from
> this work so that we can evaluate it to see if there are any
> performance / semantic problems. You will likely ended up with a one
> frame behind rendering in those sub views, but do let us know for 
> your
> finding.
>
> Thanks,
> - Chien
>



More information about the openjfx-dev mailing list