Shader "Custom/AlphaSelfIllum" {
Properties {
_Color ("Main Color", Color) = (1,1,1,0)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" { }
}
SubShader {
// We use the material in many passes by defining them in the subshader.
// Anything defined here becomes default values for all contained passes.
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
SeparateSpecular On
// Set up alpha blending
Blend SrcAlpha OneMinusSrcAlpha
// Render the back facing parts of the object.
// If the object is convex, these will always be further away
// than the front-faces.
//控制前面透明度
//Pass {
// Cull Front
// SetTexture [_MainTex] {
// Combine Primary * Texture
// }
//}
// Render the parts of the object facing us.
// If the object is convex, these will be closer than the
// back-faces.
//控制后面透明度
Pass {
Cull Back
SetTexture [_MainTex] {
Combine Primary * Texture
}
}
}
}
unity3d:shader自发光透明
Unity Shader自发光效果实现
最新推荐文章于 2025-01-04 14:45:16 发布
本文详细介绍了一种在Unity中实现自发光效果的Shader代码。通过定义颜色、高光、自发光颜色等属性,结合纹理贴图,实现了物体表面的自发光及透明效果。文章深入解析了Shader的SubShader部分,包括材质属性设置、光照开启、分离高光开启以及alpha混合等关键步骤。
1万+

被折叠的 条评论
为什么被折叠?



