Search Unity

Resolved Material shading/rendering update

Discussion in 'Unity Reflect' started by opacicpetar96, Dec 10, 2020.

  1. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    Hello!

    We are working on a custom Unity Reflect Viewer (we customized the Reflect Version 1.3.0-preview.102), and we want to implement the new Shading/Rendering feature of the latest official Reflect Viewer version. The difference between the two is noticable:

    first.PNG second.PNG

    The first one is our custom viewer, and the second one is the latest released version (same project loaded). Now, I couldn't really find a way to get the same strong lines and colors like on the second picture. What I did so far:
    1. I replaced the following shaders at 'URP Material Converter' at the Reflect Pipeline: 'URPOpaque' and 'URPTransparent' are both updated to the latest shaders.
    2. I added some of the new features of 'ForwardCameraRenderer HQ' to our 'ForwardCameraRenderer'.

    I tried to find out a solution to get the results we want but I just couldn't find where is this situation handled in the Viewer project. (BTW both of the pictures are taken inside unity)

    Oh, and yes, we can't just upgrade to the latest viewer version, because we made a lot of changes to the Reflect scripts as well, in order to add some new functionalities that suits our needs.

    Any idea or suggestion?
     
  2. GSingland

    GSingland

    Unity Technologies

    Joined:
    Dec 10, 2020
    Posts:
    14
    Hi,

    We did make some improvements to the Reflect shaders between 1.3 and 2.0. But since you upgraded the URPOpaque and URPTransparent shaders already, it has to be something else. Did your rendering actually change when you made this upgrade ?

    Along with the shader assets change, we had to make a few tweaks to the way materials are imported from Reflect ; namely, a few shader keywords and features were changed. If you want to use the 2.0 shaders, you'll probably want to bring these C# changes into your project as well ; you can find the relevant file in our package, at com.unity.reflect/Runtime/Utils/StandardShaderHelper.cs.

    At the same time, I'm not certain that your issue comes from there ; it might also be the lack of a simple post-process or renderer feature setting ?

    Guillaume
     
  3. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    Hi @GSingland , thank you for the response!

    The rendering did change when I upgraded the shaders, the rendering itself seems the same on our custom viewer and on the Unity latest viewer now. I also made changes you suggested in the StandardShaderHelper.cs and UnityReflectStandardShaderGUI.cs but the problem is still the same. The materials and it's colors still feel not strong enough. Our Post Processing looks like this:
    postprocess.PNG

    I played around with it, in both versions, and if I disable it it makes a difference but not that significant, so I think that it's not the issue right now. The Renderer features looks like this:

    renderer.PNG

    Note that the Custom Screen Space Ambient Occlusion feature is disabled because we are using Unity version 2020.1.9f1 ; and the mentioned feature is still buggy in this version of Unity. But I disabled it on the latest viewer as well, so that is not the issue we are facing.. And yes, I upgraded the latest Reflect Viewer to this unity version as well, so that is not the problem either.

    It looks like a material issue for me, but I'm not sure how to fix that ?

    EDIT

    Or maybe the Mesh Renderer is causing this issue?
     
    Last edited: Dec 11, 2020
  4. GSingland

    GSingland

    Unity Technologies

    Joined:
    Dec 10, 2020
    Posts:
    14
    Hi,

    After reading this I'm not sure I fully understand your situation ; what do you mean by the rendering being the same in your custom viewer and the latest released viewer, if the colors don't match ?

    Your settings do look correct, with the exception of SSAO, which would probably have added some depth to your scene ; but from what I understand it's still not what you're looking for.

    Between 1.3 and 2.0, I don't think we changed anything that would be related to the Mesh renderer. However, I think you're right by saying that it has to do with the materials (or rather, how the shader renders them).

    2.0 introduced a big shader refactor, using subgraphs and adding more PBR features. We also used that opportunity to tweak some shader features, because the 1.3 version of our shader was known to be too contrasted. At that point, I would suggest you to take a look at our shadergraphs (and especially the albedo subgraph - Assets/Shaders/SubGraphs/ReflectAlbedo) and play with their nodes. For example, you might want to try and get rid of the GammaToLinear nodes, which constitute our contrast correction.. ?

    Hope that helps !
    Guillaume
     
  5. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    I'm sorry @GSingland , I wasn't clear on that. So what I wanted to say is that the shader changes (the overall grey-ish look) are applied to our version of the viewer with the exception of the objects sharpness (sharp, visible objects and object outlines) - which is basically the only problem I'm facing right now.

    I played around with the nodes at the SubGraph you suggested, and I also got rid of the GammaToLinear nodes, but when I did that, I just got the same look we had before updating the shaders to the latest ones. BUT, in the process I noticed one thing that is different between our custom viewer and the latest viewer and that is the GammaToLinear subgraph itself. I basically copied the same subgraphs and pasted them into our reflect project, and the subgraphs are overall the same (same setup, same color previews) except the GammaToLinear: tolinearbad.PNG tolineargood.PNG

    As you can see, the subgraph setup is same, but the 'Main Preview' is noticeably different. (first picture is from our custom viewer and the second one is the latest) Any thoughts on this? Could this be the issue? How could I change the output to match the original?
     
  6. GSingland

    GSingland

    Unity Technologies

    Joined:
    Dec 10, 2020
    Posts:
    14
    Hi,

    This is actually a great clue !
    I believe the issue is the color space your project is in ; our viewer is set to Linear space, while yours seems to be in Gamma Space.
    You can switch this setting in the project settings (Edit/Project Settings/Player, Color Space property in the Rendering category).

    How does your rendering look after you change this setting ?

    Guillaume
     
    opacicpetar96 likes this.
  7. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    Hi @GSingland !
    You were right, our project was in Gamma Space, and I changed it to Linear space. Now the colors look correct on subgraphs and the overall look is definitely getting there. But some issues still prevail, mainly, I noticed that the darker parts are not dark enough in our version:
    latestviewer.PNG ourviewernow.PNG

    The first picture is the latest viewer and the second is our. You can still see the difference between the two, But I think that now the only problem is the 'dark side' of objects. They should be darker like on first picture. We are definitely on the right track tho. :)
     
  8. GSingland

    GSingland

    Unity Technologies

    Joined:
    Dec 10, 2020
    Posts:
    14
    Hi,

    Glad to see that your rendering is improving !
    Regarding the lack of darkness, that is probably related to lighting. I think I managed to reproduce your issue on my end, so here's my attempt of a suggestion :
    • Open the Lighting settings window (Window/Rendering/Lighting Settings)
    • Take a look at the Environment Lighting parameter, and try to reproduce the following gradient :
    lighting.PNG

    Using a gradient as the source, instead of a simple color, helps improve the lighting and depth of your scene. Note that using a skybox should be even better, but our current skybox is unfortunately not (yet ?) optimized for environment lighting.

    I hope that helps ! :)
    Guillaume
     
    opacicpetar96 likes this.
  9. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    Hey @GSingland,

    I changed the gradient as you suggested, and it solved the problem! The rendering is now finally the same as on the latest reflect viewer! :)

    The Lighting was already on gradient but all the 3 colors (Sky, Equator, Ground) had the same white color, so that was the issue.. I would never thought of this. :)

    Thank you so much for your time and help!
    Pete
     
  10. acandael

    acandael

    Joined:
    Apr 7, 2021
    Posts:
    74
    Hello,

    I'm having issues with surfaces not casting shadows. I'm using Unity 2020.3.6f1 along with Reflect Develop latest version, and I have some realtime spot lights for which the "Cast Shadows" option is 'On', but I got no shadow.
    What I observe is that if I change the material's shader of the object supposed to cast a shadow, from URPOpaque to let's say Standard, then the shadow appears..

    How can I modify the URPOpaque shader in order to get shadows? Or what other way could I get shadows?
    @GSingland can you give advice?

    Thanks a lot!