Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question Screen Space Reflections do not work on WegBl?

Discussion in 'Web' started by danielesuppo, Nov 19, 2020.

  1. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    332
    Hello all,
    I'm working on a WebGl project and I really should use screen space reflections.

    I know that SSR can work on WebGl (just give a look to Babylon.js documentation, for example).

    So, since HDRP is not suitable for WebGl, and URP does not have SSR on its post processing task,
    I had to use for my project the built in render
    So I've downloaded the post process V2, and I've applied the "Screen Space Reflection" component to my PostProcessVolume.

    Everything work fine in editor, but when I publish for WebGl, I get (in Chrome) many error messages about post process, and particularly I get this message:

    Hidden/PostProcessing/ScreenSpaceReflections shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

    Is there a way to have SSR working on WebGl with Unity?

    Many thanks!
     
    Last edited: Nov 20, 2020
  2. arisdev82

    arisdev82

    Joined:
    Feb 27, 2019
    Posts:
    39
    Same question here. Anyone can confirm this?
     
  3. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Looking at the postprocessing package, in

    UnityProjectProject\Library\PackageCache\com.unity.postprocessing@3.0.2\PostProcessing\Shaders\Builtins\ScreenSpaceReflections.shader, it starts out with

    Code (CSharp):
    1. Shader "Hidden/PostProcessing/ScreenSpaceReflections"
    2. {
    3.     // We need to use internal Unity lighting structures and functions for this effect so we have to
    4.     // stick to CGPROGRAM instead of HLSLPROGRAM
    5.  
    6.     CGINCLUDE
    7.  
    8.         #include "UnityCG.cginc"
    9.         #pragma target 5.0
    10.  
    11.  
    Here the "target 5.0" line specifies the minimum graphics capabilities that are needed. Referring to https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html it means:

    #pragma target 5.0
    • DX11 shader model 5.0.
    • Not supported on DX11 before SM5.0, OpenGL before 4.3 (i.e. Mac), OpenGL ES 2.0/3.0/3.1, Metal.
    • Supported on DX11+ SM5.0, OpenGL 4.3+, OpenGL ES 3.1+AEP, Vulkan, Metal (without geometry), PS4/XB1 consoles.
    So this means that the SSR implementation currently requires one of those platforms, and WebGL 1 and WebGL 2 are not supported :(

    WebGL 1 supports #pragma target 2.0 and 2.5
    WebGL 2 supports #pragma target 2.0, 2.5, 3.0 and 3.5

    Unfortunately I don't know why Unity requires Shader Model 5.0. It could be a different algorithm that is employed that leans on some SM5.0 specific features for performance, graphical quality, combinability, or some other reason. I've asked around a little bit and see if I can dig up an answer.
     
    AllocBlock, shenbo and d1favero like this.