毕业论文(设计)基于Unity3D 粒子系统的三维影视特效开发研究09740.doc

上传人:laozhun 文档编号:2884380 上传时间:2023-03-01 格式:DOC 页数:7 大小:604.50KB
返回 下载 相关 举报
毕业论文(设计)基于Unity3D 粒子系统的三维影视特效开发研究09740.doc_第1页
第1页 / 共7页
毕业论文(设计)基于Unity3D 粒子系统的三维影视特效开发研究09740.doc_第2页
第2页 / 共7页
毕业论文(设计)基于Unity3D 粒子系统的三维影视特效开发研究09740.doc_第3页
第3页 / 共7页
毕业论文(设计)基于Unity3D 粒子系统的三维影视特效开发研究09740.doc_第4页
第4页 / 共7页
毕业论文(设计)基于Unity3D 粒子系统的三维影视特效开发研究09740.doc_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《毕业论文(设计)基于Unity3D 粒子系统的三维影视特效开发研究09740.doc》由会员分享,可在线阅读,更多相关《毕业论文(设计)基于Unity3D 粒子系统的三维影视特效开发研究09740.doc(7页珍藏版)》请在三一办公上搜索。

1、基于Unity3D粒子系统的三维影视特效开发研究熊 耀(华中师范大学 武汉传媒学院 湖北 武汉 430205)摘要:粒子系统可模拟许多现场难以拍摄或实际拍摄成本很高的三维影视特效,在分析三维影视特效制作需求和粒子系统开发流程的基础上,运用Unity3D引擎的粒子系统模拟扔手榴弹的爆炸效果和动态雨雪场景。关键词:Unity3D;粒子系统;三维影视特效;爆炸;动态雨雪中图分类号:TP37 3D Special Effect Simulation Based on Particle System of Unity3DXiong Yao(Wuhan Media and Communication Co

2、llege, Huazhong Normal University, Wuhan 430205)Abstract: Various 3D special effects can be simulated by particle system, which are shot difficultly and costly. Based on analyzing the needs and development process of 3D special effects, the effects of explosion and dynamic rain and snow are simulate

3、d by using Unity3D.Keywords: Unity3D; Particle System; 3D Special Effect; Explosion Effect; Dynamic Rain and Snow Effect1. 引言三维影视特效科幻类、武侠类、动画类等电视剧和数字电影中的应用越来越多,已逐渐发展成为现代影视作品视觉效果好坏的重要指标之一,如变形金刚3、黑衣人3、后天等影视作品的制作大量采用例子系统模拟实现爆炸场景、大楼倒塌、焰火等三维影视特效场景。首先,三维影视特效通过与主体实拍场景的结合,不仅可充分发挥影视制作者的艺术灵感,而且可节约复杂特效的拍摄成本1。其

4、次,许多特效镜头在现实场景中的拍摄很困难或者现实生活中根本就不存在这样的真实场景。例如,人体细胞的分裂过程、树木花卉的四季生长变化过程等很难在同一时空内完成拍摄;巨浪冲击城市、火山爆发、大楼爆炸、烟雾等影视特效的拍摄不仅需要高昂的代价,而且可能会给剧组拍摄人员带来各种难以预测的安全风险。粒子是在三维空间内渲染的二维图像,粒子系统通过一个或两个纹理并多次重复的图形绘制即可创建一个三维影视特效。为此,采用粒子系统模拟各种现场拍摄无法完成或根本不存在的特效镜头成为当前影视产品开发的关键技术之一。Unity3D是一款支持Windows、Mac OS桌面操作系统平台和Android、iOS等移动操作系统

5、平台的三维游戏引擎,包含图形、音频、物理、网络、粒子等功能组件,采用C#和JavaScript作为脚本开发语言,支持大多数三维模型文件格式,提供了柔和阴影与烘焙等光影渲染系统和强大的可视化编辑器。它不仅适用于大型虚拟场景的模拟和3D网络游戏的开发,而且其功能丰富的例子系统可模拟烟雾、云雾、火焰、体积云、闪电、爆炸等数字三维影视特效。2. 粒子系统粒子系统是Reeves于1983年提出的一种模拟不规则模糊物体对象或自然场景的方法,这些不规则的模糊物体具有不同程度的动态性和随机性,能够很好地模拟烟雾、海浪、水流、火焰、雨雪、云雾、爆炸、森林等自然场景2。粒子系统中的每个粒子都具有形状、大小、颜色、

6、透明度、运动速度、运动方向、生命周期等属性,而且这些粒子随时间的推移不断变化,在时间和空间上具有动态分布特性,从而模拟各种现场拍摄难以实现的具有复杂运动规律的动态影视特效。粒子系统所模拟的物体或场景复杂多变、形态各异,根据粒子形态的不同,可将粒子系统分为流体粒子、烟雾粒子、破碎粒子等。流体粒子主要用来模拟流水、海浪、火焰、流动的岩浆等特效;烟雾粒子主要用来模拟随时间发展不断繁殖生长、消亡的动态粒子特效,如燃烧或爆炸过程中产生的烟雾、沙尘暴、龙卷风、云雾等;破碎粒子主要用来模拟物体碎裂、爆炸时的效果,一般伴有物体爆炸碎片的产生3。图1 基于粒子系统的三维影视特效开发流程如图1所示,利用粒子系统实

7、现三维影视特效的基本步骤包括以下几个4-5:(1)确定模拟对象的粒子模型在利用粒子系统模拟某一个自然场景或数字影视特效之前,首先要对模拟对象的运动规律进行分析,将场景或特效对象分解成由众多相互关联的粒子构成的一个运动系统,从而构建一个关于被模拟对象的动态变化模型。(2)初始化粒子系统根据步骤(1)得到的对象动态变化模型,初始化粒子的初始状态,如粒子的数量、形状、纹理、大小、颜色、透明度、初始位置、碰撞检测等属性。(3)设置粒子的运动规律基于对象运动规律及其相关数学公式,设置粒子的速度、加速度、生命周期、生命衰减等属性参数。(4)粒子状态更新粒子的初始状态和运动规律设置完成之后,粒子集合即将按照

8、所设定的规律和路径进行活动,并使用帧来控制每个粒子状态的动态变化。(5)粒子的消亡与重生每个粒子在完成其一个生命周期的所有活动之后便进入消亡阶段,此时需要粒子发射器需要按照粒子生成和运动规律产生新的粒子,这些新的粒子将经历步骤(2)到步骤(5)的相关动态变化。3. 基于Unity3D的三维影视特效开发3.1 Unity3D的粒子系统Unity3D中一个典型的粒子系统包括粒子发射器(Particle Emitter)、粒子动画器(Particle Animator)和粒子渲染器(Particle Renderer)三个组件。一个简单的静态粒子系统采用一个粒子发射器和一个粒子渲染即可实现;如果粒子

9、系统与其他虚拟物体对象有交互时,可在物体上添加一个粒子碰撞器(Particle Collider)。粒子发射器用来产生大量粒子,Unity3D的粒子发射器有椭球粒子发生器(Ellipsoid Particle Emitter)和网格粒子发射器(Mesh Particle Emitter)两种6。其中,椭球粒子发射器在一个球形范围内产生大量粒子,使用Ellipsoid属性来缩放和拉伸范围;网格粒子发射器在一个网格周围发射粒子,粒子从网格的表面产生,适用于粒子与物体通过复杂的交互方式相互作用的情况。粒子动画器将在不同的方向移动粒子和改变粒子的颜色,也可通过脚本编程的方式控制粒子系统中每个粒子的行为

10、,从而实现更复杂的粒子特效。粒子渲染器是将粒子系统所绘制的效果渲染在显示设备屏幕上,让用户可以直观地观察到相应的视觉效果;粒子碰撞器用来实现和虚拟场景中其他碰撞体之间的相互作用,如爆炸粒子系统碰到目标对象时发生爆炸效果7-8。3.2 手榴弹爆炸特效模拟这里以扔手榴弹为例,分析在Unity3D平台上模拟三维爆炸特效的开发过程,具体实现过程可分为以下几个步骤:(1)制作具有碰撞检测功能的手榴弹预设首先,将制作完成的手榴弹三维模型导入Unity3D虚拟场景中,将其添加刚体属性组件(Rigidbody)、碰撞检测器(Box Collider)和销毁控制脚本GrenadeS2cript.js,并将其制作

11、成预设(Prefab),以便在虚拟场景中多次重复调用该手榴弹模型。刚体属性组件主要是为了让手榴弹具有向下的重力属性;碰撞检测器用来判断手榴弹是否与其他虚拟对象发生物理碰撞,即是否满足触发爆炸特效的条件;销毁控制脚本GrenadeS2cript.js主要实现爆炸特效发生之后手榴弹实例对象自动销毁,其核心代码如下:function Update () if(Time.time (creationTime+lifeTime)Destroy(gameObject);/销毁手榴弹对象Instantiate(explosionPrefab, transform.position, Quaternion.i

12、dentity);(2)添加爆炸粒子系统向场景中添加一个名为large flames的粒子系统,包括椭球粒子发射器、粒子动画器、粒子渲染器、音频源(Audio Source)四个组件,并初始化例子属性,如将如图2所示的纹理贴图赋给粒子,并在音频源组件中添加一个模拟手榴弹爆炸效果的音频。因为爆炸特效一般只是持续几秒时间,同样需要添加一个实现爆炸粒子系统自动销毁的脚本。图2 爆炸粒子系统的基本属性(3)手榴弹爆炸特效模拟为实现如图3所示的手榴弹爆炸特效场景,首先新建一个用于实现扔手榴弹功能的脚本文件,并将其添加到虚拟场景中的某个虚拟物体对象上,实现单击鼠标中键时,实例化一枚步骤(1)所创建的手榴弹

13、对象;当手榴弹实例与其他虚拟对象发生物理碰撞时,首先实例化一个步骤(2)所创建的爆炸粒子系统,数秒之后手榴弹实例自动销毁,手榴弹运动和爆炸粒子系统实例化的核心代码如下:function Update() /单击鼠标中键时,投掷手榴弹if (Input.GetMouseButtonDown(2)var Coconut:Rigidbody = Instantiate(myCoconutPrefab, transform.position, transform.rotation);Coconut.velocity = transform.TransformDirection(Vector3(0, 1

14、, throwForce);Physics.IgnoreCollision(Coconut.collider, transform.root.collider);/ 间隔12秒才可以进行下次投掷yield WaitForSeconds (12);图3 手榴弹爆炸特效3.3 三维动态雨雪特效模拟在场景中添加一个包含椭球粒子发射器、粒子动画器、粒子渲染器、粒子碰撞器、音频源等组件的雨(雪)例子系统rain,并设置每个粒子的尺寸大小和时间寿命、每秒时间内可产生的粒子数量、粒子的发射速度、雨(雪)粒子的纹理贴图等属性。同时,为实现下雨(雪)的生效,在音频源组件中加载雨(雪)声音文件。最后,新建两个原来

15、模拟水波特效和水花特效的粒子系统,并在这两个粒子系统上分别添加脚本模拟雨滴(雪片)与地面碰撞时出现的水波特效和溅起的水花特效,水花和水波特效控制脚本的核心代码如下:function Rain () /在XZ平面上取得随机坐标点pos = Vector3(Random.Range(-4.00, 4.00), 18 ,Random.Range(-4.00, 4.00); /根据雨滴粒子发射器的最大最小值区间取得随机值、生命值,并开始发射雨滴或雪片料子。 size = Random.Range(rain.minSize, rain.maxSize); lifetime = Random.Range(

16、rain.minEnergy, rain.maxEnergy); rain.Emit(pos, rain.worldVelocity, size, lifetime, Color.white); / 1秒后,水波纹及小水花两个料子发射器开始发射粒子yield WaitForSeconds(1); pos.y = splash.transform.position.y; size = Random.Range(ripple.minSize, ripple.maxSize); lifetime = Random.Range(ripple.minEnergy, ripple.maxEnergy);

17、ripple.Emit(pos, ripple.worldVelocity, size, lifetime, Color.white); size = Random.Range(splash.minSize, splash.maxSize); lifetime = Random.Range(splash.minEnergy, splash.maxEnergy); splash.Emit(pos, splash.worldVelocity, size, lifetime, Color.white); 同时,只要通过脚本控制粒子系统的纹理贴图、粒子尺寸大小、粒子发射速度等属性参数,即可很方便地模拟

18、出不同的雨景和雪景特效,如图4和图5所示。图4 三维动态雨景特效 图5 三维动态雪景特效4. 总结与展望三维影视特效具有模拟真实自然现象、难以拍摄的景物、时空局限的生物成长过程等功能,本文基于Unity3D粒子系统模拟了扔手榴弹后的爆炸特效和动态雨雪两种三维影视特效,对数字影视特效的模拟和制作具有重要的参考价值。下一步我们将研究基于Unity3D引擎实现花草树木生长过程的模拟以及竹林、鱼群等动态群体行为对象的三维仿真。参考文献1王少伟,陈晓青,李颂,等.影视特效粒子系统研究J.软件导刊,2012,11(4):168-170.2Reeves W.T. Particle SystemsA Tech

19、nique for Modeling a Class of Fuzzy ObjectsJ.Computer Graphics,1983,17(3):359-376.3 郭齐胜,董志明.战场环境仿真M.北京:国防工业出版社,2005:156-167.4 姚莉,肖健,刘平.基于粒子系统的礼花模拟方法J.东南大学学报:自然科学版,2010,40(6):1185 1189.5 杨述华,廖守亿,王仕成,等.基于粒子系统和Vega的实时雨雪模拟J.计算机应用,2008,28(6).6Unity圣典.粒子系统(旧版,3.5之前版本)DB/OL2012-9-6.7 朱诗孝.粒子系统及其在自然现象模拟中的应用J

20、.教育技术导刊,2009,12(6):105-1068 王晓娟,基于粒子系统动态烟花的模拟J.青海大学学报:自然科学版,2009,27(4):29-32.待添加的隐藏文字内容2作者简介:熊耀(1983-7-25),男,汉族,湖北省黄冈市人,华中师范大学武汉传媒学院新闻传播学院助教、研究方向:影视后期制作与影视摄像、虚拟现实通信地址:武汉市江夏区藏龙岛凤凰大道特1号邮编:430205联系电话:13667122265Editors note: Judson Jones is a meteorologist, journalist and photographer. He has freelance

21、d with CNN for four years, covering severe weather from tornadoes to typhoons. Follow him on Twitter: jnjonesjr (CNN) - I will always wonder what it was like to huddle around a shortwave radio and through the crackling static from space hear the faint beeps of the worlds first satellite - Sputnik. I

22、 also missed watching Neil Armstrong step foot on the moon and the first space shuttle take off for the stars. Those events were way before my time.As a kid, I was fascinated with what goes on in the sky, and when NASA pulled the plug on the shuttle program I was heartbroken. Yet the privatized spac

23、e race has renewed my childhood dreams to reach for the stars.As a meteorologist, Ive still seen many important weather and space events, but right now, if you were sitting next to me, youd hear my foot tapping rapidly under my desk. Im anxious for the next one: a space capsule hanging from a crane

24、in the New Mexico desert.Its like the set for a George Lucas movie floating to the edge of space.You and I will have the chance to watch a man take a leap into an unimaginable free fall from the edge of space - live.The (lack of) air up there Watch man jump from 96,000 feet Tuesday, I sat at work gl

25、ued to the live stream of the Red Bull Stratos Mission. I watched the balloons positioned at different altitudes in the sky to test the winds, knowing that if they would just line up in a vertical straight line we would be go for launch.I feel this mission was created for me because I am also a jour

26、nalist and a photographer, but above all I live for taking a leap of faith - the feeling of pushing the envelope into uncharted territory.The guy who is going to do this, Felix Baumgartner, must have that same feeling, at a level I will never reach. However, it did not stop me from feeling his pain

27、when a gust of swirling wind kicked up and twisted the partially filled balloon that would take him to the upper end of our atmosphere. As soon as the 40-acre balloon, with skin no thicker than a dry cleaning bag, scraped the ground I knew it was over.How claustrophobia almost grounded supersonic sk

28、ydiverWith each twist, you could see the wrinkles of disappointment on the face of the current record holder and capcom (capsule communications), Col. Joe Kittinger. He hung his head low in mission control as he told Baumgartner the disappointing news: Mission aborted.The supersonic descent could ha

29、ppen as early as Sunday.The weather plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosp

30、here (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (

31、called the tropopause), he can expect a lot of turbulence.The balloon will slowly drift to the edge of space at 120,000 feet (22.7 miles/36.53 kilometers). Here, Fearless Felix will unclip. He will roll back the door.Then, I would assume, he will slowly step out onto something resembling an Olympic

32、diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end.Skydiver preps

33、 for the big jumpWhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to Earth. But this will not be enough to stop him completely.If he goes too

34、fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfu

35、lly, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is

36、 guaranteed to work higher than 25,000 feet (7,620 meters).It might not be the moon, but Kittinger free fell from 102,800 feet in 1960 - at the dawn of an infamous space race that captured the hearts of many. Baumgartner will attempt to break that record, a feat that boggles the mind. This is one of those monumental moments I will always remember, because there is no way Id miss this.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号