Unity

[Tip] Unity Chan URP 셰이더 에러 수정

브랑제리 2021. 10. 30. 14:30

https://unity-chan.com/download/releaseNote.php?id=ssu_urp&lang=en

URP 버전의 유니티 짱 프로젝트를 열면 아래의 유니티 버전에 따라 오류가 나오는 것을 확인할 수 있습니다.

 

Shader error in 'Universal Render Pipeline/Toon': 'InitializeStandardLitSurfaceDataUTS': output parameter 'outSurfaceData' not completely initialized at /Users/siyan/Downloads/UnityChanSSU_URP-release-1.0.1/UnityChanSSU_URP/Packages/UnityChanToonShaderVer2_Project-release-urp-2.2/Runtime/Shaders/UniversalToonBody.hlsl(199) (on d3d11)

Compiling Fragment program with _EMISSIVE_SIMPLE _ENVIRONMENTREFLECTIONS_OFF _IS_ANGELRING_OFF _IS_CLIPPING_OFF _IS_PASS_FWDBASE _IS_TRANSCLIPPING_OFF
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: DIRLIGHTMAP_COMBINED FOG_EXP FOG_EXP2 FOG_LINEAR LIGHTMAP_ON SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_VIRTUAL_TEXTURING UTS_USE_RAYTRACING_SHADOW _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHT_SHADOWS _ALPHAPREMULTIPLY_ON _ALPHATEST_ON _EMISSION _EMISSIVE_ANIMATION _IS_ANGELRING_ON _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE _IS_TRANSCLIPPING_ON _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _METALLICSPECGLOSSMAP _MIXED_LIGHTING_SUBTRACTIVE _NORMALMAP _OCCLUSIONMAP _RECEIVE_SHADOWS_OFF _SHADINGGRADEMAP _SHADOWS_SOFT _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECULARHIGHLIGHTS_OFF _SPECULAR_SETUP

원인은 `UniversalToonBody.hlsl``InitializeStandardLitSurfaceDataUTS 메서드` 에서 `outSurfaceData` 이 초기화가 되지 않았다는 뜻입니다.

 

 

 

InitializeStandardLitSurfaceDataUTS 의 메서드에 초기화 로직을 추가합니다.

inline void InitializeStandardLitSurfaceDataUTS(float2 uv, out SurfaceData outSurfaceData)
{
    outSurfaceData.clearCoatMask = 0.0h;
    outSurfaceData.clearCoatSmoothness = 0.0h;

    ...
}

 

이후 제대로 나오는 것을 확인 할 수 있습니다.

반응형

'Unity' 카테고리의 다른 글

Failed to create CoreCLR, HRESULT: 0x8007000E  (0) 2022.06.11
DisallowMultipleComponent  (0) 2022.03.20
Input System #1  (0) 2021.09.30
Addressable Asset System 예제  (2) 2021.05.25
[Android] Local Notification (로컬 푸시) 구현하기  (1) 2021.05.09