Skip to content

Commit

Permalink
Fix error on older Unity version due to missing multi_compile support…
Browse files Browse the repository at this point in the history
… in compute shader
mlavik1 committed Apr 21, 2024
1 parent 86203c2 commit ac87120
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Assets/Scripts/Lighting/ShadowVolumeManager.cs
Original file line number Diff line number Diff line change
@@ -157,10 +157,12 @@ private void ConfigureCompute()

Texture3D dataTexture = dataset.GetDataTexture();

#if UNITY_2020_2_OR_NEWER
if (volumeRenderedObject.GetCubicInterpolationEnabled())
shadowVolumeShader.EnableKeyword("CUBIC_INTERPOLATION_ON");
else
shadowVolumeShader.DisableKeyword("CUBIC_INTERPOLATION_ON");
#endif

shadowVolumeShader.SetVector("_TextureSize", new Vector3(dataset.dimX, dataset.dimY, dataset.dimZ));
shadowVolumeShader.SetInts("_Dimension", new int[] { shadowVolumeTexture.width, shadowVolumeTexture.height, shadowVolumeTexture.volumeDepth });
@@ -173,6 +175,7 @@ private void ConfigureCompute()
shadowVolumeShader.SetFloat("_MinVal", volRendMaterial.GetFloat("_MinVal"));
shadowVolumeShader.SetFloat("_MaxVal", volRendMaterial.GetFloat("_MaxVal"));

#if UNITY_2020_2_OR_NEWER
if (volRendMaterial.IsKeywordEnabled("CROSS_SECTION_ON"))
{
shadowVolumeShader.EnableKeyword("CROSS_SECTION_ON");
@@ -184,6 +187,7 @@ private void ConfigureCompute()
{
shadowVolumeShader.DisableKeyword("CROSS_SECTION_ON");
}
#endif
if (volumeRenderedObject != null)
{
volumeRenderedObject.meshRenderer.sharedMaterial.EnableKeyword("SHADOWS_ON");

0 comments on commit ac87120

Please sign in to comment.