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

URP - LightingPhysicallyBased

Discussion in 'Universal Render Pipeline' started by OUTTAHERE, Jul 1, 2020.

  1. OUTTAHERE

    OUTTAHERE

    Joined:
    Sep 23, 2013
    Posts:
    658
    Since the newest URP (9.0.0-previer.35), I get this error in one of my shaders:

    Code (CSharp):
    1.  
    2. Shader error in 'Jovian/Fogless': 'LightingPhysicallyBased': no matching 4 parameter function at line 283 (on d3d11)
    3.  
    4. Compiling Fragment program
    5. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
    6. Disabled keywords: _NORMALMAP _ALPHATEST_ON _ALPHAPREMULTIPLY_ON _EMISSION _METALLICSPECGLOSSMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _OCCLUSIONMAP _SPECULARHIGHLIGHTS_OFF _GLOSSYREFLECTIONS_OFF _SPECULAR_SETUP _RECEIVE_SHADOWS_OFF _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHT_SHADOWS _SHADOWS_SOFT _MIXED_LIGHTING_SUBTRACTIVE DIRLIGHTMAP_COMBINED LIGHTMAP_ON INSTANCING_ON UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING
    7.  
    The signature of this function seems to have changed, but I can't find it anywhere:

    Code (CSharp):
    1. // LightingPhysicallyBased computes direct light contribution.
    2. color += LightingPhysicallyBased(brdfData, mainLight, normalWS, viewDirectionWS);

    I also get a similar error from a very simple VFX graph, but I had this with earlier versions of URP 9.0.0 as well. The visual effect works like a charm at edit time, but doesn't properly compile and thus can't render, nor expose any properties, in play mode.

    Code (CSharp):
    1. Shader error in 'Hidden/VFX/Instance Starfield/Swarm/Output Particle Quad': redefinition of 'GetCurrentViewPosition' at /Projects/protojovian/Library/PackageCache/com.unity.visualeffectgraph@8.1.0/Shaders/RenderPipeline/Universal/VFXCommon.hlsl(28) (on d3d11)
    2.  
    3. Compiling Fragment program with FOG_LINEAR
    4. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
    5. Disabled keywords: FOG_EXP FOG_EXP2 UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING
    6.  
    Anything I can do to alleviate either issue? Thanks!
     
  2. shaomang

    shaomang

    Joined:
    Mar 30, 2014
    Posts:
    5
    Similar problem here:


    Shader error in 'Hidden/VFX/Explosion/System/Output Particle Quad': redefinition of 'GetCurrentViewPosition' at VFXCommon.hlsl(28) (on d3d11)

    Compiling Vertex program with FOG_EXP2
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
    Disabled keywords: FOG_LINEAR FOG_EXP UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING
     
  3. OUTTAHERE

    OUTTAHERE

    Joined:
    Sep 23, 2013
    Posts:
    658
    The problem persists both on D3D and Vulkan.

    I worked around it by copying the Lit shader of URP 9.0.0 and chopping out the fog code.
     
    Last edited: Jul 5, 2020
  4. cdibbs

    cdibbs

    Joined:
    May 3, 2019
    Posts:
    17
    They added a fifth parameter to the method, a boolean called "specularHighlightsOff." Adding that to your method call makes the error go away.
     
    Stroustrup likes this.