Skip to content

Commit eeb7e11

Browse files
Fix Generates Include command issue with Physically Based Sky (#908)
* Split GenerateHLSL code from PhysicallyBasedSkyRenderer in a separate file to fix Generator Includes tool * Update ShaderVariablesPhysicallyBasedSky.cs.hlsl
1 parent a4e44a8 commit eeb7e11

File tree

6 files changed

+74
-60
lines changed

6 files changed

+74
-60
lines changed

com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyCommon.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/VolumeRendering.hlsl"
77
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl"
88
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.hlsl"
9-
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs.hlsl"
9+
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/ShaderVariablesPhysicallyBasedSky.cs.hlsl"
1010

1111
TEXTURE2D(_GroundIrradianceTexture);
1212

com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -286,60 +286,6 @@ public bool Update(BuiltinSkyParameters builtinParams, PhysicallyBasedSky pbrSky
286286
}
287287
}
288288

289-
[GenerateHLSL]
290-
public enum PbrSkyConfig
291-
{
292-
// Tiny
293-
GroundIrradianceTableSize = 256, // <N, L>
294-
295-
// 32 MiB
296-
InScatteredRadianceTableSizeX = 128, // <N, V>
297-
InScatteredRadianceTableSizeY = 32, // height
298-
InScatteredRadianceTableSizeZ = 16, // AzimuthAngle(L) w.r.t. the view vector
299-
InScatteredRadianceTableSizeW = 64, // <N, L>,
300-
}
301-
302-
[GenerateHLSL(needAccessors = false, generateCBuffer = true, constantRegister = (int)ConstantRegister.PBRSky)]
303-
unsafe struct ShaderVariablesPhysicallyBasedSky
304-
{
305-
// All the distance-related entries use SI units (meter, 1/meter, etc).
306-
public float _PlanetaryRadius;
307-
public float _RcpPlanetaryRadius;
308-
public float _AtmosphericDepth;
309-
public float _RcpAtmosphericDepth;
310-
311-
public float _AtmosphericRadius;
312-
public float _AerosolAnisotropy;
313-
public float _AerosolPhasePartConstant;
314-
public float _Unused;
315-
316-
public float _AirDensityFalloff;
317-
public float _AirScaleHeight;
318-
public float _AerosolDensityFalloff;
319-
public float _AerosolScaleHeight;
320-
321-
public Vector3 _AirSeaLevelExtinction;
322-
public float _AerosolSeaLevelExtinction;
323-
324-
public Vector3 _AirSeaLevelScattering;
325-
public float _IntensityMultiplier;
326-
327-
public Vector3 _AerosolSeaLevelScattering;
328-
public float _ColorSaturation;
329-
330-
public Vector3 _GroundAlbedo;
331-
public float _AlphaSaturation;
332-
333-
public Vector3 _PlanetCenterPosition; // Not used during the precomputation, but needed to apply the atmospheric effect
334-
public float _AlphaMultiplier;
335-
336-
public Vector3 _HorizonTint;
337-
public float _HorizonZenithShiftPower;
338-
339-
public Vector3 _ZenithTint;
340-
public float _HorizonZenithShiftScale;
341-
}
342-
343289
// Store the hash of the parameters each time precomputation is done.
344290
// If the hash does not match, we must recompute our data.
345291
int m_LastPrecomputationParamHash;
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace UnityEngine.Rendering.HighDefinition
2+
{
3+
[GenerateHLSL]
4+
public enum PbrSkyConfig
5+
{
6+
// Tiny
7+
GroundIrradianceTableSize = 256, // <N, L>
8+
9+
// 32 MiB
10+
InScatteredRadianceTableSizeX = 128, // <N, V>
11+
InScatteredRadianceTableSizeY = 32, // height
12+
InScatteredRadianceTableSizeZ = 16, // AzimuthAngle(L) w.r.t. the view vector
13+
InScatteredRadianceTableSizeW = 64, // <N, L>,
14+
}
15+
16+
[GenerateHLSL(needAccessors = false, generateCBuffer = true, constantRegister = (int)ConstantRegister.PBRSky)]
17+
unsafe struct ShaderVariablesPhysicallyBasedSky
18+
{
19+
// All the distance-related entries use SI units (meter, 1/meter, etc).
20+
public float _PlanetaryRadius;
21+
public float _RcpPlanetaryRadius;
22+
public float _AtmosphericDepth;
23+
public float _RcpAtmosphericDepth;
24+
25+
public float _AtmosphericRadius;
26+
public float _AerosolAnisotropy;
27+
public float _AerosolPhasePartConstant;
28+
public float _Unused;
29+
30+
public float _AirDensityFalloff;
31+
public float _AirScaleHeight;
32+
public float _AerosolDensityFalloff;
33+
public float _AerosolScaleHeight;
34+
35+
public Vector3 _AirSeaLevelExtinction;
36+
public float _AerosolSeaLevelExtinction;
37+
38+
public Vector3 _AirSeaLevelScattering;
39+
public float _IntensityMultiplier;
40+
41+
public Vector3 _AerosolSeaLevelScattering;
42+
public float _ColorSaturation;
43+
44+
public Vector3 _GroundAlbedo;
45+
public float _AlphaSaturation;
46+
47+
public Vector3 _PlanetCenterPosition; // Not used during the precomputation, but needed to apply the atmospheric effect
48+
public float _AlphaMultiplier;
49+
50+
public Vector3 _HorizonTint;
51+
public float _HorizonZenithShiftPower;
52+
53+
public Vector3 _ZenithTint;
54+
public float _HorizonZenithShiftScale;
55+
}
56+
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
// This file was automatically generated. Please don't edit by hand.
33
//
44

5-
#ifndef PHYSICALLYBASEDSKYRENDERER_CS_HLSL
6-
#define PHYSICALLYBASEDSKYRENDERER_CS_HLSL
5+
#ifndef SHADERVARIABLESPHYSICALLYBASEDSKY_CS_HLSL
6+
#define SHADERVARIABLESPHYSICALLYBASEDSKY_CS_HLSL
77
//
8-
// UnityEngine.Rendering.HighDefinition.PhysicallyBasedSkyRenderer+PbrSkyConfig: static fields
8+
// UnityEngine.Rendering.HighDefinition.PbrSkyConfig: static fields
99
//
1010
#define PBRSKYCONFIG_GROUND_IRRADIANCE_TABLE_SIZE (256)
1111
#define PBRSKYCONFIG_IN_SCATTERED_RADIANCE_TABLE_SIZE_X (128)
1212
#define PBRSKYCONFIG_IN_SCATTERED_RADIANCE_TABLE_SIZE_Y (32)
1313
#define PBRSKYCONFIG_IN_SCATTERED_RADIANCE_TABLE_SIZE_Z (16)
1414
#define PBRSKYCONFIG_IN_SCATTERED_RADIANCE_TABLE_SIZE_W (64)
1515

16-
// Generated from UnityEngine.Rendering.HighDefinition.PhysicallyBasedSkyRenderer+ShaderVariablesPhysicallyBasedSky
16+
// Generated from UnityEngine.Rendering.HighDefinition.ShaderVariablesPhysicallyBasedSky
1717
// PackingRules = Exact
1818
GLOBAL_CBUFFER_START(ShaderVariablesPhysicallyBasedSky, b2)
1919
float _PlanetaryRadius;
Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/ShaderVariablesPhysicallyBasedSky.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)