Layer2D , Layer3D

Holger Grahn



Introduction

Layer3D and Layer2D are specified in MPEG-4 Version 1.

The Layer3D node is a transparent rendering rectangle region on the screen where a 3D scene is shown. The Layer3D is part of the layers hierarchy, and can be composed in a 2D environment with depth. Layer3D nodes enable the composition in a 2D space with depth of multiple scenes. This allows users, for instance to view a 3D scene from different view points in the same scene or view different 3D scenes in the same scene.

Example: bmw

User interface done with Layer2D.

Actions: navigate, click on buttons.

 

Example: layer_test.wrl

bottom left : a layer showing an inline

bottom right : same scene is shown with USE but from different viewpoint

top left : another scene in a layer

top left : right a layer referring (USE) the 3 layers from before

Actions: click on rose wall of castle to let a layer move.

 

Example: bar

main : scene with navigation

left : layer overlay with background transparent (no HUD, can be seen if moving near the bar)

top : another view of the same scene (via USE)

Actions: click on Avatar, navigate main scene

 

Example boxes

Actions: none

 

Example: tunnel_layer

In the background is the main scene, on top are another 3D scene, as well as a Layer with user interface elements.

Actions: none

Example: bar_bg

Same as bar but with textured Background node.

 


Layer 3D PROTO definition :

 

EXTERNPROTO Layer3D[
	exposedField SFVec3f bboxSize 	
	exposedField SFVec3f bboxCenter
	eventIn MFNode addChildrenLayer
	eventIn MFNode removeChildrenLayer
	exposedField MFNode childrenLayer
	exposedField SFVec2f translation
	exposedField SFInt32 depth
	exposedField SFVec2f size
	exposedField SFNode background
	exposedField SFNode fog
	exposedField SFNode navigationInfo
	exposedField SFNode viewpoint
	exposedField MFNode children
	eventIn MFNode addChildren
	eventIn MFNode removeChildren
	]
["urn:inet:bitmanagement.de:node:Layer3D","http://www.bitmanagement.de/vrml/protos/nodes.wrl#Layer3D","nodes.wrl#Layer3D"]
PROTO Layer3D[
	exposedField SFVec3f bboxSize	-1 -1 -1 	
	exposedField SFVec3f bboxCenter 0 0 0
   	eventIn MFNode addChildrenLayer
	eventIn MFNode removeChildrenLayer
	exposedField MFNode childrenLayer []
	exposedField SFVec2f translation 0 0
 	exposedField SFInt32 depth 0
 	exposedField SFVec2f size -1 -1
 	exposedField SFNode background NULL
	exposedField SFNode fog NULL
	exposedField SFNode navigationInfo NULL
	exposedField SFNode viewpoint NULL
	exposedField MFNode children []
	eventIn MFNode addChildren
	eventIn MFNode removeChildren
	]

The 2D layer rectangle of the 3D layers is specified by the translation and depth fields. The units of 2D scenes are used for the translation parameter. The size parameter is given as a floating point number which expresses a fraction of the width and height of the parent layer. In case of a layer at the root of the hierarchy, the fraction is a fraction of the screen rendering area. A size of -1 in one direction, means that the Layer2D node is not specified in size in that direction, and that the size is adjusted to the size of the parent layer, or the global rendering area dimension if the layer is on the top of the hierarchy.

The addChildren eventIn specifies a list of 3D nodes that must be added to the Layer3D's children field.

The removeChildren eventIn specifies a list of 3D nodes that must be removed from the Layer3D's children field.

The addChildrenLayer eventIn specifies a list of 3D nodes that must be added to the Layer3D's childrenLayer field.

The removeChildrenLayer eventIn specifies a list of 3D nodes that must be removed from the Layer3D's childrenLayer field.

The children field may specify any 3D children nodes that define a 3D scene. The childrenLayer field may specify 3D layer. The layering of the 3D layers is specified by the translation and depth fields.

The bboxCenter field specifies the center of the bounding box and the bboxSize field specifies the width and the height of the bounding box. It is possible to omit the bboxCenter and bboxSize fields, but if present, the corresponding box must contain all the children.

The background, fog, navigationInfo and viewpoint fields define the corresponding bindable nodes in effect for the children of Layer3D.

If background is NULL the background is transparent and the content from the parent shines through.

This definition of Layer3D is based on earlier draft revision of MPEG-4. In the current specification a Layer in MPEG-4 is translated by a parent Transform2D node, the fields translation childrenLayer and depth are no longer used.

 

Layer 2D PROTO definition :

PROTO Layer2D[
	eventIn         MFNode		addChildren
	eventIn         MFNode		removeChildren
	exposedField 	MFNode		children	    []

	exposedField	SFVec2f 	translation 0 0  
	exposedField	SFVec2f 	size		-1 -1	
	exposedField	SFNode  	background      NULL
	exposedField	SFNode   	viewport        NULL
	]

Layer2D provides a similar functionality to Layer3D. It is used for 2D scenes, where depth processing (e.g. z-Buffering, 3D transparency sorting ) is not needed. The children's coordinate space in x always is -1 to 1, in y the range is scale according to the aspect ratio of the rendering rectangle. An orthographic projection is used.

 

Implementation notes:

Layer3D navigationInfo fields are not supported. There is no means for switching the active layer in order to connect the built-in browser navigation to a certain layer.

Layers contained in a 3D scene graph are sorted according to the depth field & scene graph order, and are rendered after non-layer geometry.

If navigation is wished it can be done by the application switching the viewpoint node in Layer3D or changing fields in the current referenced viewpoint of Layer3D.

Anchor, TouchSensor activation is supported, and follows the layers hierarchy. Drag Sensors are not properly supported in Layer nodes.

There is currently no means to disable a top level headlight in children layers. A workaround is to not place lights at the top-level scene graph, turn off headLight and place Directional Lights local in the Layer3D nodes and in Subgroups.