Unity-Technologies / com.unity.toonshader

Unity Toon Shader ( an experimental package )
Other
1.07k stars 169 forks source link

[URP] Decal with DBuffer mode is not supported #271

Closed 2A5F closed 6 months ago

2A5F commented 1 year ago

And does not support Rendering Layers

Fabrazz commented 7 months ago

+1

Hum9183 commented 7 months ago

@H3idi-X May I create a PR?

Plans

Implementation of "URP/Lit"

H3idi-X commented 7 months ago

Hi, thanks for reports and suggestions. But, as far as, we see, the decal feature is solely for Shader Graph and UTS is not compatible with Shader Graph.

Fabrazz commented 7 months ago

Is this an issue that can be raised internally? It certainly doesn't feel normal for UTS, an official shader package by Unity, to not be compatible with a commonly used feature in URP: Decals with Rendering Layers.

Hum9183 commented 7 months ago

@H3idi-X Thanks for the quick reply! As far as I know, I am aware that URP supports Decal even for non-ShaderGraph shaders. For example, the built-in "Universal Render Pipeline/Lit". In addition, I have tried to add Decal feature to UTS in my local repository and it seems to work well. Is there a problem specific to UTS?

H3idi-X commented 7 months ago

I am sorry I did not know how to set decal with Universl Render Pipeline/Lit. Could you show me the link or something explaing how to apply decal with Universl Render Pipeline/Lit?

Hum9183 commented 7 months ago

@H3idi-X https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@14.0/manual/renderer-feature-decal.html I think you can confirm this by following this link. By the way, the environment I checked is Unity2022.3.5f1. Perhaps the version may have something to do with it.

H3idi-X commented 7 months ago

Thanks! but, the link is what I was talking about. It explains how to apply decal using Shader Graph and we haven't found ways how to apply decal without Shader Graph. So, if you know how to apply decal with Univesal Render Pipeline/Lit shader UI, could you tell me about it? We are very small team and it is hard for us to give the first priority to UTS.

Fabrazz commented 7 months ago

We're on Unity 2022 LTS as well and the way you can try this is straight out of the box:

You will see the decal render just fine. If you swap the standard lit material on the mesh with the toon shader it will not work.

H3idi-X commented 7 months ago

@Hum9183 Thank you for your proposal, it would be greatly appreciated if you could submit a PR. We are currently short of human resources for this project.

H3idi-X commented 7 months ago

Thanks for the PR!. We tested the PR and found some compilation errors when using 2020.3. Maybe we can fix them.

Hum9183 commented 7 months ago

I see! Maybe decal feature itself is not supported in 2020.3.

Hum9183 commented 7 months ago

@H3idi-X Hi! I was lightly testing with unity2021.2, I confirmed that adding ”#if UNITY_VERSION >= 202120” to ApplyDecalToSurfaceDataUTS() eliminates the error

In UniversalToonBody.hlsl

+ #if UNITY_VERSION >= 202120
    void ApplyDecalToSurfaceDataUTS(float4 positionCS, inout float3 albedo, inout SurfaceData surfaceData, inout float3 normalWS)
    {
        #ifdef _SPECULAR_SETUP
            half metallic = 0;
            ApplyDecal(positionCS,
                albedo,
                surfaceData.specular,
                normalWS,
                metallic,
                surfaceData.occlusion,
                surfaceData.smoothness);
        #else
            half3 specular = 0;
            ApplyDecal(positionCS,
                albedo,
                specular,
                normalWS,
                surfaceData.metallic,
                surfaceData.occlusion,
                surfaceData.smoothness);
        #endif
    }
+ #endif
H3idi-X commented 7 months ago

2021.2.0 looks right version when URP started to support DECAL.

H3idi-X commented 7 months ago

We merged your PR to the development branch and started preparation for releaseing the next version. Thank you very much!. @Hum9183

Hum9183 commented 7 months ago

@H3idi-X Thank you for the merge!

I see that there are other requests for implementation of a light layers in this issue, so I will create a separate new issue for the light layer issue, if that is OK with you?

H3idi-X commented 7 months ago

@Hum9183 That would be great if you submit a PR for light layers. We really appreciate for the one.

Hum9183 commented 6 months ago

@H3idi-X Now that 0.9.6 has been released, would you please close the issue if you don't mind?