Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

help - simple shader

Discussion in 'Shaders' started by Lka, May 1, 2008.

  1. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    I have this simple shader

    Code (csharp):
    1.  
    2. Shader "LDetailColor" {
    3.     Properties {
    4.         _Color ("Main Color", Color) = (1,1,1,0.5)
    5.         _Shininess ("Shininess", Range (0.01, 1)) = 0.7
    6.         _SpecColor ("Spec Color", Color) = (1,1,1,1)
    7.         _Emission ("Emmisive Color", Color) = (0,0,0,0)        
    8.     }
    9.  
    10.     Category {
    11.         ZWrite On
    12.         SubShader {
    13.             Pass {
    14.                 Material {
    15.                     Diffuse [_Color]
    16.                     Ambient [_Color]
    17.                     Shininess [_Shininess]
    18.                     Specular [_SpecColor]
    19.                     Emission [_Emission]                                       
    20.                 }
    21.                 Lighting On
    22.             }
    23.         }
    24.     }
    25. }
    26.  
    In windows it appears "flat" without white reflections. What's wrong with it?
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    If you're asking about the missing specular highlight, then add
    Code (csharp):
    1. SeparateSpecular On
    to the shader. OpenGL and Direct3D differ a bit in how they handle specular when it's not explicitly turned on.