← Previous Section Next Section →

Configure X3DOM

This tutorial will learn how to modify important properties of the x3dom runtime using declarative code. There are several parameters that change default behaviour, for example to show debug information or influence how the scene is rendered.

Lets set a param for our runtime:

    <x3d showStat="true">

The param you just added activates the statistics window, giving you some debug information that may be relevant during development. Since the user normally should not see this, the stat window is deactivated by default. If you only need it sometimes, you may also toggle its visibility using the space bar on your keyboard.

Sample stats.

The values of params are not restricted to boolean values. Using the param PrimitiveQuality, you can influence how many triangles are used to approximate primitives. The default value is high but you may set it to Medium, Low or any float value between 0.0 and 1.0. A smaller value means less triangles used. You can compare the effect in the picture below.

X3DOM rendering of a sphere using high and low quality primitives.

If you want your application to use less triangles (for example because of performance limits), just add the following argument.

    <x3d PrimitiveQuality="low">

The resulting page should now look like this:

Scene in low quality with stats window.

Visit the Scene Author Configuration Documentation page to learn about more possible params.
You can configure even more rendering details using the environment node. Some examples can be found in the Tutorials about Simple Screen-Space Ambient Occlusion and Culling Technologies.

Back to page top ⤴

Get this X3DOM example:

Read more about the X3DOM nodes used in this tutorial: