How to : build a P3D show.

Building Shows

This page is a brief summary of how to build a Present3D presentation incorporating many different files and formats.

 

The Header and Presentation Set Up

A Present3D presentation file is written in XML, which like HTML, uses opening and closing tags between which you place the variable information. You must always ensure that your tags are completed and that there is a space between option in the opening tag or your xml will not parse correctly.

<?xml version="1.0" encoding="UTF-8"?>

<!--

Document   : fileName.xml

Created on : date

Author     : demonstration

Description : demonstration

-->

<presentation>

<duration>1.0</duration>

<name>example1</name>

<bgcolor>BLACK</bgcolor>

<textcolor>WHITE</textcolor>

</presentation>

 

Lets break this down and out the usage of each of the components:

<presentation> is opening tag for the presentation.

<duration>1.0</duration> sets the duration of the presentation for when the show is used in auto-run mode.

<name>example1</name> sets the name of the presentation.

<bgcolor>BLACK</bgcolor> sets the background colour for the presentation, this can be changed by using WHITE or by using a RGBA value for the color you wish to use. ie

<bgcolour> 0.1 0.1 0.7 1.0 </bgcolour> for light blue.

<textcolor>WHITE</textcolor> sets the text colour for the presentation, this can be changed by using BLACK or by using a RGBA value for the color you wish to use. ie

<textcolor> 0.1 0.1 0.7 1.0 </textcolor> for light blue.

</presentation> is the closing tag for the presentation, this should be placed at the end of the presentation xml file.

 

The Holding Slide

These are used as a loading slide for the presentation.

<holding_slide>

<duration></duration>

<background></background>

<title></title>

<layer>

<image position="0.5 0.5 0.25" scale="0.55">images/image.png</image>

</layer>

</holding_slide>

We will again Break this down into its component parts:

<duration></duration> A holding slide has no specific duration as it will stay on screen as long as the presentation is loading, therefore the duration should be left blank.

<background></background> Leaving this blank, the slide will assume the background color set for the presentation.

<title></title> This will add a title text to the slide. This uses osgText library from the OpenSceneGraph. This can be left and a image or movie used instead see later.

<layer> This is the opening tag for the layer onto which your content is entered. See layer section, For a full description of the layer function.

<image position="0.5 0.5 0.25" scale="0.55">images/image.png</image> This links the required file for the slide, an image is best, position sets the position on screen and scale will scale the image to the required size, for a full description of positioning and scaling see later section.

</layer> This is the closing tag for the layer.

</holding_slide> This is the closing tag for the Holding slide.

 

Known issues:

Present3D supports both presentation files with the .p3d and .xml extensions. However the holding slide is only supported when the .xml extension is used.

 

The Slide

This is where all the cool stuff happens, this behaves much like a Slide in PowerPoint or any other presentation tool, you can group a number of different files and file types together to get your desired effect.

 

<slide>

<background></background>

<title></title>

<duration>30</duration>

<key>3</key>

<layer>

<image  position="0.3 0.9 0.2" fade="0 0 1 1 4 1 6 0" scale="0.5">titles/movie.mov</image>

<model coordinate_frame="slide" scale="0.5" >model/model.osg</model>

</layer>

</slide>

 

Break the slide down:

<slide> is the opening tag for the slide.

<background></background> as in the holding slide, the background has been left blank as this slide is using the background colour set for the presentation. This can however be changed by using BLACK, WHITE, or an RGBA value

<title></title> the title function behaves the same as in holding slide.

<duration>30</duration> this sets the duration in seconds the slide will stay on screen for during an auto-run show.

<key></key> This function allows a simulated key press to be implemented into a slide. Any of the Present3D key commands can be used. When using the moveable lighting key command, x and y coordinates can also be used: <key x=0.5 y=0.4>k</key>.

</slide> is the closing tag for the slide.

Known issues:

When using the <key>c</key> to hide this cursor, will not take effect when used with another <key></key> tag.

 

Layers and Object types

Layers allow a slide to built up by introducing objects into the slide at a key press. Within each layer there can be as many different objects as required including, models, images, stereo images, movies and stereo movies.

 

<slide>

<background></background>

<title></title>

<duration>30</duration>

<layer>

<duration>15</duration>

<bullet>text</bullet>

<model coordinate_frame="slide">model/model.osg</model>

<image path="slider.path" fade="12 0 14 1 18 1 20 0" scale="0.35">image.jpg</image>

<image path="slider.path" fade="12 0 14 1 18 1 20 0" scale="0.35">image.mov</image>

<!-- stereo  image -->

<stereo_pair scale_x="1" scale_y="1"  fade="18 0 20 1">

<image_left>stereographs/image_l.jpg</image_left>

<image_right>stereographs/image_r.jpg</image_right>

</stereo_pair>

<!-- side by side stereo image or movie -->

<stereo_pair fade="0 0.999" position="0.5 0.5 0" rotate="0.01 1 0 0"  scale="1">

<image_left region="0.0 0.0 0.5 1.0" >stereographs/movie.mov</image_left>

<image_right region="0.5 0.0 1.0 1.0" >stereographs/movie.mov</image_right>

</stereo_pair>

</layer>

<layer>

<model coordinate_frame="slide" scale="0.5" >model/model.osg</model>

<image path="slider.path" fade="12 0 14 1 18 1 20 0" scale="0.35">image.jpg</image>

<image path="slider.path" fade="12 0 14 1 18 1 20 0" scale="0.35">image.mov</image>

</layer>

<clean_layer>

<model coordinate_frame="slide" scale="0.5" >model/model.osg</model>

<image path="slider.path" fade="12 0 14 1 18 1 20 0" scale="0.35">image.jpg</image>

<image path="slider.path" fade="12 0 14 1 18 1 20 0" scale="0.35">image.mov</image>

</clean_layer>

</slide>

 

Breaking the layer down we get:

<layer> and </layer> are the respectively the opening and closing tags for the layer. Each slide can have as many layers as the user requires.

<duration>15</duration> This functions allows multiple layers to used when using an auto-run presentation. This set the time in second until this layer will appear on screen.

Each layer can have several different objects types incorporated into them.

<bullet>text</bullet> this function is used to add standard bullet points into a layer. This text can be positioned using the usual function or will be auto positioned it no position coordinates are given.

<image>images/image.jpg</image> this function is used to display an image or movie in a layer, all that is required is a correct path to the file. On an image or movie, paths, scaling, rotation, positioning and fades can all be applied, further details are in the Effects section.

Stereo Images and movies can also be incorporated by using the <stereo_pair> and </stereo_pair> opening and closing tags as shown above. Any scaling, positioning or other effects are declared in the opening tag for the stereo pair, so that the effects are applied to both sources equally. Between these opening closing tags, the <image_left></image_left> and <image_right></image_right> functions are used to set the paths to the left and right eye image or movie. Slide by stereo images and movies can also by using the region="" function in the opening tag of the left and right eye image as shown above.Note: When using stereo movies always use side by side format.

<model coordinate_frame="slide">model/model.osg</model> allows a model to be incorporated into a layer. The coordinate_frame, in the model opening tag, allows a model coordinates to change depending on the start position. There is two options for this, "slide" or "model", with the the slide coordinate system the model will be relative to the slide, "model" the coordinate system will be relative to the model. The model system is useful when using large scale walkthrough models as start positions and paths are relative to the actual model.

A full list of supported file formats can be found here.

<clean_layer> and </clean_layer> are the respective open and close tags for the clean layer function. Clean layers allow a new layer in the slide in which only the the objects linked in the clean layer are displayed in the new layer, unlike the layer function where all the objects on the previous layers are still displayed. The objects linked within a clean layer behave the same as they do with in a normal layer, however rotations and paths on objects started in a previous layer will not be reset on a new clean layer, they will continue normally.

 

Known bugs and issues:

There are several threading issue with movies introduced in clean layer. All movies must be applied to every clean layer or this movie will not be closed when the slide is changed. These movies can however have a fade of fade="0 0" applied to them in the layer which the movie is not to be seen. Also, the looping function can not be used on a clean layer, as the movie will not exit properly and will continue to play until the presentation is exited.

mages or movies with alpha channels, must have a fade of between fade="0 0.1" and fade="0 0.999" applied to then to allow the alpha channels to be recognized.

 

Effects

On the any of the objects that are incorporated into a show can have effects such as start position, scale, fade, rotation.

 

<model coordinate_frame="slide" scale="250" position="0.5 0.5 0" fade="0 0 3 1" rotate="60 1 0 0">model.osg</model>

<model position="0 -26078137 0" coordinate_frame="model" rotation="1 0 0 0.2">model.ive</model>

<image position="0.5 0.5 0" fade="0 0 1 1" scale="1" looping="ON"  >movie.mov</image>

 

Effects and their usage:

scale="0.5" The scale effect, scales an media relative to their native size. This is a multiple of its native size, i.e 0.5 is 50% of is native size where as 250 is 250 times larger than its native size. The functions scale_x="0.5" and scale_y="0.3" can also be used to scale differently in the x and y axis.

position="x y z" This sets the position at the which the objects is loaded into the slide. The position is from the centre of the media, this is the same for all types. The x y z, values are relative to the bottom left hand corner of the screen, i.e at position="0 0 0" the centre of the media will line up the the bottom left hand corner and at position="0.5 0.5 0" will be at the centre of the slide. These value vary between -1 and 1. The z value is for setting how far out of or into the screen media will be positioned in stereo or when layering images or models.

rotate="º/s x y z" This allows an object to be rotated on the screen. The variables are, "º/s x y z". The first term, is number of degrees of rotation, the next three terms are defining in which axis this rotation is applied (0 being not applied, 1 being applied). The rotation is applied around the axis, i.e. a rotate="60 0 0 1" will cause the object to rotated 60 degrees from left to right on the screen. Multiple rotates can also be used so positioning in multiple axis is easier, i.e rotate1="60 1 0 0" rotate2="75 0 1 0" rotate3="25 0 0 1" , will rotate the media 60º in x, 75º in y and 25º in z.

rotation="º/s x y z" Rotation allows an object to be spin on screen. The variables are, "º/s x y z". The first term being number of degrees rotated per second, the next three are in which axes the rotational motion is applied (0 being not applied, 1 being applied). Rotation is around the centre of the respective axis, i.e a rotationrotation="60 0 0 1" in the z axis will cause a rotational motion from left to right on the screen. Multiple rotations can also be applied to an object usingrotation1,rotation2, and rotation3

looping="ON" This effect allows a movie or animation path to be looped within a slide. This can be either "ON" or "OFF".

fade="t % t %" This allows media to be faded onto and off of the slide. The variables are, "t % t %", where t is time in seconds from the time the layer is loaded, % is a value between 0 and 1, being 0% visible to 100% visible respectively. i.e fade="0 0 3 1" at the moment the layer loads, time 0 the media is not visible and at 3 seconds the media will be completely visible. This is a gradual transition between 0 and 3 seconds. There is no limit as how many of these time and visibility pairs can be added to each media item.

 

Text & Fonts

Text can be used in a slide both as body text using the <paragraph> tag and as bulleted text using the <bullet> tag. Truetype fonts can be used and charatcter size  and position can be set, but if not given defaults will be used.

<paragraph font="myfont.ttf" character_size="0.3" position="0.1 0.5 0.08"> My Text </paragraph>

<bullet font="myfont.ttf" character_size="0.3" position="0.1 0.5 0.08"> My Text </bullet>

Fonts are, by default, in a fonts folder within the OpenSceneGraph-Data folder but a path can be included within the tag to point at other locations.

If moving a presentation from one machine to another, remember to move a copy of any fonts used.

 

 

Paths

In any slide the media item can have paths applied to them so that movement effects can be applied to item, as well as automated fly through for large models and any other movement that is required to happen in a slide.

 

<model path="name.path" path_time_offset="2">model/model.ive</model>

<image animation_material="name.material" animation_material_time_offset="2">movie.mov</image>

<model path="name.rotation_path">model.osg</model>

<image camera_path="name.path">image.jpg</image>

 

These four types of path are dependent on an external file with either a .path, .material or .rotation_path extension. These paths can be applied to any of the support media types.

1. path="name.path" This path requires a file with the extension .path. An example of a file like this is

0 0 0 -4 0 0 0 1

7 0 0 0 0 0 0 1

8 0 0 2 0 0 0 1 

 

The first column represent time from the point the animation path starts. The second, third and fourth columns represent x y z position coordinates respectively. The fifth, sixth, seventh and eighth columns represent the x y z w quaternion coordinate respectively. A time offset can also be applied to path_time_offset="2" the variable is the number of seconds from time the slide is loaded.

 

2. animation_material="name.material" This path requires a file with the extension .material. This allows the colour and alpha of an object to be altered over time. An example of this file type is:

 

0 1 1 1 0

2 1 1 1 1

6.5 1 1 1 1

7 1 1 1 0 

 

The first column represent time from the point the animation path starts. The second, third and fourth columns represent r g b a values respectively. A time offset can also be applied to an animation material using animation_material_time_offset="2" the variable is the number of seconds from time the slide is loaded.

 

3. path="name.rotation_path" This path requires a file with the extension .rotation_material. These paths a path to be applied to an object that is spinning. An example of this type of file is:

 

0 0 0 0 -0.3 0 0.01 0 0 0.05

5 0 0 0 0.2 0 0.1 10 0 0.09

20 0 0 0 -0.1 0 0.4 190 0 0.6

24 0 0 0 -0.2 0 0.4 230 0 0.8

29 0 0 0 -0.3 0 -0.8 280 0 3

 

The first column represent time from the point the animation path starts. The second, third and fourth columns represent x y z position coordinates. The fifth, sixth and seventh represent x y z pivot point coordinates. The eighth and ninth columns represent rotation coordinates, azimuth (from north) and elevation (from horizon) respectively. The tenth column represents look distance.

 

4. camera_path="name.path" This path requires a file with the extension .path. This type of path movies the camera rather than the object, this is well suited to automating a fly through of a large model. This can easily be done by opening the model on its own, Present3D (not as part of an xml) and by pressing the z key, this will start recording the users movements, so stop the recording press Z (shift-z). There will be a file saved_animation.path created. Remember when using this path for fly through to set the model coordinate frame to model.

 

Menus and Interactive Presentation

Present3D also allows for interactive menus and other items to be created which allow other presentation and application to be started locally or remotely through SSH.

<?xml version="1.0" encoding="UTF-8"?>

<!--

Document   : menu.xml

Created on : 

Author     : 

Description: Menu for local file

-->

<presentation>

<name>Opticore Menu</name>

<bgcolor>BLACK</bgcolor>

<textcolor>WHITE</textcolor>

<slide>

<background></background>

<title>demo menu</title>

<layer>

<!-- remotely -->

<click_to_run>ssh user [at] host [dot] local /path/runmyapp present3D file.xml &amp;</click_to_run>

<bullet>Button</bullet>

<!-- locally -->

<click_to_run>/path/runmyapp present3D file.xml &amp;</click_to_run>

<image>images/image.png</image>

</layer>

</slide>

</presentation>      

 

The menu file works on due to the <click_to_run></click_to_run> function. This will run an external script allowing other application to be launched. The object that follows the click to run function is used as a clickable button which enables the click to run. This can be any of the Present3D supported media files. To launch another Present3D xml presentation a file called runmyapp is need to allow the xml file to be launched. This file should be place in the directory along with the xml presentation file. This file looks like:

 

cd /full/path/to/file/directory

setenv DISPLAY :0.0 

#export DISPLAY=:0.0

$1 $2

 

The purpose of this file is set the point at which the present3D file.xml command is applied, also sets up the display setup as this may vary when using remotely. This file should not have any extension.

When using a menu remotely, it is recommended that ssh automatic login is used, detail can be found here .

New Features : Present3D continues to be developed and a list of new features can be found on this page : How to : use Present3D Additional Features

 


Mailing List :

For additional support please join the Present3D list here :

http://lists.present3d.osgforge.org/listinfo.cgi/p3d-users-present3d.osg...