【问题标题】:Trail renderer always black?轨迹渲染器总是黑色的?
【发布时间】:2015-10-30 21:05:31
【问题描述】:

由于某种原因,无论我如何更改颜色,2D 轨迹渲染器都会保持黑色。知道为什么吗?

【问题讨论】:

    标签: unity3d unity5


    【解决方案1】:

    据我所知,尾部渲染器需要一个精灵着色器。您使用的是标准着色器,因此光照计算会错误。

    【讨论】:

      【解决方案2】:

      答案很简单。您使用不接受 Main Color 的 Mobile/Diffuse 着色器来增加纹理。您需要具有主色的着色器。您可以使用我的(它是 Mobile/Diffuse 的变体,但带有 Main Color)

          Shader "Mobile/Diffuse Color" {
          Properties {
              // Adds Color field we can modify
              _Color ("Main Color", Color) = (1, 1, 1, 1)        
              _MainTex ("Base (RGB)", 2D) = "white" {}
          }
      
          SubShader {
              Tags { "RenderType"="Opaque" }
              LOD 100
      
              Pass {
                  Lighting Off
      
                  SetTexture [_MainTex] { 
                      // Sets our color as the 'constant' variable
                      constantColor [_Color]
      
                      // Multiplies color (in constant) with texture
                      combine constant * texture
                  } 
              }
          }
      
          Fallback "Mobile/VertexLit"
      }
      

      您还应该使用一些纹理,它可以是 2x2 分辨率的白色像素。它将使用与 Trail Renderer 中选择的颜色完全相同的颜色为纹理着色。

      【讨论】:

        【解决方案3】:

        尝试更改不同的材料(无论您添加了多少材料)并将颜色更改为任何颜色,至少它是明亮的。确保将 alpha 设置为 255 以保持可见性

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-09-16
          • 2013-11-25
          • 2014-09-12
          • 1970-01-01
          相关资源
          最近更新 更多