Search Unity

Resolved Shadow Pass Problem

Discussion in 'General Graphics' started by Danistmein, May 16, 2021.

  1. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    Hi, I'm doing vertex animation in a shader, and I write a shadow pass in this shader. but I faced a problem that the shadows disappeared at the specific camera distance. I have tunning the vertex and normal positions, but these not work. are there any situations that I have not to consider? I have no idea about that, need some help:(:(

    disappeared shadows in the red box. (In order to debug, I add Y offset to the shadow vertex)
    upload_2021-5-17_6-2-1.png

    When I move the camera a little bit. shadows come back.
    upload_2021-5-17_6-2-40.png


    Code (CSharp):
    1. Shader "GPU/ToonOutLine"
    2. {
    3.     Properties
    4.     {
    5.         _ToonShade("ToonShader Cubemap(RGB)", CUBE) = "" { }
    6.  
    7.         _Color("Color", Color) = (1,1,1,1)
    8.         _MainTex("Albedo", 2D) = "white" {}
    9.  
    10.         _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
    11.  
    12.         _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
    13.         _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
    14.         [Enum(Metallic Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0
    15.  
    16.         [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
    17.         _MetallicGlossMap("Metallic", 2D) = "white" {}
    18.  
    19.         [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
    20.         [ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 1.0
    21.  
    22.         _BumpScale("Scale", Float) = 1.0
    23.         _BumpMap("Normal Map", 2D) = "bump" {}
    24.  
    25.         _Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02
    26.         _ParallaxMap ("Height Map", 2D) = "black" {}
    27.  
    28.         _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
    29.         _OcclusionMap("Occlusion", 2D) = "white" {}
    30.  
    31.         _EmissionColor("Color", Color) = (0,0,0)
    32.         _EmissionMap("Emission", 2D) = "white" {}
    33.  
    34.         _DetailMask("Detail Mask", 2D) = "white" {}
    35.  
    36.         _DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}
    37.         _DetailNormalMapScale("Scale", Float) = 1.0
    38.         _DetailNormalMap("Normal Map", 2D) = "bump" {}
    39.  
    40.         _TranslationTexture    ("Translation", 2D) = "white"{}
    41.         _RotationTexture    ("Rotation", 2D) = "white"{}
    42.  
    43.         [Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
    44.  
    45.  
    46.         // Blending state
    47.         [HideInInspector] _Mode ("__mode", Float) = 0.0
    48.         [HideInInspector] _SrcBlend ("__src", Float) = 1.0
    49.         [HideInInspector] _DstBlend ("__dst", Float) = 0.0
    50.         [HideInInspector] _ZWrite ("__zw", Float) = 1.0
    51.     }
    52.  
    53.     CGINCLUDE
    54.         #define UNITY_SETUP_BRDF_INPUT MetallicSetup
    55.     ENDCG
    56.  
    57.     SubShader
    58.     {
    59.         Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
    60.         ////Cull off
    61.         ////ZWrite On
    62.         ////ZTest LEqual
    63.         ////Cull Front
    64.         ////LOD 2000
    65.  
    66.         // ------------------------------------------------------------------
    67.         //  Deferred pass
    68.         Pass
    69.         {
    70.             Name "DEFERRED"
    71.             Tags { "LightMode" = "ForwardBase" }
    72.             ////Tags { "LightMode" = "Deferred" }
    73.             ////ZTest On
    74.  
    75.             CGPROGRAM
    76.             #pragma target 3.0
    77.             #pragma exclude_renderers nomrt
    78.  
    79.  
    80.             #pragma multi_compile_prepassfinal
    81.             #pragma multi_compile_instancing
    82.             // Uncomment the following line to enable dithering LOD crossfade. Note: there are more in the file to uncomment for other passes.
    83.             //#pragma multi_compile _ LOD_FADE_CROSSFADE
    84.  
    85.             #pragma vertex vert
    86.             #pragma fragment frag
    87.  
    88.             #pragma instancing_options procedural:setup
    89.  
    90.             #include "UnityStandardCore.cginc"
    91.             samplerCUBE _ToonShade;
    92.             sampler2D _AnimationTexture0;
    93.             sampler2D _AnimationTexture1;
    94.             sampler2D _AnimationTexture2;
    95.            
    96. #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
    97.             //StructuredBuffer<float4x4> objectToWorldBuffer;
    98.             StructuredBuffer<float4> objectPositionsBuffer;
    99.             StructuredBuffer<float4> objectRotationsBuffer;
    100.             StructuredBuffer<float3> textureCoordinatesBuffer;
    101. #endif
    102.            
    103.            
    104.             //@TODO: use 4x3 matrix
    105.             inline float4x4 CreateMatrix(float texturePosition, float boneId)
    106.             {
    107.                 float4 row0 = tex2Dlod(_AnimationTexture0, float4(texturePosition, boneId, 0, 0));
    108.                 float4 row1 = tex2Dlod(_AnimationTexture1, float4(texturePosition, boneId, 0, 0));
    109.                 float4 row2 = tex2Dlod(_AnimationTexture2, float4(texturePosition, boneId, 0, 0));
    110.            
    111.                 float4x4 reconstructedMatrix = float4x4(row0, row1, row2, float4(0, 0, 0, 1));
    112.            
    113.                 return reconstructedMatrix;
    114.             }
    115.            
    116.             inline float4x4 CalculateSkinMatrix(float3 animationTextureCoords, float2 boneIds, float2 boneInfluences)
    117.             {
    118.                 // We interpolate between two matrices
    119.                 float4x4 frame0_BoneMatrix0 = CreateMatrix(animationTextureCoords.x, boneIds.x);
    120.                 float4x4 frame0_BoneMatrix1 = CreateMatrix(animationTextureCoords.y, boneIds.x);
    121.                 float4x4 frame0_BoneMatrix = frame0_BoneMatrix0 * (1 - animationTextureCoords.z) + frame0_BoneMatrix1 * animationTextureCoords.z;
    122.            
    123.                 float4x4 frame1_BoneMatrix0 = CreateMatrix(animationTextureCoords.x, boneIds.y);
    124.                 float4x4 frame1_BoneMatrix1 = CreateMatrix(animationTextureCoords.y, boneIds.y);
    125.                 float4x4 frame1_BoneMatrix = frame1_BoneMatrix0 * (1 - animationTextureCoords.z) + frame1_BoneMatrix1 * animationTextureCoords.z;
    126.            
    127.                 return frame0_BoneMatrix * boneInfluences.x + frame1_BoneMatrix * boneInfluences.y;
    128.             }
    129.  
    130.  
    131.             void setup()
    132.             {
    133.     #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
    134.                 //unity_ObjectToWorld = objectToWorldBuffer[unity_InstanceID];
    135.                 //unity_WorldToObject = unity_ObjectToWorld;
    136.  
    137.                 // Construct an identity matrix
    138.                 unity_ObjectToWorld = float4x4(1, 0, 0, 0,
    139.                     0, 1, 0, 0,
    140.                     0, 0, 1, 0,
    141.                     0, 0, 0, 1);
    142.                 unity_WorldToObject = unity_ObjectToWorld;
    143.  
    144.                 unity_WorldToObject._14_24_34 *= -1;
    145.                 unity_WorldToObject._11_22_33 = 1.0f / unity_WorldToObject._11_22_33;
    146.     #endif
    147.             }
    148.  
    149.             struct VertexInputSkinning
    150.             {
    151.             float4 vertex   : POSITION;
    152.             half3 normal    : NORMAL;
    153.             float2 uv0      : TEXCOORD0;
    154.             float2 boneIds  : TEXCOORD1;
    155.             float2 boneInfluences : TEXCOORD2;
    156. #ifdef _TANGENT_TO_WORLD
    157.             half4 tangent   : TANGENT;
    158. #endif
    159.  
    160.             UNITY_VERTEX_INPUT_INSTANCE_ID
    161.             };
    162.  
    163.             struct v2f
    164.             {
    165.                 UNITY_POSITION(pos);
    166.                 float4 tex                            : TEXCOORD3;
    167.                 float3 eyeVec                         : TEXCOORD4;
    168.                 ////float4 tangentToWorldAndPackedData[3] : TEXCOORD2;    // [3x3:tangentToWorld | 1x3:viewDirForParallax or worldPos]
    169.                 ////half4 ambientOrLightmapUV             : TEXCOORD5;    // SH or Lightmap UVs
    170.                 float3 cubenormal                      : TEXCOORD5;
    171.                 fixed4 diff : COLOR0; // diffuse lighting color
    172.                 float3 normalWorld                         :TEXCOORD6;
    173.             };
    174.  
    175.  
    176.             float4 TexCoordsSkin(VertexInputSkinning v)
    177.             {
    178.                 float4 texcoord;
    179.                 texcoord.xy = TRANSFORM_TEX(v.uv0, _MainTex); // Always source from uv0
    180.                 texcoord.zw = TRANSFORM_TEX(((_UVSec == 0) ? v.uv0 : v.boneIds), _DetailAlbedoMap);
    181.                 return texcoord;
    182.             }
    183.  
    184.             inline float4 QuaternionMul(float4 v, float4 q)
    185.             {
    186.                 v = float4(v + 2 * cross(q.xyz, cross(q.xyz, v.xyz) + q.w * v), v.w);
    187.                 return v;
    188.             }
    189.  
    190.             v2f vert(VertexInputSkinning v)
    191.             {
    192.                 UNITY_SETUP_INSTANCE_ID(v);
    193.                 v2f o;
    194.                 UNITY_INITIALIZE_OUTPUT(v2f, o);
    195.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    196.  
    197.     #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
    198.                 //unity_InstanceID  is the acutal Instance ID after UNITY_SETUP_INSTANCE_ID is called
    199.                 float3 animationTextureCoords = textureCoordinatesBuffer[unity_InstanceID];
    200.  
    201.                 float4x4 firstBoneMatrix0 = CreateMatrix(animationTextureCoords.x, v.boneIds.x);
    202.                 float4x4 firstBoneMatrix1 = CreateMatrix(animationTextureCoords.y, v.boneIds.x);
    203.                 float4x4 firstBoneMatrix = firstBoneMatrix0 * (1 - animationTextureCoords.z) + firstBoneMatrix1 * animationTextureCoords.z;
    204.  
    205.                 float4x4 secondBoneMatrix0 = CreateMatrix(animationTextureCoords.x, v.boneIds.y);
    206.                 float4x4 secondBoneMatrix1 = CreateMatrix(animationTextureCoords.y, v.boneIds.y);
    207.                 float4x4 secondBoneMatrix = secondBoneMatrix0 * (1 - animationTextureCoords.z) + secondBoneMatrix1 * animationTextureCoords.z;
    208.  
    209.                 float4x4 combinedMatrix = firstBoneMatrix * v.boneInfluences.x + secondBoneMatrix * v.boneInfluences.y;
    210.                                 float4 skinnedVertex = mul(combinedMatrix, v.vertex);
    211.                    
    212.                 skinnedVertex *= objectPositionsBuffer[unity_InstanceID].w;
    213.                 float4 posWorld = QuaternionMul(skinnedVertex, objectRotationsBuffer[unity_InstanceID]);
    214.                 posWorld.xyz = posWorld + objectPositionsBuffer[unity_InstanceID].xyz;
    215.  
    216.                 //The output of the vertex shader is a vertex position in clip space ( that's what UnityObjectToClipPos(v.vertex); does ).
    217.                 o.pos = UnityObjectToClipPos(posWorld);
    218.  
    219.                 o.tex = TexCoordsSkin(v);
    220.                 o.eyeVec = NormalizePerVertexNormal(posWorld.xyz - _WorldSpaceCameraPos);
    221.  
    222.                 float3 normalSkinningRotated = mul(combinedMatrix, float4(v.normal.xyz, 0));
    223.  
    224.                 ////o.normalWorld = QuaternionMul(float4(normalSkinningRotated, 1), objectRotationsBuffer[unity_InstanceID]);
    225.                 o.normalWorld = mul(unity_WorldToObject, float4(posWorld.xyz, 1));
    226.                 v.normal = o.normalWorld;
    227.                 ////o.normalWorld = normalSkinningRotated;
    228.  
    229.  
    230.                 ////o.pos = mul(unity_WorldToObject, float4(posWorld.xyz, 1)) + float4(0, 5, 0, 0);
    231.                 ////v.vertex = o.pos;
    232.     #else
    233.  
    234.                 float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
    235.                 o.pos = UnityObjectToClipPos(v.vertex);
    236.  
    237.                 o.tex = TexCoordsSkin(v);
    238.                 o.eyeVec = NormalizePerVertexNormal(posWorld.xyz - _WorldSpaceCameraPos);
    239.                 float3 normalWorld = UnityObjectToWorldNormal(v.normal);
    240.  
    241.  
    242.                 ////o.ambientOrLightmapUV = 0;
    243.  
    244.     #endif
    245.                 half nl = max(0, dot(o.normalWorld, _WorldSpaceLightPos0.xyz));
    246.                 // factor in the light color
    247.                 o.diff = nl * _LightColor0;
    248.  
    249.                 //// the only difference from previous shader:
    250.                 //// in addition to the diffuse lighting from the main light,
    251.                 //// add illumination from ambient or light probes
    252.                 //// ShadeSH9 function from UnityCG.cginc evaluates it,
    253.                 //// using world space normal
    254.                 o.diff.rgb += ShadeSH9(half4(o.normalWorld, 1));
    255.  
    256.                 UNITY_TRANSFER_FOG(o, o.pos);
    257.                 return o;
    258.             }
    259.  
    260.             fixed4 frag(v2f i) : SV_Target
    261.             {
    262.                 fixed4 col = _Color * tex2D(_MainTex, i.tex);
    263.                 fixed4 cube = texCUBE(_ToonShade, i.cubenormal);
    264.                 fixed4 c = fixed4(2.0f * cube.rgb * col.rgb, col.a);
    265.                 ////fixed4 c = col;
    266.                 ////c *= _Intensity;
    267.                 ////c = float4(1, 1, 1, 1)
    268.                 ////c *= i.diff;
    269.                 UNITY_APPLY_FOG(i.fogCoord, c);
    270.                 ////fixed4 c = float4(i.normalWorld, 1);
    271.                 return c;
    272.                 ////return float4(i.normalWorld.x, i.normalWorld.y, i.normalWorld.z, 1);
    273.             }
    274.  
    275.  
    276.             ENDCG
    277.         }
    278.  
    279.         // Shadow Caster Pass
    280.         Pass
    281.         {
    282.             Tags { "LightMode" = "ShadowCaster" }
    283.        
    284.             CGPROGRAM
    285.             #include "UnityCG.cginc"
    286.  
    287.             #pragma multi_compile_shadowcaster
    288.             #pragma multi_compile_instancing // allow instanced shadow pass for most of the shaders
    289.  
    290.  
    291.             ////#pragma multi_compile_prepassfinal
    292.             #pragma vertex vert
    293.             #pragma fragment frag
    294.             #pragma instancing_options procedural:setup
    295.  
    296.             samplerCUBE _ToonShade;
    297.             sampler2D _AnimationTexture0;
    298.             sampler2D _AnimationTexture1;
    299.             sampler2D _AnimationTexture2;
    300.            
    301. #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
    302.             //StructuredBuffer<float4x4> objectToWorldBuffer;
    303.             StructuredBuffer<float4> objectPositionsBuffer;
    304.             StructuredBuffer<float4> objectRotationsBuffer;
    305.             StructuredBuffer<float3> textureCoordinatesBuffer;
    306. #endif
    307.            
    308.             //@TODO: Use vertex skinning node
    309.  
    310.             struct VertexInputSkinning
    311.             {
    312.                 float4 vertex   : POSITION;
    313.                 half3 normal    : NORMAL;
    314.                 float2 uv0      : TEXCOORD0;
    315.                 float2 boneIds  : TEXCOORD1;
    316.                 float2 boneInfluences : TEXCOORD2;
    317.  
    318.                 UNITY_VERTEX_INPUT_INSTANCE_ID
    319.             };
    320.  
    321.             struct v2f
    322.             {
    323.                 V2F_SHADOW_CASTER;
    324.                 UNITY_VERTEX_OUTPUT_STEREO
    325.             };
    326.            
    327.             //@TODO: use 4x3 matrix
    328.             inline float4x4 CreateMatrix(float texturePosition, float boneId)
    329.             {
    330.                 float4 row0 = tex2Dlod(_AnimationTexture0, float4(texturePosition, boneId, 0, 0));
    331.                 float4 row1 = tex2Dlod(_AnimationTexture1, float4(texturePosition, boneId, 0, 0));
    332.                 float4 row2 = tex2Dlod(_AnimationTexture2, float4(texturePosition, boneId, 0, 0));
    333.            
    334.                 float4x4 reconstructedMatrix = float4x4(row0, row1, row2, float4(0, 0, 0, 1));
    335.            
    336.                 return reconstructedMatrix;
    337.             }
    338.            
    339.             inline float4x4 CalculateSkinMatrix(float3 animationTextureCoords, float2 boneIds, float2 boneInfluences)
    340.             {
    341.                 // We interpolate between two matrices
    342.                 float4x4 frame0_BoneMatrix0 = CreateMatrix(animationTextureCoords.x, boneIds.x);
    343.                 float4x4 frame0_BoneMatrix1 = CreateMatrix(animationTextureCoords.y, boneIds.x);
    344.                 float4x4 frame0_BoneMatrix = frame0_BoneMatrix0 * (1 - animationTextureCoords.z) + frame0_BoneMatrix1 * animationTextureCoords.z;
    345.            
    346.                 float4x4 frame1_BoneMatrix0 = CreateMatrix(animationTextureCoords.x, boneIds.y);
    347.                 float4x4 frame1_BoneMatrix1 = CreateMatrix(animationTextureCoords.y, boneIds.y);
    348.                 float4x4 frame1_BoneMatrix = frame1_BoneMatrix0 * (1 - animationTextureCoords.z) + frame1_BoneMatrix1 * animationTextureCoords.z;
    349.            
    350.                 return frame0_BoneMatrix * boneInfluences.x + frame1_BoneMatrix * boneInfluences.y;
    351.             }
    352.  
    353.  
    354.             void setup()
    355.             {
    356.     #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
    357.                 //unity_ObjectToWorld = objectToWorldBuffer[unity_InstanceID];
    358.                 //unity_WorldToObject = unity_ObjectToWorld;
    359.  
    360.                 // Construct an identity matrix
    361.                 unity_ObjectToWorld = float4x4(1, 0, 0, 0,
    362.                     0, 1, 0, 0,
    363.                     0, 0, 1, 0,
    364.                     0, 0, 0, 1);
    365.                 unity_WorldToObject = unity_ObjectToWorld;
    366.  
    367.                 unity_WorldToObject._14_24_34 *= -1;
    368.                 unity_WorldToObject._11_22_33 = 1.0f / unity_WorldToObject._11_22_33;
    369.     #endif
    370.             }
    371.  
    372.  
    373.             inline float4 QuaternionMul(float4 v, float4 q)
    374.             {
    375.                 v = float4(v + 2 * cross(q.xyz, cross(q.xyz, v.xyz) + q.w * v), v.w);
    376.                 return v;
    377.             }
    378.  
    379.             v2f vert(VertexInputSkinning v)
    380.             {
    381.                 UNITY_SETUP_INSTANCE_ID(v);
    382.                 v2f o;
    383.                 UNITY_INITIALIZE_OUTPUT(v2f, o);
    384.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    385.  
    386.     #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
    387.                 //unity_InstanceID  is the acutal Instance ID after UNITY_SETUP_INSTANCE_ID is called
    388.                 float3 animationTextureCoords = textureCoordinatesBuffer[unity_InstanceID];
    389.  
    390.                 float4x4 firstBoneMatrix0 = CreateMatrix(animationTextureCoords.x, v.boneIds.x);
    391.                 float4x4 firstBoneMatrix1 = CreateMatrix(animationTextureCoords.y, v.boneIds.x);
    392.                 float4x4 firstBoneMatrix = firstBoneMatrix0 * (1 - animationTextureCoords.z) + firstBoneMatrix1 * animationTextureCoords.z;
    393.  
    394.                 float4x4 secondBoneMatrix0 = CreateMatrix(animationTextureCoords.x, v.boneIds.y);
    395.                 float4x4 secondBoneMatrix1 = CreateMatrix(animationTextureCoords.y, v.boneIds.y);
    396.                 float4x4 secondBoneMatrix = secondBoneMatrix0 * (1 - animationTextureCoords.z) + secondBoneMatrix1 * animationTextureCoords.z;
    397.  
    398.                 float4x4 combinedMatrix = firstBoneMatrix * v.boneInfluences.x + secondBoneMatrix * v.boneInfluences.y;
    399.                                 float4 skinnedVertex = mul(combinedMatrix, v.vertex);
    400.                    
    401.                 skinnedVertex *= objectPositionsBuffer[unity_InstanceID].w;
    402.                 float4 pos = QuaternionMul(skinnedVertex, objectRotationsBuffer[unity_InstanceID]);
    403.                 float4 posWorld = pos;
    404.                 posWorld.xyz = pos + objectPositionsBuffer[unity_InstanceID].xyz;
    405.  
    406.                 float3 normalSkinningRotated = mul(combinedMatrix, float4(v.normal.xyz, 0));
    407.  
    408.                 v.normal = QuaternionMul(float4(normalSkinningRotated, 1), objectRotationsBuffer[unity_InstanceID]);
    409.  
    410.                 v.vertex = mul(unity_WorldToObject, float4(posWorld.xyz, 1)) + float4(0, 5, 0, 0);
    411.     #else
    412.  
    413.                 ////float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
    414.                 ////v.vertex = UnityObjectToClipPos(v.vertex);
    415.  
    416.                 ////v.normal = UnityObjectToWorldNormal(v.normal);
    417.     #endif
    418.                 TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
    419.                 return o;
    420.             }
    421.  
    422.             fixed4 frag(v2f i) : SV_Target
    423.             {
    424.                 SHADOW_CASTER_FRAGMENT(i)
    425.                 return fixed4(1, 1, 1, 1);
    426.             }
    427.             ENDCG
    428.         }
    429.  
    430.  
    431.     }
    432.  
    433.     FallBack "Diffuse"
    434.     ////CustomEditor "StandardShaderGUI"
    435. }
    436.  
     

    Attached Files:

  2. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    is the calculated vertex wrong?
     
  3. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    I don't know why the parts of shadows disappeared.
     
  4. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    I found the some of the objects don't put data into the shadow map.
    upload_2021-5-17_7-51-8.png
    upload_2021-5-17_7-51-45.png
     
  5. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    these non-shadow objects vertices rendered correctly.
    upload_2021-5-17_8-4-43.png
     
  6. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    ok, I have fixed this problem
     
  7. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    if anyone faced the same problem, let me know. I am very to share it
     
  8. davidcm_aby

    davidcm_aby

    Joined:
    Aug 23, 2018
    Posts:
    3
    I think I'm having a similar problem. My guess as of now is it has something to do with instancing + shadowpass + texture lookup in vertex shader. Could you give a clue about your solution, please? Thanks :)
     
  9. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    Hi this is because of the "shared texture" between the different LOD levels. You can try Instantiating new texture for every LOD Material used in GPU Instancing Drawer.
     
  10. davidcm_aby

    davidcm_aby

    Joined:
    Aug 23, 2018
    Posts:
    3
    Oh ok, then it's not related to my issue. I'm not using LODs.