虚拟现实实验报告(DOC 30页)
实验一造型定位和旋转、缩放
一、实验内容:
1.熟悉VrmlPad编辑器的安装和使用
2.熟悉Cortonaplayer浏览器的安装和使用
3.掌握虚拟造型的基本操作。
二、实验环境:
1.硬件环境
计算机一台
2.软件环境
WindowsXP操作系统、VrmlPad编辑器和Cortonaplayer浏览器三、实验步骤:
完成第四章例4-1
代码:
Shape {
appearance Appearance {
material Material {
diffuseColor 0.9 0.1 0.05
}
}
geometry Sphere {
radius 0.85
}
}
Shape {
appearance Appearance {
material Material {
实验二三维立体造型的设计与实现(需交实验报告)
一、实验内容
1.熟悉各种立体造型的设计
2.学会利用各种不同的立体造型组合实现复杂的造型
二、实验环境
1.硬件环境
计算机一台
2.软件环境
WindowsXP操作系统、VrmlPad编辑器和Cortonaplayer浏览器
三、实验步骤:
1.制作一个烟囱的立体造型,首先以原点为中心生成一个半径为
1、高度为2的圆柱体,然后以(0,0,1.5)为坐标变换节点的
新原点生成一个底面半径为2,高度为1的圆锥体。
2.建立一个带刻度的钟表造型:首先生成钟表面box造型,然后
在钟表面上利用球体sphere造型生成各个刻度,利用圆柱体
cylinder造型生成时针、分针等造型。其中利用Transform
坐标变换节点对各个造型进行平移、缩放以及旋转操作。
3.设计一个文本造型。
4、完成书中第四章的例4-2 、4-3和4-4。
1)4-2
代码:
Transform {
translation -2 0 0
rotation 0 0 1 0.5
children [
DEF leg Shape {
appearance Appearance {
material Material {
diffuseColor 0.3 0.3 0.3
ambientIntensity 0.3
specularColor 0.7 0.7 0.7
shininess 0.1
}
}
geometry Box {
size 2 0.2 4
}
}
]
}
Transform{
translation 2 0 0
rotation 0 0 1 -0.5
children [
USE leg
]
}
Transform {
translation 0 0.52 0
scale 1.5 1 1
children [
Shape {
appearance Appearance { material Material {
diffuseColor 0.5 0.3 0.2
transparency 0.15
}
}
geometry Cylinder {
radius 3
height 0.1
}
}
]
}
截图:
2)4-3
代码:
Shape {
appearance Appearance { material Material {
diffuseColor 1.0 0 0 }
}
geometry Text {
string [
"Happy" "new" "Year!"
]
fontStyle FontStyle {
style "BOLDITALIC"
size 0.8
justify "MIDDLE"
}
}
}
Transform {
translation -3 -0.5 0 scale 1.2 1.2 1.2
children [
Inline {
url "1-1.wrl"
}
]
}
Transform {
translation 3 -0.5 0
scale 1.2 1.2 1.2
children [
Inline {
url "1-1.wrl"
}
]
}
截图:
3)4-4
代码:
Shape {
appearance Appearance {
material Material {
diffuseColor 1 0 0
}
}
geometry IndexedFaceSet {
coord Coordinate {
point [
0.00 -0.05 -1, 0.35 -0.10 -1,
0.53 -0.26 -1, 0.63 -0.50 -1,
0.79 -0.71 -1, 1.00 -0.87 -1,
1.24 -0.97 -1, 1.50 -1.00 -1,
1.76 -0.97 -1,
2.00 -0.90 -1,
0.00 -0.05 -1, 0.35 -0.10 1,
0.53 -0.26 -1, 0.63 -0.50 1,
0.79 -0.71 -1, 1.00 -0.87 1,
1.24 -0.97 -1, 1.50 -1.00 1,
1.76 -0.97 -1,
2.00 -0.90 1,
]
}
coordIndex [
0 10 11 1 -1,1 11 12 2 -1,
2 12 1
3 3 -1,3 13 1
4 4 -1,
4 14 1
5 5 -1,5 15 1
6 6 -1,
6 16 1
7 7 -1,7 17 1
8 8 -1,
8 18 19 9 -1
]
solid FALSE
creaseAngle 0.875
}
}
Shape {
appearance Appearance {
material Material {
diffuseColor 0.3 0.3 0.3
ambientIntensity 0.3
specularColor 0.7 0.7 0.8
shininess 0.1
}
}
geometry Extrusion {
crossSection [ ]
spine [
1.8 -1.0 0.75,1.8 -1.5 0.75,
0.6 -1.5 0.75,0.6 -1.5 -0.75,
0.6 -1.5 -0.75,1.8 -1.5 -0.75,
1.8 -1.0 -0.75
]
scale [0.03 0.05]
}
}
截图:
实验三造型的空间变换以及编程技术应用
一、实验内容
1. 熟悉Transform空间变换节点的运用
2. 熟悉Group编组造型节点的运用
3. 熟悉DEF、USE、Inline、Anchor、PROTO等节点的运用
二、实验环境
1. 硬件环境
计算机一台
2. 软件环境
VrmlPad编辑器和CortonaPlayer浏览器
三、实验步骤
1. 利用Transform空间变换节点和Group编组节点来设计生成4个米字造型,多个造型之间从前到后依次排列。首先,利用Group编组节点和DEF、USE素材调用方式生成一个米字型的造型;然后利用Transform空间变换节点中translation 域的域值设定来改变不同的米字造型的前后位置关系,需要用到Group编组造型节点的嵌套。
2. 利用PROTO原型节点,设计生成四个带刻度的钟表面,四
个带刻度钟表面的位置、大小以及颜色均有不同。首先,利用
PROTO原型节点定义钟表面,同时将其定义的参数铜鼓IS关
键字传给Transform空间变换节点的translation域、
Material节点里面的diffusecolor域、box节点里面的size
域来改变造型的空间位置、颜色和大小。
3、完成书中第四章的例4-5、4-6 与4-7。
1)4-5
代码:
Group {
children [
Shape {
appearance Appearance {
material Material { }
texture ImageTexture {
url "wood.jpg"
}
}
geometry Box {
size 2 2.4 0.8
}
}
Transform {
translation 0 0 0.4
children [
Shape {
appearance Appearance {
material Material {}
texture ImageTexture {
url "bookcase.jpg"
}
}
geometry Box {
size 2 2.4 0.01
}
}
]
}
]
}
截图:
2)4-6
代码:
Shape {
appearance Appearance { material Material {} texture MovieTexture {
url "steady.mpg"
loop TRUE
}
}
geometry Box {
size 2.4 2 0.01 }
}
Sound {
source AudioClip { url "steady.mpg"
loop TRUE
}
intensity 1
maxFront 16
maxBack 16
minFront 8
minBack 8
}
3)4-7
代码:
NavigationInfo {
headlight FALSE
}
PointLight {
location 0 5 0
intensity 0.8
ambientIntensity 0.5
on TRUE
}
Shape {
appearance Appearance {
material Material {
diffuseColor 1 0 0 }
}
geometry Sphere {
radius 0.9
}
}
Transform {
translation 0 -3 0
children [
Shape {
appearance Appearance { material Material {}
}
geometry Box {
size 8 0.02 6
}
}
]
}
Transform {
translation 0 -2.99 0 children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0 0 0
transparency 0.5
}
}
geometry Cylinder {
height 0.05
side FALSE
bottom FALSE
}
}
]
}
截图:
实验四简单的虚拟现实环境场景设计(需交实验报告)
一.实验内容
1. 理解VRML中虚拟现实场景中具有的一些要素
2. 利用Background背景节点设置场景的背景
3. 综合利用Transform空间变换节点、Shape空间造型节点、
MovieTexture电影纹理节点以及Sound声音节点设计一个播
放电影的平板电视造型效果
二、实验环境
1. 硬件环境
计算机一台
2. 软件环境
三、实验步骤:
1. 创建一个简单的天空地面组合而成的背景。通过设置
Background背景节点里面的skyColor和skyAngle来设置天
空的背景颜色渐变的效果,有蓝色逐渐转变成远处地平线位置
的白色;同时设置BackGround背景节点里面的goundColor
和groundAngle来设置地面背景颜色渐变的效果,由深褐色慢
慢变到远处地平线位置的浅褐色。
2. 在上题的基础上,增加全景背景的设计,显示一副高尔夫
球场的背景。利用Background背景节点里面的leftUrl、
rightUrl、frontUrl、backUrl等域的设置,将全景空间背景
的前、后、左、右4个面分解设置成4张图片,
3. 制作一个平板电视的效果,要求不仅有图像效果,同时也有声
音效果。首先利用transform节点和Box节点构造一个平板电视的效果,然后利用MovieTexture电影纹理节点将一个电影文件作为纹理贴图贴于造型表面,再利用Sound声音节点制造与之对应的声音效果。
4、完成书中的练习。
1)
代码:
Background {
skyAngle [ #设置天空角
1.2 1.57
]
skyColor [ #设置天空角对应的颜色