In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
First, let's take a look at the basic framework of UnityShader.
/ / set the directory path of Shader
Shader "FixedShader/Fixed001"
{
/ / set the external properties required by Shader
Properties {}
/ / Sub-shader (represents a rendering scheme)
SubShader {
/ / for example, for PC Pass
/ / Surface shader does not have Pass channel
{}}
SubShader {
/ / for example, for high-end mobile phones
} SubShader {
/ / for example, for low-end mobile phones}
/ / alternate shader: generally use the simplest Shader Fallback "Diffuse"}
Shader framework details
O the front Shader "FixedShader/Fixed001" sets the path of the current Shader to facilitate selection in the shader.
Select Shader
O after SubShader is a sub-shader, because Unity is cross-platform, the project of Unity may release many platforms, such as PC, mobile or handheld. The rendering capabilities of different devices are different, which makes it necessary to write Shader into multiple SubShader for all platforms when persisting in cross-platform projects. From top to bottom, the rendering effect of SubShader increases in turn, and the performance consumption increases in turn. Hardware devices will choose the best SubShader they can use to ensure that they can render and the effect is as good as possible. If all the previous SubShader cannot be used (the hardware rendering ability is too poor), then use Fallback (spare Shader) to render, and the general Fallback will choose the simplest Shader to prevent the material from not rendering.
O if (the current device can use SubShader01's rendering scheme to render)
O {
O * * render according to SubShader01 * *
O}
O else if (the current device can use SubShader02's rendering scheme to render)
O {
O * * render according to SubShader02 * *
O}
O else if (the current device can use SubShader03's rendering scheme to render)
O {
O * * render according to SubShader03 * *
O}
O...
O...
O...
O else
O {
O * * use Fallback to render * *
O}
O Pass channel means that when rendering an image, it can be rendered in multiple channels. For example, it is divided into positive and negative channels to render, transparency is 0.5 as the demarcation between two channels to render, and so on.
Separate positive and negative channels for rendering
Next, let's take a closer look at how the Shader property is set.
Shader is a processing factory and a solution for image rendering, so most good Shader gives users a lot of optional attribute interfaces to facilitate users to add their own project materials, so as to achieve rendering effects on demand.
Data type of Shader
O syntax: variable name (attribute prompt text, attribute data type) = initial value
O _ FloatValue ("a floating point number", float) = 0.5
/ / range floating point number
O _ RangeValue ("a range floating point number", Range (0P5)) = 0
/ / four-dimensional
O _ VectorValue ("one four-dimensional", Vector) = (1j0pj0pc1)
/ / Color value
O _ MainColor ("main color", Color) = (1j0pj0pc1)
/ / level 2 map
O _ MainTexture ("main texture", 2D) = "" {}
/ / non-second-order texture
O _ RectTexture ("non-second-order texture", Rect) = "" {}
/ / Cube map
O _ CubeTexture (Cube Map, Cube) = "" {}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.