JanusVR Documentation

[BUILD] Markup Language: Assets Tag & Contents

<Assets>
<AssetImage>
<AssetSound>
<AssetVideo>
<AssetObject>
<AssetShader>
<AssetGhost>
<AssetWebSurface>
<AssetScript>
<AssetRecording>

Assets

The <assets></assets> section of any webspace contains a list of assets that will be used throughout the room. As with developing for the ordinary, two dimensional internet, files may be stored and loaded from any external website and even your own computer.

EXAMPLE:

The below is an example of a properly formatted webspace, with its Assets section in the proper area.

<FireBoxRoom>
 <Assets>

 </Assets>
 <Room>

 </Room>
</FireBoxRoom>

Most assets must have an id assigned to it. This id is their unique "identifier", which will be used later on when placing the asset in the room.

Attributes:


AssetImage

AssetImage is used to define any standalone image file that will be used in the webspace. PNG, JPG, GIF and most other common formats are acceptable. Images with a transparency layer (such as with the PNG format) are also supported.

EXAMPLE:

The below example is of someone loading a picture of a wood plank into a webspace through the Assets section and giving it the id: woodplanks_img

<FireBoxRoom>
 <Assets>
  <AssetImage id="woodplanks_img" src="WoodPlanks.jpg" ></AssetImage>
 </Assets>
 <Room>

 </Room>
</FireBoxRoom>

Attributes:


AssetSound

These are sounds which can be used within the webspace. Supported formats are dependent upon the multimedia capabilities of the underlying platform (e.g. DirectShow on Windows, gstreamer on Linux). Uncompressed WAV will work universally, but is not bandwidth friendly. MP2 or MP3 are compressed formats which seem to work universally and offer great compression.

EXAMPLE:

Here is an example of how to use the AssetSound tag to add the sound "localmap.mp3" to the collection of assets, assigning it id "localmap_sound".

<FireBoxRoom>
 <Assets>
  <AssetSound id="localmap_sound" src="localmap.mp3" ></AssetSound>
 </Assets>
 <Room>

 </Room>
</FireBoxRoom>

Attributes:


AssetVideo

These are videos which can be used within the webspace. Supported formats are dependent upon the multimedia capabilities of the underlying platform (e.g. DirectShow on Windows, gstreamer on Linux). (On Windows, we use the K-Lite Codec Pack (Basic) to make a much wider variety of video formats available.)

EXAMPLE:

Here is an example of how to use the AssetVideo tag to add the video "las_firebox_clip.mp4" to the collection of assets, assigning it id "vid_id".

<FireBoxRoom>
 <Assets>
  <AssetVideo id="vid_id" src="las_firebox_clip.mp4" ></AssetVideo>
 </Assets>
 <Room>

 </Room>
</FireBoxRoom>

Attributes:


AssetObject

These are the 3D geometric objects which can be used within the FireBoxRoom. Supported formats are OBJ, DAE, 3DS and FBX.

EXAMPLE:

The URL to the file is specified by the src attribute. You can also specify materials for the file using either a single texture file (specified with the tex attribute), or more traditionally by specifying the location of the material file (specified with the mtl attribute). Here is an example of the first method (specifying a single image as a texture).

  <AssetObject id="pinetree" src="pinetree.obj" tex="pinetree.png" ></AssetObject>

Here is how to specify a material file (which may reference many textures):

  <AssetObject id="pinetree" src="pinetree.obj" mtl="pinetree.mtl" ></AssetObject>

Details for the more technical reader: If per-vertex normals are not specified in the file (specified by "vn" lines in the file), normals which are per-face will be generated by FireBox and assigned to each vertex. If textures are to be used, texture coordinates should be exported (these are "vt" lines in the file). Finally, meshes with 4 or more vertices used to define a polygonal face are supported - however FireBox's treatment is to divide these polygons into triangles using a naive triangle fan method, therefore only convex polygonal faces are properly supported and will render correctly.

Attributes:


AssetShader

An AssetShader allows you to use either a GLSL fragment shader to shade geometry (set src), or a GLSL vertex shader to deform geometry (set vertex_src), or both.

EXAMPLE:

Here is an example of defining a fragment shader.

<AssetShader id="shader_id" src="shader1.txt" ></AssetShader>

Here is another example (both custom fragment and vertex shaders).

<AssetShader id="shader_id" src="frag.txt" vertex_src="vert.txt" ></AssetShader>

See the section on Objects for information on shading an Object using the AssetShader (essentially, you want to set an Object's shader_id to the AssetShader's id).

Attributes:


AssetGhost

An AssetGhost defines a recording of a user. This recording will contain the position and orientation of the avatar, as well as the orientation of their head (as measured from the Oculus Rift headset).

EXAMPLE:

Below is an example of defining a ghost via a ghost file generated through JanusVR.

<FireBoxRoom>
 <Assets>
  <AssetGhost id="ghost_id" src="ghost.txt" ></AssetGhost>
 </Assets>
 <Room>

 </Room>
</FireBoxRoom>

Attributes:


AssetWebSurface

An AssetWebSurface defines an interactive surface that provides a 2D web view. Note that this surface can be placed on an Object by specifying a websurface_id that matches the AssetWebSurface's id.

EXAMPLE:

Below is someone defining a 1920x1080 resolution AssetWebSurface and pointing it to the JanusVR website.

<FireBoxRoom>
 <Assets>
  <AssetWebSurface id="janusWebSurface" src="https://janusvr.com" width="1920" height="1080" ></AssetWebSurface>
 </Assets>
 <Room>

 </Room>
</FireBoxRoom>

Attributes:


AssetScript

An AssetScript defines a file containing JavaScript (technically ECMAScript 3 compliant code) that you can run in the FireBoxRoom. Functions can be set up for specific events such as mouse clicks or on frame updates. Sounds can be played, Objects can be created, have their properties modified, and be destroyed. For further details about this, see this page: Javascript - Room Object. Also check the "experiment" workspace included with JanusVR which serves as a JS example.

EXAMPLE:

Below is an example of someone defining a JS file called "script.txt", which will be automatically executed when the webspace begins.

<FireBoxRoom>
 <Assets>
  <AssetScript src="script.txt" ></AssetScript>
 </Assets>
 <Room>

 </Room>
</FireBoxRoom>

(More notes: Cookies can also be saved/loaded via the JS (in addition to those cookies set through AssetWebSurfaces). This can be used for inter-communication between the FireBoxRoom, the JS/AssetScripts, and AssetWebSurfaces in the room.)

Attributes:


AssetRecording

An AssetRecording defines a file containing all user activity recorded in a webspace. This differs from an AssetGhost in that it is a complete recording of all user activity within a space.

EXAMPLE:

Below is an example of defining a recording via a recording file generated through JanusVR.

<FireBoxRoom>
 <Assets>
  <AssetRecording id="recording_id" src="recording.txt" ></AssetRecording>
 </Assets>
 <Room>

 </Room>
</FireBoxRoom>

Attributes: