让精灵表单动起来-iso_17356

时间:2024-06-28 11:40:50
【文件属性】:

文件名称:让精灵表单动起来-iso_17356

文件大小:6.09MB

文件格式:PDF

更新时间:2024-06-28 11:40:50

Unity

2.3 让精灵表单动起来 学习如何制作精灵表单动画对于我们是很有帮助的。它可以用于粒子特效,或翻书的 效果,不过它最常用于 2D 侧卷轴游戏。 精灵表单,也可以 称为精灵图集(sprite atlas),如果你不熟悉这个术语,你可以 把它理解为一个巨大的图片,里面镶嵌了很多小图片,有时也称为图片序列。 当你逐个遍历表中的每个小图片时,你会得到一个类似动画的效果。这个概念如同一 个便签的翻页效果或者一部电影胶卷的帧图像一样。如果我们循环精灵表单的每一帧,我 Diffuse Shading 8 To achieve a basic diffuse lighting model, we will have to create a Shader that will include an emissive color, an ambient color, and the total light accumulated from all light sources. The following recipes show you how to build up a complete diffuse lighting model, and also show some various industry tricks that come in handy for creating more complicated diffuse models using only textures. By the end of this chapter you will have learned how to build basic Shaders that perform basic operations. Armed with this knowledge, you will be able to create just about any Surface Shader. Creating a basic Surface Shader As we progress further into the recipes in this book, it is important that you know how to set up your workspace in Unity, so that you can work ef ciently, and without any pain. If you are already quite familiar with creating Shaders and setting up Materials in Unity 4, you may skip this recipe. It is here to ensure that newcomers to surface shading in Unity 4 can work with the rest of the recipes. Getting ready To get started with this recipe, you will need to have Unity 4 running, and must have created a new project. There will also be a Unity project included with this cookbook, so you can use that one as well and simply add your own custom Shaders to it, as you step through each recipe. With that completed, you are now ready to step into the wonderful world of real-time shading! How to do it… Before getting into our  rst Shader, let's create a small scene for us to work with. This can be done by going to GameObject | Create Other in the Unity editor. From there you can create a plane, to act as a ground, a couple of spheres, to which we will apply our Shader, and a directional light to give the scene some light. With our scene generated, we can move onto the Shader writing steps: 1. In the Project tab in your Unity editor, right-click on the Assets folder and select Create | Folder. If you are using the Unity project that came with the cookbook, you can skip to step 4.


网友评论