- ### "dune", what's that ?

- ### "dune" crashed, work lost ?

- ### Common tips for working with "dune"

- ### What is scenegraph, fieldvalues, routes etc. about ?

- ### The 5 windows of "dune"

- ### Navigation

- ### Changing the scenegraph

- ### Input/erase of ROUTEs

- ### Changing FieldValues

  - #### Keyboard Input

  - #### Mouse Input

  - #### Changing FieldValues in the 3D Preview window

  - #### 6D Input (new in Version 0.19beta)

  - #### 6D Local Mode Input (new in Version 0.19beta)

  - #### Linux Joystick Input (new in Version 0.20beta)

  - #### M$Windows Joystick Input (new in Version 0.22beta)

  - #### Changing FieldValues in the ChannelView Window

  - #### Color Circle (new in Version 0.19beta)

  - #### Script Editor (new in Version 0.22beta)

  - #### URL Editor (new in Version 0.22beta)

- ### Simplified Scriptbuilding (new in Version 0.22beta)

## "dune", what's that ?

dune is a graphical VRML97 editor and animationtool in development. It can read VRML97 files, display and let the user change the scenegraph, fields and routes. This can be used to make simple VRML97 animations and interactions. Dune is normally not suited to work as VRML97 3D modelling tool. In difference to most 3D modelling tools the lightning/coloring of dune is based on the VRML97 standard, therefore it can be used to postprocess their export VRML97 files.

### "dune" crashed, work lost ?

Dune is work in development and it is not as stable as it should be.
If dune crashed, is your work lost ?
No not automatically !
"dune" will try to save the VRML97 file short before crash. If this is sucessfull, dune will write under Unix/Linux something like

       Internal Crash !
       Try to save Files
      attempt to write file to /home/someone/.dune_crash_NUMBER_NUMBER.wrl
      write successfull

to standard error of the starting window and to system console (eg. to the window of the xconsole application).
Under M$Windows you get a similar Messagebox
When you restart dune and use the file menu, you should see the filename of this .dune_crash file.
Just click to it and save to another file.

### Common tips for working with "dune"

- Dune is not suited as modelling tool (yet).
  Only primitive shapes like box, sphere, cone, cylinder, text (text will not be displayed good enough yet) and ElevationGrid have easy input features.
  Other shapenodes like for example IndexedFaceSet (a shape made of multiple facets), IndexedLineSet and PointSet would require the input of a big amount of numbers, therefore this is not implemented yet.
  The remaining shapenode "nurbsPlane" is not part of the VRML97 standard. It will be part of the next VRML200x Standard.
  Currently, it is supported by the VRML97 browsers cc3d and contact.
  There is a (slow and not complete) implementation for the VRML97 Browser cosmoplayer 2.1 via a VRML PROTO. You can find more information about this here.
  When you want to work with a "IndexedFaceSet" VRML-modell instead of primitive shapes, you work better with the result of a modeller (like e.g. wings3d, aoi moonlight3D, blender, ppmodeller, ppe, ac3d, maya, catia etc.) with the matching converter/exporter (if needed) or search for a free 3D modell in the world wide web.
- To test interactions and script programming, you need File -> Preview (or you have to save the file and open it in a VRML Browser). Dune has no testmode for interactions and scripting yet.

You can find some typical VRML examples (you can load into dune) here.

### What is scenegraph, fieldvalues, routes etc. about ?

Dune is a lowlevel tool to make/change VRML97 Files. It is supposed, the user knows the basic structure of VRML97.
You can find informations about VRML97 (except in a range of books) in the official ISO specification at http://www.web3d.org/technicalinfo/specifications/vrml97/index.htm. For the use of dune, especially the node reference http://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html is important.

### The 5 windows of "dune"

Beside some toolbars with icons and messages "dune" essentially contains 5 windows. Beside the "3D Preview" window you can switch on/switch off this windows via the menu "View". Switch on/off this windows, when they match your current work status.

- Scene Tree
  This window contains the scenegraph. This shows the structure of a VRML file, the information, how the VRML nodes are arranged.
- Field View
  This window contains the fieldvalues, the numbers (or character strings) in a VRML file. Only the fields of the current selected node are shown.
- Route View
  This windows contains the ROUTEs, the ways of information different VRML nodes can send messages between them.
- Channel View
  This window is only valid for interpolator nodes. Interpolator nodes are most important for animations in VRML97.
- 3D Preview window
  This Window can not be switched off and shows a preview of the graphical output of a VRML file. In difference to the other windows, the implementation of the VRML97 standard in this window is very incomplete.
  Some nodes like "Extrusion", "PointSet", "Inline", "Background", self defined "PROTO", "EXTERNPROTO" are not shown at all and some nodes like the "Text" node under Unix should be seen as "better than nothing".
  Additional, not all fieldvalues are shown correctly. Most eye-catching is the error about the "ColorPerVertex" and "NormalPerVertex" fieldvalues in the often used "IndexedFaceSet" (Shape made of several polygons):
  Correct and false image of a IndexedFaceSet with "ColorPerVertex false" in Cosmoworlds/Cosmoplayer (left) and Dune (right)
  More correct image of a IndexedFaceSet with "ColorPerVertexflag true" in Cosmoworlds/Cosmoplayer (left) and Dune (right)
  A comparable problem is about "NormalPerVertex". "NormalPerVertex" have some influences to the accounting of light (shading).
  Of course, such a false image in the 3D Preview of a VRML object in do not mean, there is a error in the VRML file.
  If in doubt, use File->Preview to start a VRML browser.

### Navigation

To navigate in the 3D Preview Window, you have

- Shift-Mouse 1: Zoom View
- ctrl-Mouse 1: Rotate View

Additional you have from version 0.16 a SGI like navigation. Please note, that a misconfigured windowmanager can eat up this input....

- Alt-Mouse1: Rotate View
- Alt-Mouse2: Move View
- Alt-Mouse1-Mouse2: Zoom View

Instead of pressing keyboard buttons, you can also switch with the mouse in a navigation mode by pressing the icon since version 0.19beta. When a 6D inputdevice is active and the Scene icon is selected in the Scene Tree you can navigate depending on the transform icons in the VRML file.

### Changing the scenegraph

The most simple way to change the scenegraph is to add new node by clicking to the matching VRML node icon.
To identify a VRML node icon, move the mouse to it and wait. A descriptive text will occure in the status bar at the bottom of the dune window.
Dune tries either to include the new node at the point of selection in the scenegraph,
or to the root of the scenegraph ("Scene" icon).
Dune will gray out all node icons, that are impossible to add.
The following table shows the requirements for this nodes in the VRML97 standard:

- Appearance need Shape
- Material need Appearance
- ImageTexture need Appearance
- MovieTexture need Appearance
- PixelTexture need Appearance
- TextureTransform need Appearance
- Coordinate need IndexedFaceSet or IndexedLineSet or PointSet
- Color need IndexedFaceSet or IndexedLineSet or PointSet
- Normal need IndexedFaceSet
- TextureCoordinate need IndexedFaceSet
- FontStyle need Text
- AudioClip need Sound

For example a Appearence node need to be selected, to include a ImageTexture node, or a Shape node need to be selected to include a Appearence node.
All of the matching node fields in the VRML97 are of type SFNode, therefore only one node can be inserted. A icon is also grayed, if there is already a matching node. For example you can not include two ImageTexture Nodes to a Appearence node. Therefore the ImageTexture is also grayed, if a Appearence node is selected, but a ImageTexture node is already there.

Another way to change the scenegraph is to drag parts of it with the mouse.
Dune will show you with a icon of a stop sign, if the target node is not possible
If the target node is possible, dune will show the normal mousepointer.
Similar to the local copy/move in the explorer program of M$Windows2000 and similar filemanagers it is possible to change the behaviour, if the keyboard is used when the mouse is still dragged:

- Move:
  no key pressed or Shift key pressed (icon do not change)
- Copy:
  Crtl key pressed (icon add "+" picture)
- DEF/USE:
  Crtl key and Shift key pressed together (icon add "arrow" picture)

### Input/erase of ROUTEs

ROUTEs are made in dune by finding the right icon in the RouteView Window (if you click to the icons, the matching icons in the scene tree windows are selected) and click to the boxes of the matching events. The name of the matching event is shown, and you can draw a line to the next icon/event.
As required by the VRML standard, only events with the same type (same color of boxes) can be connected.
To erase ROUTEs, simply cut the line.

### Changing fieldvalues

There is more than one way to change fieldvalues:

- Keyboard input
  By clicking with the mouse to the matching value and releasing the button. A text input window will open to input values from the keyboard.
- Mouse input
  By clicking with the mouse to the matching value and not releasing the button, but moving the mousepointer to left or right. This will decrease or increase the value.
  Changing fieldvalues are not implemented completely yet for "MF fields" (multiple Fields). "MF fields" are those, which open via a "+" sign.
- Changing FieldValues in the 3D Preview window
  Changing in the 3D Preview window is also a chainging of the fieldvalues. Mainly transform nodes are changed.
  During interactive work with the mouse in the 3D Preview window, the icons select between a
  - translation
  - rotation
  - scale
  - changing center (new in version 0.19beta)
  Please note, you can not use this tools, when there is no transform node in the branch of the scenegraph.
  Beside the Transformnode, other fieldvalues can be changed in the 3D Preview window. This is about moving small white boxes, like in ElevationGrid, PointLight, Box or the VRML200x Nurbsurface Node.
- 6D Input (new in version 0.19beta)
  Since version 0.19beta Dune supports 6D inputdevices (6D is about the 6 degrees of freedom) under Unix/Linux.
  is pressed, you can move a Transform node (and the containing objects) in all 6 degrees of freedom. The icon limits the movement to translations, the icon limits to rotations.
  The classic 6D inputdevice is the spaceball, a sort of joystick which allows only small excursions, but in all directions, including rotations.
  If you press the top of the spaceball for example, the object moves down. When you twist the spaceball, the object will follow this movement.
  The configuration of 6D inputdevices (still) works exclusively via commandlineparameters. Beside the type of the 6D inputdevices a scale of the inputvalues is needed for example:

         dune -xinput spaceball -allxyz=20,200 -allrot=40,400

  Beside the support via the Xinput protocol, also Linux joystick and libsball are supported. For details to the commandlineparameters see the man page.
  Another 6D inputdevice are the dials (e.g. available under SGI IRIX). Per default, the inputaxes are awkward placed.
  Via Commandlineparameters

         dune -xinput dialbox-1 -x=0 -y=2 -z=4 -xrot=1 -yrot=3 -zrot=5 -all=100,100,wheel

  you can exchange the axes.
- 6D Local Mode Input: Do you know RC planes ? (new in version 0.19beta)
  When the 6Dlocal icon is pressed, you can steer via the local axes of a transform node.
  For example, if you move a spaceball into z-direction ("into the screen") the transform node (and the containing objects) move to the direction of it's local z axis, it follows the blue z-arrow. For example, if you move a spaceball into y-direction ("up") the transform node (and the containing objects) move to the direction of it's local y axis, it follows the green y-arrow.
  This is usefull, when object and transformnode are similar arranged. Normally the object is not in the direction of the arrows of it's transform node.
  Therefore the transform node should be put into another and the transform node of the object should be rotated accordingly.
  When you use this type of steering, you will see a effect, which is not surprising for users of RC planes: If the object is moving "toward you", a roll to the left of the spaceball leads to a roll to the right of the object.
  A similar transformnode is the rocket mode. In rocket mode, translations are only in the local z-direction allowed. This is useful, if you want to steer a object on a path while allowing all types of rotation.
  A other similar transformmode is the hover mode. In hover mode, rotations are allowed only around the local y-axis. This is usefull, if you want to steer a object in-plane.
  Other transformmodes, that work in a local mode (changes in direction of the local axes) are the scale and changing center modes.
- Linux joystick Input:
  Unfortunatly, 6D inputdevices are not very widespread. So white_dune under Linux has support for joysticks.
  There are a lot of different devices (including the spaceball), that can be used under Linux as joystick. You have to differ between 6D (e.g. Labtec Spaceball), 4D (e.g. gamepads with 2 thumbsticks), 3D (z.B. joystick with a twisting stick (e.g. Micro$oft Sidewinder Pro)) and "normal" 2D joysticks.
  - 6D joysticks (e.g. Labtec Spaceball) are used like all other 6D inputdevices.
  - 4D joysticks (e.g. gamepads with 2 thumbsticks) do not allow 6D and 6D Local mode. Beside translation , rotation , scaling and changing of the center they support the hover mode and the rocket mode.
    Depending from the mode, rotation and translation will be assigned to the appropriate axes.
  - When using 3D joysticks (e.g. joystick with a twisting stick) things are more complicated. In the default configuration, a input via the 3. axis (a twist of the stick) cause a movement assigned to the z-axis.
  - When using a 2D joystick, there are not enough axes to make 3D input data. Therefore you have to switch between the interpretation of the 2. axis as z-direction (near/far mode) and as y-direction (up/down mode) via the icons.
    On rotations the near/far mode is interpreted as rotation around the y-axis, the up/down (oben-unten) mode is interpreted as a rotation around the z-axis.
  - The rocket mode need 4 axes in a sense. To make it available with a 3D joystick, the rotationinformation of the near/far Mode and up/down mode is used here.
    Beim 2D Joystick steht der The rocket mode is not available for 2D joysticks.
  Sometimes, a joystick axis looks not very useful (e.g. the extra controler of the Micro$oft Sidewinder Pro).
  Therefore, the number of axes can be limited. To use e.g. the Micro$oft Sidewinder Pro as 3 axis joystick, you can use the -axis option in the commandline.

         dune -joystick /dev/input/js0 -axes=3

  Gamepads are often overcrowded with less useful axes. For example the Logitech Wingman Cordless Gamepad report 9 axes when testing with the jstest programm. To use the 6 good axes (2 thumbsticks and the cross-hairs), you need to change the assignment of axes in the commandline.

         dune -joystick /dev/input/js0 -y=4 -z=-1 -xrot=6 -yrot=3 -zrot=5

  You have to interpret the option "-z=-1" in this way: the z-axes will be assigned to axis number 1 (this is the 2. axes, counting begins with 0), but the inputdirection is reverted.
- M$Windows joystick Input:
  The support of a M$Windows joystick is very similar to a Linux joystick.
  The special qualities of joystick drivers delivered with M$Windows should not make you wonder, if e.g. the 2. thumbstick of a gamepad do not deliver values or a joystick axis will be reported, but can deliver only errors.
  Beside this, the wisdom of the authors of the M$Windows joystick API leaded to the fact, a error of a axis must be interpreted as full turn (a similar problem leaded to the explosion of the first Ariane 5 rocket....).
  Therefore you should begin to test under M$Windows with only 2 axes. For the first M$Windows joystick (number 0) the commandline may look like:

         white_dune.exe -joystick 0 -axes=2 -none=2 -allxyz=20,,,0.000001 -allrot=0.2,,,0.0000001

- Changing FieldValues in the ChannelView Window
  The ChannelView Window is used to show or change interpolator nodes. In a interpolator node, input values between 0 and 1 are assigned to a range of output values.
  Interpolators are used in VRML for simple animations in the form

         ROUTE TimeSensorDEFNAME.fraction_changed TO ???InterpolatorDEFNAME.set_fraction
         ROUTE ???InterpolatorDEFNAME.value_changed TO ???DEFNAME.set_???

  The output "fraction_changed" of a TimeSensor node (deliver values between 0 and 1) ist routed into the "set_fraction" Input of a interpolator node. The interpolator node select a matching intermediate value between the output values. The result can be routed into a another VRML node, this leads to a animation without jerk.
  In the following example:
  the output of a PositionInterpolators with the input values 0, 0.3, 1 and the output values x=1/y=0/z=3, x=1/y=2/z=3, x=3/y=3/z=0 is routed to the set_translation Input for a transform node. For example, the transform node (and the containing object) will move in the timecycle from 0 to 0.3 from y=0 to y=2 (to the top).
  Some of the VRML97 interpolators are not supported (yet), they are hard to input, to much data.
  - Easy usable (cause of the Channel View) are:
    - ColorInterpolator:
      Interpolate between Colors.
      Route targets for colors you will find at Shape->Appearance->Material
    - PositionInterpolator:
      Interpolate between Positions.
      Route target can be Transform.set_translation for example.
    - OrientationInterpolator:
      Interpolate between rotations.
      Route target can be Transform.set_rotation for example.
    - ScalarInterpolator:
      Interpolate between single (floating point) numbers.
      Single numbers are possible EventIn's of multiple VRML Nodes.
      There are multiple possibilities of usage.
  - The following interpolators are not supported (yet), cause they require too much data to input:
    - CoordinateInterpolator:
      Interpolate between points in a IndexFaceSet.
      Animations, which use the CoordinateInterpolator are called "morphing".
    - NormalInterpolator:
      Interpolate between the Normales of a IndexFaceSet.

Some simple interpolator animation can be created in dune via changes in the 3D Preview window. PositionInterpolator/Transform.set_translation and OrientationInterpolator/Transform.set_rotation based animations can also created with the recording of 6D inputdevices.
If you want to work with the tools like a VCR recorder (record and playback animations) the following must be true:

- The ROUTEs must have the form

         ROUTE TimeSensor.fraction_changed TO ???Interpolator.set_fraction
         ROUTE ???Interpolator.value_changed TO ???.set_???

- In the Timesensor-Knoten the fieldvalue "loop" must be "TRUE". (the Animation will start again and again).
- The fieldvalue "starttime" of the Timesensor must be greater or equal to the fieldvalue "stoptime" of the Timesensor-Knoten.

When only the recordbutton is pressed , you have to change the timecursor first and then input a value (via keyboard, mouse or 6D inputdevice).
When the recordbutton is pressed together with the playbutton , the change of the values (via mouseinput or 6D inputdevice) is recorded continuesly.
The recording of the mouseinput require a calm hand. It is not uncommon to want to delete some of the recorded values.
You need to select a time range by clicking and dragging the mouse in the channelview window and then use either the edit -> delete menupoint or the delete icon.
The matching values will be deleted.
- ColorCircle (new in Version 0.19beta)
  There is a special inputwindow for colors, it takes place of the fieldView Window. To get it, a colorfield must be selected in the fieldView Window and the Colorcircle Icon must be pressed.
  With a mouseclick, you can select a color in the color circle and in the bar beside it, you can select a darker variant.
  Currently, when not using a true/directcolor display on Unix/Linux, the display of the color circle is slow....
  When the "OK" button is pressed, the normal fieldView window returns.
- Script Editor (new in Version 0.22beta)
  There are two ways to start the scripteditor:
  - To create a new scriptnode:
    Via the "Script" icon (menupoint Create -> Programming -> Script),
  - To change a existing scriptnode.
    If a script node is selected, via the "Object Edit" icon (menupoint Action -> Object edit),
  The scripteditor dialog
  allows it, to add new fields/events to the scriptnode (add), to change them (change) or to delete them (delete).
  Press "OK" to finish the work on the script node.
- URL Editor (new in Version 0.22beta)
  The "url"-field (it can contain the ECMAscript (javascript) code of a scriptnode) can be changed in a texteditor.
  Via the menupoint options -> Texteditor Settings it is possible to select the texteditor.
  When the "url"-field is empty, a scheme of a ECMAscripts will be created.
  To start the textedit, select a Script Node and use the "URL Edit" icon (menupoint Action -> Url edit).

### Simplified scriptbuilding (new in Version 0.22beta)

Before you can use the scripteditor dialog, you need plan what are the datatypes and eventIn/eventOut informations of the nodes you want to connect. To do this, you need to read the node description of the VRML standard (e.g. you can use the menupoint Help -> name of currently selected Node or use a advanced book).
For fast experimenting, you may find it more convenient to use a simplified scriptbuilding method.
Create a new "empty" scriptnode with the "Script" icon (or the menupoint Create -> Programming -> Script).
Following the "get out of the way!" philosophy of the orginal dune project, simply press "OK" on the scripteditor dialog (see above).
Now you can use the RouteView window for further work.
Scriptnodes have a special "connect anything" eventOut. If you click and drag this with the mouse, a white route will be drawn.
Keep the mousebutton pressed while routing and you see (like "normal" routing), you can connect this route to eventIns of other nodes,
but (unlike "normal" routing) the color of the route (marking the datatype) can change with the probed eventIn.
When you release the mousebutton, the route will be established.
In a similar way, you can use the special "connect anything" eventIn of the scriptnode
and connect it to a eventOut of a other node.
Now you need to edit the "url" field of the script node. Beside using urledit you can also select the script node in the SceneTree window, the "url" field in the FieldView.
and press the "Object Edit" icon (or use the menupoint Action -> Object edit).
Now "dune" will try to start a external editor - UNIX die-hards use "xterm -e vi", this is the default under Linux/UNIX ("xedit" for MacOSX, "edit" for M$Windows) if $WINEDITOR was not set at first run. You can change the editor with the Options -> Texteditor Settings ... menupoint.
In the editor window, you will see a schema of the needed javascript code.
Use Options -> ECMAscript settings to control, if you want extended comments in the schema.
Use the editor to complete the javascript code and save/quit the editor - in case of the vi editor use the keystrokes :wq