Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Surface shader looks different to standard?

Discussion in 'Shaders' started by hammil, Nov 18, 2015.

  1. hammil

    hammil

    Joined:
    Jun 5, 2013
    Posts:
    56
    I'm trying to make a basic surface shader, http://pastebin.com/Q8fgbUcZ , but I can't help notice that the result looks noticably different to the standard shader using the same parameters:



    The differences are much more apparent when switching between them in the editor, but side-by-side you should be able to see a difference in the reflected color on the flat surface, lack of shadows on the bullet casing and on the edge of the breech.

    In short.. why does this happen? What am I missing - maybe some extra pragma? I'd really rather not have to go through the standard shader's source and manually modify it.
     
  2. Fuegan

    Fuegan

    Joined:
    Dec 5, 2012
    Posts:
    20
    For the shadows your problem must be the pragma line.
    Try
    Code (CSharp):
    1. #pragma surface surf Standard fullforwardshadows
    instead of
    Code (CSharp):
    1. #pragma surface surf Standard
    For the reflected color I don't know.
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,248
    Try changing:
    _Metallic ("Metallic", Range(0, 1)) = 0
    to
    [Gamma] _Metallic ("Metallic", Range(0, 1)) = 0
     
  4. hammil

    hammil

    Joined:
    Jun 5, 2013
    Posts:
    56
    Yep, that was it! Everything works great now. Thanks for the help