Unity透明度不叠加
生活随笔
收集整理的這篇文章主要介紹了
Unity透明度不叠加
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
基于BlendOp實現透明度不疊加,多個物體重疊,后面被遮擋的半透明物體不顯示
Shader "Custom/NoAddAlpha" {Properties {_Color ("Color", Color) = (1,1,1,1)_MainTex ("Albedo (RGB)", 2D) = "white" {}_Glossiness ("Smoothness", Range(0,1)) = 0.5_Metallic ("Metallic", Range(0,1)) = 0.0}SubShader {Tags { "Queue"="Transparent" }LOD 200BLENDOP maxCGPROGRAM// Physically based Standard lighting model, and enable shadows on all light types#pragma surface surf Standard // Use shader model 3.0 target, to get nicer looking lighting#pragma target 3.0sampler2D _MainTex;struct Input {float2 uv_MainTex;};half _Glossiness;half _Metallic;fixed4 _Color;// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.// #pragma instancing_options assumeuniformscalingUNITY_INSTANCING_BUFFER_START(Props)// put more per-instance properties hereUNITY_INSTANCING_BUFFER_END(Props)void surf (Input IN, inout SurfaceOutputStandard o) {// Albedo comes from a texture tinted by colorfixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;o.Albedo = c.rgb;// Metallic and smoothness come from slider variableso.Metallic = _Metallic;o.Smoothness = _Glossiness;o.Alpha = c.a;}ENDCG}FallBack "Diffuse" }?
總結
以上是生活随笔為你收集整理的Unity透明度不叠加的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jQuery删除表格中指定行
- 下一篇: 解读 Oracle 12c 自适应执行计