官术网_书友最值得收藏!

Getting ready

To get started with this recipe, you will need to have Unity running and must have a project opened. As mentioned before, 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 this completed, you are now ready to step into the wonderful world of real-time shading!

Before getting into our first shader, let's create a small scene for us to work with:

  1. Let's create a scene by navigating to File | New Scene.
  2. Once you create the scene, create a plane to act as the ground by going to GameObject | 3D Objects | Plane in the Unity editor. Next, select the object in the Hierarchy tab and then go into the Inspector tab. From there, right-click on the Transform component and select the Reset Position option:

 This will reset the position property of the object to be at 000:

  1. To make it easier to see what our shaders will look like when applied, let's add some shapes to visualize what each of our shaders will do. Create a sphere by going to GameObject | 3D Objects | Sphere. Once created, select it and go to the Inspector tab. Next, change the Position to 010 so it is above the origin of the world (which is at 00, 0) and our previously created plane:
  1. Once this sphere is created, create two more spheres, placing them to the left and right of the spheres at positions -2, 1, 0 and 2, 1, 0 respectively:
  1. Lastly, confirm that you have a directional light (it should be seen in the Hierarchy tab). If not, you can add one by selecting GameObject | Light | Directional Light to make it easier to see the effect of your changes and how your shaders react to light.

If you are using the Unity project that came with the cookbook, you can open up the Chapter 2 | Starting Point scene instead as it has been set up already.

主站蜘蛛池模板: 泸水县| 东乡族自治县| 鹤峰县| 罗江县| 广宁县| 东乌珠穆沁旗| 庆城县| 濮阳市| 澳门| 河间市| 湖南省| 左贡县| 楚雄市| 四子王旗| 来安县| 龙山县| 武鸣县| 措勤县| 白银市| 安泽县| 枣强县| 河曲县| 顺平县| 佳木斯市| 哈密市| 庆城县| 久治县| 克拉玛依市| 建昌县| 南宫市| 垣曲县| 堆龙德庆县| 砚山县| 廉江市| 庆安县| 德江县| 肥东县| 西和县| 鹤壁市| 博白县| 瓦房店市|