X3D shape and geometry: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 25: Line 25:


In order to position geometric shapes we need to use a so-called ''Transform node'' and in order to see a node we need to color it. Below we just introduce a minimal design pattern that you should use and understand before playing with geometry nodes.
In order to position geometric shapes we need to use a so-called ''Transform node'' and in order to see a node we need to color it. Below we just introduce a minimal design pattern that you should use and understand before playing with geometry nodes.
The ''translation="2 0 0"'' attribute of the ''Transform'' node allows to position an object in the x,y and z axis. The code below will move the containing object two meters to the right along the x-axis.
The ''Appearence'' node allows to add various colors and textures to an objet. In our case we define a simple Material with a diffuseColor of red (RGB value = "1 0 0").
<source lang="xml">
  <Transform translation='2 0 0'>
            <Shape>
<!-- A single geometry node here -->
                <Box size="2 2 2"/>
<!-- A simple RGB color for appearence, e.g. a 100% red cube -->
                <Appearance>
                    <Material diffuseColor="1.0 0 0"/>
                </Appearance>
            </Shape>
</Transform>
</source>


== Geometric primitives ==
== Geometric primitives ==

Revision as of 18:26, 5 October 2010

Draft

This article or section is currently under construction

In principle, someone is working on it and there should be a better version in a not so distant future.
If you want to modify this page, please discuss it with the person working on it (see the "history")

Introduction

This short tutorial introduced basic X3D modeling concepts.

Prerequisites: X3D, X3D graphics principles and X3D shape and geometry

In X3D, 3D "things" are defined with shape nodes. Shape nodes can appear under any grouping node (including the Scene node). Usually, a geometry is included under at least a Transform node for positioning, rotation, etc.

A Shape node includes:

  • A mandatory geometry node, of which several exist
  • An optional (quasi-mandatory) Appearance node which in turn includes a Material node for coloring.

X3D includes several kinds of geometry nodes:

  1. Simple geometric primitives
  2. Points, lines and polygone nodes
  3. Geometric 2D nodes
  4. Triangle nodes

Translations and color

In order to position geometric shapes we need to use a so-called Transform node and in order to see a node we need to color it. Below we just introduce a minimal design pattern that you should use and understand before playing with geometry nodes.

The translation="2 0 0" attribute of the Transform node allows to position an object in the x,y and z axis. The code below will move the containing object two meters to the right along the x-axis.

The Appearence node allows to add various colors and textures to an objet. In our case we define a simple Material with a diffuseColor of red (RGB value = "1 0 0").

  <Transform translation='2 0 0'>
            <Shape>
		<!-- A single geometry node here -->
                <Box size="2 2 2"/>
		<!-- A simple RGB color for appearence, e.g. a 100% red cube -->
                <Appearance>
                    <Material diffuseColor="1.0 0 0"/>
                </Appearance>
            </Shape>
 </Transform>


Geometric primitives

The five geometric primitives are most often used for hand coding, and implementation details (i.e. tessellation/polygon count) is left to the client.

Links

Reference manuals