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. Dismiss Notice

Shader works correctly in shader graph preview window but not in editor

Discussion in 'Shaders' started by MCrafterzz, Dec 17, 2018.

  1. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
    Hello, I'm trying to create a simple low poly water shader but for some reason it just doesn't work. It works fine in the shader graph window but in the editor it's totally still even when playing.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,236
    How are you offsetting the vertex positions? What scale is the object you're using the shader on?

    The preview sphere is a 1 unit radius sphere centered at 0,0,0 in "world space". If your in game sphere is much larger, it's possible it's not moving enough to be visible.
     
  3. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
    The sphere has the scale of 1,1,1. I set wave height to an insane amount: 1000000 but it still doesn't work. Shader:
     
  4. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    635
    Does your mesh have UVs ? The noise node is using UV as source, if you don't have those, it will result in an uniform value.
     
    P_Jong likes this.
  5. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
    That is probably the problem. I tried fixing it by adding a texture as an input but now everything is purple!
     
  6. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
  7. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    635
    Well ... that should definitively not happen.
     
  8. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
    but it did… I am using the lwrp
     
  9. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    635
    Random guess :
    - check that the LWRPAsset is properly assigned in the graphic settings.
    - Update to newer version of package is available.
     
  10. janjoeljanjoel

    janjoeljanjoel

    Joined:
    Jul 15, 2020
    Posts:
    2
    I have the same problem the preview is ok but the material is not how did you solve yours?
     
    Boutei likes this.