- 最后登录
- 2013-6-5
- 注册时间
- 2011-12-5
- 阅读权限
- 90
- 积分
- 17782
![Rank: 7](static/image/common//star_level3.gif) ![Rank: 7](static/image/common//star_level2.gif) ![Rank: 7](static/image/common//star_level1.gif)
- 纳金币
- 17782
- 精华
- 0
|
掌握X3D 第二节
主要内容:外观
材质 Material
Appearance 外观节点
Material 材质节点
•diffuseColor 决定色彩
<Shape>
<Appearance>
<Material diffuseColor="1 1 0" />
</Appearance>
<Box />
</Shape>
色彩的值为RGB值,可用photoshop查色并计算。
shininess 光亮程度
transparency 透明度
<Material diffuseColor="1 1 0" transparency="0.9"/>
ambientIntensity 环境色彩强度
emissiveColor 色彩的放射程度
specularColor 色彩的反射形式
<Material diffuseColor="1 1 0" emissiveColor="0 0 1" specularColor="1 0 0"/>
例子—广告牌
<X3D>
<Scene>
<Transform translation ="0 1.5 0">
<Shape>
<Appearance>
<Material diffuseColor="0.3 0.7 0.2" />
</Appearance>
<Box size="0.3 1 2"/>
</Shape>
</Transform>
<Transform translation ="0 0 0">
<Shape>
<Appearance>
<Material diffuseColor="1 1 0" />
</Appearance>
<Cylinder height="3.0" radius="0.2" />
</Shape>
</Transform>
</Scene>
</X3D>
贴图ImageTexture
url 贴图位置
<Shape>
<Appearance>
<ImageTexture url="1.jpg"/>
</Appearance>
<Box/>
</Shape>
几个面不同?
<Transform translation="0 0 1"><Shape>
<Appearance><Material diffuseColor="1 0 0"/><ImageTexture url="Top.jpg"/> </Appearance>
<Box size="2 2 0.005 " />
</Shape></Transform>
<Transform translation="0 0 -1"><Shape>
<Appearance><Material diffuseColor="1 0 0"/><ImageTexture url="Top.jpg"/> </Appearance>
<Box size="2 2 0.005 " />
</Shape></Transform>
<Transform translation="0 1 0"><Shape>
<Appearance><Material diffuseColor="1 0 0"/><ImageTexture url="Mid.jpg"/> </Appearance>
<Box size="2 0.005 2 " />
</Shape></Transform>
<Transform translation="0 -1 0"><Shape>
<Appearance><Material diffuseColor="1 0 0"/><ImageTexture url="Mid.jpg"/> </Appearance>
<Box size="2 0.005 2 " />
</Shape></Transform>
<Transform translation="1 0 0"><Shape>
<Appearance><Material diffuseColor="1 0 0"/><ImageTexture url="Side.jpg"/> </Appearance>
<Box size="0.005 2 2 " />
</Shape></Transform>
<Transform translation="-1 0 0"><Shape>
<Appearance><Material diffuseColor="1 0 0"/><ImageTexture url="Side.jpg"/> </Appearance>
<Box size="0.005 2 2 " />
</Shape></Transform>
圆柱体贴图
<Shape>
<Appearance>
<Material/>
<ImageTexture url="2.png"/>
</Appearance>
<Cylinder bottom="false" height="3.2" side="false"/>
</Shape>
<Shape>
<Appearance>
<Material/>
<ImageTexture url="3.png"/>
</Appearance>
<Cylinder height="3.2" side="false" top="false"/>
</Shape>
<Shape>
<Appearance>
<Material/>
<ImageTexture url="1.jpg"/>
</Appearance>
<Cylinder bottom="false" height="3.2" top="false"/>
</Shape>
球体
包起来
<Shape>
<Appearance>
<ImageTexture url="2.jpg" />
</Appearance>
<Sphere />
</Shape>
视频纹理
MovieTexture
loop 是否循环播放
url 视频地址
<Shape>
<Appearance>
<MovieTexture loop= " true " url= " 1.mpg " />
</Appearance>
<Box />
</Shape>
例子:电视
前端
<Transform translation ="0 0 0">
<Shape>
<Appearance>
<Material diffuseColor="0.9 0.9 0.9" />
</Appearance>
<Box size="4 4 1"/>
</Shape>
</Transform>
后端
<Transform translation ="0 0 -1">
<Shape>
<Appearance>
<Material diffuseColor="0.9 0.9 0.9" />
</Appearance>
<Box size="3 3 1"/>
</Shape>
</Transform>
天线
<Transform translation ="-1.4 2.6 0">
<Shape>
<Appearance>
<Material diffuseColor="1 1 0" />
</Appearance>
<Cylinder height="1.2" radius="0.1" />
</Shape>
</Transform>
屏幕
<Transform translation ="0 0 0.5">
<Shape>
<Appearance>
<MovieTexture loop="true" url="Temp/sp.avi"/>
</Appearance>
<Box size="3.6 3.6 0.12"/>
</Shape>
</Transform>
纹理变换TextureTransform
rotation 旋转
scale 缩放
translation 位置
<Shape>
<Appearance>
<ImageTexture url= " 1.jpg " />
<TextureTransform translation= " 0.5 0 " />
</Appearance>
<Box />
</Shape>
<TextureTransform rotation= " 45 " />
<TextureTransform scale="2 3" /> |
|