Introduction of VRML and form formation

Source: Internet
Author: User
introduction of VRML and form formationAuthor/source: unknown one. What is VRML language

1. The development history of VRML
2. Other Related technologies
OPENGL (Open Graphic Library, the most important three-dimensional function libraries)
Direct3D (a component of the DirectX package, three-dimensional function library for three-dimensional game programming)
JAVA 3D
SVG (Scalable Vector Graphics)
Flash (three-dimensional flash is about to appear)
Two. How to run VRML 1 on a computer. First to install the VRML plugin on the Web browser (any one can) Cosmoplayer 2.1.1
Cortona 2.2
Blaxxun Contact 4.4
2. Writing VRML program using Text editor (Notepad, WordPad)
Using Vrmlpad (a tool specifically designed to write VRML programs) 3. The extension of the VRML 2.0 file must be WRL or Wrz for example: CAR.WRL (normal format)
BUS.WRZ (compressed format, available WinZip etc Open) 4. The first line of the VRML 2.0 file must be: #VRML V2.0 UTF8
5. How to run the VRML file:
A. Calling the VRML file in the browser
B. Click on the VRML file in the File Manager
Three. Basic grammar knowledge of VRML2.0 1. The basic statement of VRML is a node statement, and VRML has 54 nodes.
2. Each node statement starts with a section name, followed by a flower arc string, which gives the parameter value parameter called field

3. Fill in the field, first give the field name, and then give the specific contents of the field, some of the specific contents of the field are specific values, such as height, radius, color, length and width of the high size, and some are another node statement, so the node statement can be multi-layered, that is, multi-layer flower expansion arc.

4. The field names start with lowercase, and the node names start with uppercase, and sometimes the field names and nodes are basically the same, such as appearance and appearance

Four. Formation of basic forms
1. VRML coordinate system (see p7,+x facing right, +y up, +z outward)
Dimension Unit M

Default observation position (0, 0, 10)

2. Shape node

All shapes and characters are used in the Shape node, which has two parameters:

The appearance effect of the form is given by appearance

The geometrical characteristics of a body given by geometry

3. Box node

Example: shape{geometry Box {}}

This is a form with no appearance, the size is the default value

The body color is black, and is white after being irradiated by light

4. Cylinder node

Example: shape{appearance appearance{material material{diffusecolor 1 0 0}}

Geometry cylinder{Height 4}

}

Generated as a red cone with a base radius of 1 (default) and a height of 4

5. Sphere node

6. Cone node

7. Appearance node

Material content is defined with the P82 material node

Texture can be defined with three texture nodes

Texturetransform defined with Texturetransform node


Three. Generation of complex shapes 1. The coordinate node is used to define the coordinate point array of space 2. The extrusion node is used to generate an extruded body commonly used fields are:
Crosssection a section shape by a set of points connected to the tail

Spine gives a stretch line

Scale to deform a body
3. Elevationgrid node defines a mesh surface


The commonly used fields are:

Xdimension the number of points in the x direction

Zdimension the number of points in the z direction

xspacing x-direction grid size

Zspacing z-direction grid size

Height of each grid point
4. Pointset node defines a set of spatial points


Fields are:

Coord defining the coordinates of a point with a coordinate node

Color defines the colors of a point with a color node (it can also be defined directly with shape's appearance without giving color)
5. Indexedlineset node defines a broken segment


The commonly used fields are:

Color defines colors

Coord defining the coordinates of an endpoint

ColorIndex gives a way to pick colors.

Coordindex gives a way to pick the endpoint

The Colorpervertex is used to specify whether the color is given by the endpoint or by segment

Coord provides the required array of points (n points, the subscript from 0 to N-1 for each point)

Coordindex gives a point of use

The following is the form of arbitrary selection of points used, construct one or more segments of the break between each of the broken segments with-1 separate


Five ways to handle line colors:
1. Do not give a color field, defined directly with the appearance of the Shape node (with Emissivecolor), for example ex3-11

shape{
Appearance appearance{material Material{emissivecolor 1 1 0}}

Geometry indexedlineset{

Coord coordinate{point[-2-2 0,2-2 0,2 2 0,-2 2 0]}

Coordindex[0 1 2 3 0]

}

}

2. You can make the color gradient on the segment

Colorpervertex is True (default)

gives a color array with the same number of colors as the number of points, with a specific color for each point

Colors are selected according to the way ColorIndex offers

For example Ex3-11 's:

Shape {

Geometry Indexedlineset {

coord coordinate {Point [1 1 3 2,1 4 3,4 2 1,-1-2 2,3 3 4,5 2 3]}

Coordindex [0 1-1 1 2-1 2 3-1 3 4-1 4 5-1 5 6]

Color color {color [1 1 1,0 0 1,0 1 0 0,1 0 0,1 0 1 0]}

Colorindex[6 3-1 6 6-1 3 3-1 3 3-1 5 5-1 5 5]

}
}

3. You can make the color gradient on the segment

Colorpervertex is True (default)

gives a color array with the same number of colors as the number of points, with a specific color for each point

Selection of colors according to Coordindex's subscript selection (Coordindex instead of ColorIndex)

For example Ex3-10 's:

Shape {

Geometry Indexedlineset {

coord coordinate {Point [1 1 3 2,1 4 3,4 2 1,-1-2 2,3 3 4,5 2 3]}

Coordindex [0 1-1 1 2-1 2 3-1 3 4-1 4 5-1 5 6]

Color color {Color [1 0 0,0 0 1,0 1 0,1 1 0,0 1 0 1 1]}

}
}

4. Each broken segment has a color, which is selected from the color array, when:

Colorpervertex to False

gives a color array

Colors are selected by ColorIndex and assigned to the corresponding broken segments

For example, EX3-10 's:

Shape {

Geometry Indexedlineset {

coord coordinate {point[-5 1 1,-4 3 2,-5 4 3,-1 2 1,-7 2 3]}

Coordindex [0 1 2 3 4]

Color color {color [0 1 1]}

ColorIndex [0]

Colorpervertex FALSE

}
}

5. Each broken segment has a color, but does not provide a colorindex field, at this point:

Colorpervertex to False

gives a color array

Colors are assigned to each broken segment in order

For example, EX3-11 's:
Shape {

Geometry Indexedlineset {

coord coordinate {point[-5 1 1,-4 3 2,-5 4 3,-1 2 1,-7 2 3]}

Coordindex [0 1 2-1 2 3 4]

Color color {color [0 1 1 1]}

Colorpervertex FALSE

}
}
6. The fields commonly used by the Indexedfaceset node to generate custom polygons are:

Color defines colors

Coord defining the coordinates of an endpoint

ColorIndex gives a way to pick colors.

Coordindex gives a way to pick the endpoint

The Colorpervertex is used to specify whether the color is given by the endpoint or by segment

Coord provides the desired array of vertices (n points, the subscripts of each point from 0 to N-1)

Coordindex the use of vertices.

Any of the points used in the following form, the construction surface

Separated by 1 between each face

Five ways to handle the face color:
1. Do not give a color field, defined directly with the appearance of the shape node
(with Emissivecolor)
2. The color can be gradient on the face

Colorpervertex is True (default)

gives a color array

Colors are selected according to the way ColorIndex offers

3. The color can be gradient on the face

Colorpervertex is True (default)

gives a color array with the same number of colors as the number of points, with a specific color for each point

Selection of colors according to Coordindex's subscript selection (Coordindex instead of ColorIndex)

4. Each face has a color, color from the array of colors selected

Colorpervertex to False

gives a color array

Colors are selected by ColorIndex and assigned to the corresponding broken segments

5. Each broken segment has a color, but does not provide a colorindex field, at this point:

Colorpervertex to False

gives a color array

Colors are assigned to each broken segment in order

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.