新版Vega+Prime全面教程240汇总doc文档格式.docx
- 文档编号:21672597
- 上传时间:2023-01-31
- 格式:DOCX
- 页数:10
- 大小:392.14KB
新版Vega+Prime全面教程240汇总doc文档格式.docx
《新版Vega+Prime全面教程240汇总doc文档格式.docx》由会员分享,可在线阅读,更多相关《新版Vega+Prime全面教程240汇总doc文档格式.docx(10页珍藏版)》请在冰豆网上搜索。
<
vpMotion:
MotionUFOname="
myMotion"
>
setSpeed>
10.000000<
/vpMotion:
setBoost>
50.000000<
setBoostTurning>
5.000000<
setRateHeading>
40.000000<
setRatePitch>
20.000000<
MotionUFO>
环境构成
VegaPrime用vpEnv类描述了应用所需要的环境。
要想环境中具有太阳、月亮、天际线和云层,需要将vpEnvSun、vpEnvMoon、vpEnvSkyDom、vpEnvCloudLayer加入到vpEnv中。
环境具有诸如日期和时间等基本参数,并且能够根据模拟的时间流逝计算出当前时间,从而使太阳和月亮的亮度发生变化,模拟出白天和晚上。
同时环境还提供了一个对应于地球真实位置的参考位置,根据观察者位置的不同,确定太阳和月亮合适的位置。
环境还允许动态的设置观察者所在的时区。
VegaPrime用vpEnvSun描述太阳,用vpEnvMoon描述月亮。
vpEnvSun和vpEnvMoon都是靠定义lightsource和圆盘形状的几何图形来模拟太阳和月亮的。
Lightsource和圆盘的位置能够通过环境的时间模型自动动态改变。
太阳和月亮的亮度由它们在天空中的高度决定。
vpEnv:
EnvSunname="
myEnvSun"
setEnable>
true<
/vpEnv:
setTwilightDip>
-18.000000<
setTextureFile>
sun.inta<
setColor>
r>
0.992156<
g>
1.000000<
b>
0.949019<
a>
setHorizonColor>
0.545098<
0.239216<
EnvSun>
vpEnvSkyDome描述天际线,它定义了一个以observer为中心的,延伸到farclippingplane的椭圆形几何图形。
EnvSkyDomename="
myEnvSkyDome"
setGroundColor>
0.211765<
0.286275<
0.149020<
EnvSkyDome>
vpEnvCloudLayer描述云层,它是环绕在球形天空顶部,以observer为中心,起始高度可以由API函数设定,并延伸到farclippingplane。
EnvCloudLayername="
myEnvCloudLayer"
0.956863<
0.976471<
0.984314<
setElevation>
bottom>
3000.000000<
top>
5000.000000<
setTransitionRange>
500.000000<
setScudEnable>
false<
cloud_scattered.inta<
setTextureTiling>
x>
3.000000<
y>
EnvCloudLayer>
云层的纹理和颜色可以用API函数设定。
如果在环境中有风,云层的纹理坐标会随风向移动,模拟出云运动的效果。
云层的结构如下图所示。
环境所提供雾化效果,也是可以通过API直接修改的。
雾化效果是通过能见度体现的,可以直接将能见范围作为参数传给API函数。
能够通过降低能见度模拟雾天气。
环境的灯光分为lightsource和lightpoint两种,可以在Creator里面直接创建,也可以在程序中用底层的两个类:
vrLightSource和vrLightPoint创建。
在Lynx中可以直接创建lightsource。
在Creator里面创建的lightpoint是以节点方式存在的,可以为其命名,加入场景后就成为名字节点,可以通过方法findNamed()找到,转化成vsLightPoint节点类型后就可以进行控制了。
灯光的动画效果是用TYPE枚举变量定义的,有SEQUENCE.ROTATION和STROBE三种类型。
动画效果要附在vrLightPoint上。
TOM如是说:
VP使用XML构件ACF文件,这一全新的概念极大地优化VP的性能和简便了VP的使用。
通过ACF文件把握VP程序的基本框架,更能感受到创新带来的效果。
参考《用vegaprime开发三维视景概要》一文,受益良多,特此感谢!
第二章创建场景
介绍:
Thesceneinyourapplicationthatyouwillbecreatingwillincludeacountrysidewithafarmhouse,amoving
car,andagrainstorageunit.
目标:
ThistutorialleadsyouthroughthedevelopmentofPrimeJunction,USA
基础概念:
CreatingandsavinganACFfileinLynXPrime
GettingfamiliarwiththeLynXPrimeuserinterfaceandthe
differentviews
AddingOpenFlightmodelstoyoursimulationasobjects
Addingnewobjectstoascene
ChangingvaluesofinstancesintheAPIview
UsingtheActivePreviewtooltopreviewandrefineyour
application
步骤:
·
AddtheTerrain
AddtheClassicFarmhouse
AddtheCar
AddaGrainStorageUnit
第三章运动和观察点
介绍:
Motionmodelssimulatedifferentpositioningmethods,suchasflying,driving,walking,orhovering.Whenyouassociateamovingmodelwithanobject,thatobjectappearstomovethroughthescene.Youcanalsopositionyoureyepoint(observer)onornearthemovingobjectsothatyoufeellikeyou’recontrollingitsmovementwiththemouse.
Inthischapter,youwillsetobserversatdifferentlocations,addmotion,anddefinechannelstoviewdifferentareasofyoursceneatonetime.
目标:
Thistutorialtakesyouthroughtheprocessofdefiningandpositioning"
cameras"
(observers)inLynXPrimetoviewthescenefromdifferentvantagepoints.
Definingthelocationandorientationofobservers(定义观察点的位置和方向)
Usingtransformstoplaceobservers(用变化式代替观察点)
Addingmotiontoobjectsusingmotionmodels(使用运动模型给对象附加运动)
Addingcollisiondetectors(isectors)toobjects(给对象附加碰撞检测)
SettingdifferentviewsofthescenefortheActivePreview(设置不同的场景观察方向)
观察点设置
方位角,俯仰角,滚动角定义如下:
HeadingisrotationabouttheZaxis:
+Hislookingtotheleft
-Hislookingtotheright
PitchisrotationabouttheXaxis:
+Pislookingup
-Pislookingdown
RollisrotationabouttheYaxis:
+Ristiltingyourheadtotheright
-Ristiltingyourheadtotheleft
(Y为观察方向,方位角,俯仰角,滚动角的概念应该很容易掌握了)
建立转换式
转换式是动态坐标系统,值相对于父类。
转换式的位置是(0,-30,5),即车后30单位,车上5单位。
添加运动模型
运动模型是位置方案,这个方案允许通过输入设备实现位置的改变。
MotionUFO是零重力运动模型。
改变运动模型
MotionDrive是一个drive模型,用户可以控制其运动速度和转向。
添加碰撞检测
碰撞检测类型:
Tripod-Threeverticallinesegmentsthatcollectdatatogroundclampuserstothedesignatedtarget.Tripodisdesignedfordrivingatgroundlevel.(三条垂直线段,地面驾驶检测)
Bump-SixlinesegmentsthatcollectcollisionsalongthepositiveandnegativeX,Y,andZaxes.(六条线段收集正负方向上的碰撞信息)
LOS-LineofSightsinglelinesegmentthatradiatesalongthepositiveYaxis.Itcollectsdatathatisinfrontofyou.(收集Y前方的信息)
HAT-SinglelinesegmentthatradiatesalongtheZaxisasitcalculatestheHeightAboveTerrain.(海拔信息)
XYZPR-Computesthepointofcollisionaswellasthepitchandroll.(俯仰和滚装时计算碰撞点信息)
ZPR-ComputestheZpitchandrollatthepointofcollision.(俯仰和滚装时计算碰撞点高度信息)
Z-ComputestheZpointofcollision(计算高度信息).
VegePrime定义了抽象类vpIsector来描述检测器,并且派生出了多个具体的检测器,比如检测海拔高度的vpIscetorHAT,检测瞄准线的vpIsectorLOS等等。
每种检测器都是依靠线段来进行检测。
检测器自其中心向周围延伸出一些线段(linesegment),当这些线段和目标物体发生相交时就认为碰撞发生。
VpIsectorBump自中心出发,沿x、y、z正负半轴定义六条线段;
vpIsectorHAT在z轴方向上定义一条线段,给出z方向上的起点和终点即可;
vpIsectorLOS自中心沿y正半轴定义一条线段;
vpIsectorXYZPR在z轴方向上定义一条线段,它能够通过检测器的heading计算出pitch和roll值;
vpIsectorZ自中心出发,沿z轴定义一条线;
vpIsectorZ在z轴方向上定义一条线段,它能够通过检测器的z值计算出pitch和roll值。
进行碰撞检测需要设置isectormask。
每个检测器都可以设置一个mask,进行检测的目标物体也可以设置一个mask。
以检测飞机坠地为例,将检测器安放在飞机模型上,地面是检测目标,如果飞机接触地面就算发生碰撞。
检测器和地面都需要设置mask。
进行检测时,系统将检测器的mask和场景内所有物体的mask做与运算,结果不为0的才进行检测。
所以设置mask时要保证检测器和地面的mask做了与运算后结果不为0。
检测还引入了消息机制。
VegaPrime在vpIsector中定义了Event枚举变量来描述碰撞事件。
碰撞发生时消息订阅者会收到vpIsector:
:
EVENT_HIT事件通知,碰撞消失时消息订阅者会收到vpIsector:
EVENT_CLEAR_HIT事件通知。
因此,程序中要订阅事件消息,随时捕获此消息,以便知道什么时候碰撞发生,什么时候碰撞消失。
定义通道
一个窗口里可有多个通道,通道相当于视口(Viewport)。
更改窗口标题
第四章环境
YoucansetmanyenvironmentaleffectsforyourapplicationinLynXPrime,includingsunlight,moonlight,fog,andwind.Youcanalsocontrolthespeedthatadayelapses.Dawncanchangetoday,dusk,andnightinafewminutesofrealtime.
Inthischapter,youwillexperimentwithtimeofdaysettings,changetheskyandcloudtexture,andaddandpositionlightsources.(这一章将练习一天时间的设置,改变天空和云的纹理以及添加放置光源)
Inthistutorial,youwilllearnhowtocreateenvironmentaleffectsforyourapplication,likesunandmoonlightaccordingtothetimeofday,andacloudy,stormysky.Youwillalsoaddheadlightstothecarsothatyoucandriveinthedark.
Controllingthetimeofday(控制一天时间的变化)
Changingtheskycolor(改变太空的颜色)
Changingthecloudtexture(改变云的纹理)
Addingandpositioninglightsourcesonanobject(在对象上添加和放置光源)
定义环境
1.改变一天的时间。
默认设置为中午12点,可以改变时间流逝的速度,multiplier为60,相当于时间流逝加快60倍。
2.
改变天空的颜色
3.
改变云的纹理
添加光源
光源有三种:
DirectionalLight-Unidirectionallightthatpointsinaspecifiedorientation(定向光)
PositionalLight-Omnidirectionallightwithaposition(定位光)
SpotLight-Unidirectionallightwithbothadirectionandaposition(聚光灯光)
1.
添加车灯
建立第二个车灯
第五章特殊效果
Specialeffectsaddagreatdealofrealism,variety,andexcitementtoyourapplication.Youcanaddfire,explosions,anddebris,tonameafew.Youcanalsocreateyourownspecialeffectsusingparticlesystems,whicharecollectionsofpolygonsusedtomodelnaturalphenomenasuchasfireandsmoke.Objectsinthescenecanbeaddedastargetstohitanddestroy,andspecialeffectscanbeusedasafter-effects.AllofthesespecialeffectsandtheircharacteristicscanbeeasilydefinedinLynXPrime.
Inthischapter,youwillstartwithaddingasimplespecialeffecttothefarmhouse.Whenthecarhitsthehouse,debriswillfallaroundit.Thenyouwillhavesomefunbuildingatornadousingaserieso
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 新版 Vega Prime 全面 教程 240 汇总 doc