《Unity 5.x Shaders and Effects Cookbook》第一章学习笔记

本文是《Unity 5.x Shaders and Effects Cookbook》第一章的学习笔记,涵盖了游戏物体组件、创建及应用shader的步骤、初始shader结构以及错误处理。通过学习,了解了renderer、material、shader的关系,以及如何在Unity中创建和修改shader属性。
摘要由CSDN通过智能技术生成

写在前面

因为在unity shader方面我并不算是新手了,之前也曾拜读过冯乐乐女神的《unityshader入门精要》,所以觉得第一章其实是很基础的知识,与我自己而言,我觉得第一章的一共有四个重点知识需要我们搞清楚。

知识点一

All the objects that are part of a game contain a number of components that affect their look and behavior. While scripts determine how objects should behave, renderers decide how they
should appear on the screen. Unity comes with several renderers, depending on the type of
object that we are trying to visualise; every 3D model typically has MeshRenderer. An object
should have only one renderer, but the renderer itself can contain several materials. Each
material is a wrapper for a single shader, the fnal ring in the food chain of 3D graphics. The
relationships between these components can be seen in the following diagram:
大意就是游戏中的每个物体都包含一些组件,这些组件决定它的行为和外表,脚本决定行为,而渲染决定它怎么呈现在屏幕上。每一个3D模型都有 MeshRenderer,一个物体只能有一个渲染器,但是一个渲染器可以包含多个材质。他们的关系如下表:

这里写图片描述
知道他们之间的关系对了解shader工作原理很重要。我认为我们还可以更进一步了解下shader和渲染管线的相关知识Shader和渲染管线(个人认为这篇博文讲的比较浅显易懂)

知识点二

如何创建一个shader并且运用到gameobject上,废话不多说,直接上步骤,我的开发环境是unity2017.3.1
step 1:在场景中创建一个cube
step 2:创建一个shader,命名为“StandardDiffu

Book Description: Since their introduction to Unity, Shaders have been notoriously difficult to understand and implement in games: complex mathematics have always stood in the way of creating your own Shaders and attaining that level of realism you crave. With Shaders, you can transform your game into a highly polished, refined product with Unity’s post-processing effects. Unity Shaders and Effects Cookbook is the first of its kind to bring you the secrets of creating Shaders for Unity3D―guiding you through the process of understanding vectors, how lighting is constructed with them, and also how textures are used to create complex effects without the heavy math. We’ll start with essential lighting and finishing up by creating stunning screen Effects just like those in high quality 3D and mobile games. You’ll discover techniques including normal mapping, image-based lighting, and how to animate your models inside a Shader. We’ll explore the secrets behind some of the most powerful techniques, such as physically based rendering! With Unity Shaders and Effects Cookbook, what seems like a dark art today will be second nature by tomorrow. What You Will Learn Understand physically based rendering to fit the aesthetic of your game Enter the world of post-processing effects to make your game look visually stunning Add life to your materials, complementing Shader programming with interactive scripts Design efficient Shaders for mobile platforms without sacrificing their realism Use state-of-the-art techniques such as volumetric explosions and fur shading Build your knowledge by understanding how Shader models have evolved and how you can create your own Discover what goes into the structure of Shaders and why lighting works the way it does Master the math and algorithms behind the most used lighting models
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值