纳金网

标题: 《掌握x3d》系列教程第二节 [打印本页]

作者: 愤怒的小猪    时间: 2011-12-26 15:19
标题: 《掌握x3d》系列教程第二节
掌握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" />
作者: 四哥    时间: 2011-12-27 13:37
四哥路过,其他闪道!
作者: 哭泣的野百合    时间: 2011-12-27 13:37

作者: 哭泣的野百合    时间: 2011-12-27 13:37

作者: 有人不让用炮炮    时间: 2011-12-27 13:38

作者: 打死不看十三钗的猪    时间: 2011-12-27 13:49
晕死
作者: tc    时间: 2012-2-1 23:30
很经典,很实用,学习了!

作者: tc    时间: 2012-3-16 23:31
不错哦,顶一下......

作者: C.R.CAN    时间: 2012-4-22 23:21
我是老实人,我来也!

作者: 菜刀吻电线    时间: 2012-5-23 23:21
很经典,很实用,学习了!

作者: C.R.CAN    时间: 2012-6-22 23:19
真不错,全存下来了.

作者: tc    时间: 2012-8-8 23:47
既来之,则看之!

作者: .    时间: 2012-11-16 21:17
这是一个好帖子,大家快来围观!!
作者: 奇    时间: 2013-1-25 23:25
我看看就走,你们聊!

作者: 晃晃    时间: 2013-2-20 23:20
谢谢楼主,真是太实用了

作者: tc    时间: 2013-3-15 23:19
非常感谢,管理员设置了需要对新回复进行审核,您的帖子通过审核后将被显示出来,现在将转入主题





欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5