Skip to content

Commit 1c9ea93

Browse files
alelievrsebastienlagarde
authored andcommitted
[HDRP] Fix static sky lighting update when render textures are updated #6863
1 parent 9904c41 commit 1c9ea93

File tree

3 files changed

+107
-2
lines changed

3 files changed

+107
-2
lines changed

com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,19 @@ public TextureParameter(Texture value, bool overrideState = false)
14471447
: base(value, overrideState) { }
14481448

14491449
// TODO: Texture interpolation
1450+
1451+
public override int GetHashCode()
1452+
{
1453+
int hash = base.GetHashCode();
1454+
1455+
unchecked
1456+
{
1457+
if (value != null)
1458+
hash = 23 * CoreUtils.GetTextureHash(value);
1459+
}
1460+
1461+
return hash;
1462+
}
14501463
}
14511464

14521465
/// <summary>
@@ -1462,6 +1475,19 @@ public class NoInterpTextureParameter : VolumeParameter<Texture>
14621475
/// <param name="overrideState">The initial override state for the parameter.</param>
14631476
public NoInterpTextureParameter(Texture value, bool overrideState = false)
14641477
: base(value, overrideState) { }
1478+
1479+
public override int GetHashCode()
1480+
{
1481+
int hash = base.GetHashCode();
1482+
1483+
unchecked
1484+
{
1485+
if (value != null)
1486+
hash = 23 * CoreUtils.GetTextureHash(value);
1487+
}
1488+
1489+
return hash;
1490+
}
14651491
}
14661492

14671493
/// <summary>
@@ -1477,6 +1503,19 @@ public class Texture2DParameter : VolumeParameter<Texture>
14771503
/// <param name="overrideState">The initial override state for the parameter.</param>
14781504
public Texture2DParameter(Texture value, bool overrideState = false)
14791505
: base(value, overrideState) { }
1506+
1507+
public override int GetHashCode()
1508+
{
1509+
int hash = base.GetHashCode();
1510+
1511+
unchecked
1512+
{
1513+
if (value != null)
1514+
hash = 23 * CoreUtils.GetTextureHash(value);
1515+
}
1516+
1517+
return hash;
1518+
}
14801519
}
14811520

14821521
/// <summary>
@@ -1492,6 +1531,19 @@ public class Texture3DParameter : VolumeParameter<Texture>
14921531
/// <param name="overrideState">The initial override state for the parameter.</param>
14931532
public Texture3DParameter(Texture value, bool overrideState = false)
14941533
: base(value, overrideState) { }
1534+
1535+
public override int GetHashCode()
1536+
{
1537+
int hash = base.GetHashCode();
1538+
1539+
unchecked
1540+
{
1541+
if (value != null)
1542+
hash = 23 * CoreUtils.GetTextureHash(value);
1543+
}
1544+
1545+
return hash;
1546+
}
14951547
}
14961548

14971549
/// <summary>
@@ -1509,6 +1561,19 @@ public RenderTextureParameter(RenderTexture value, bool overrideState = false)
15091561
: base(value, overrideState) { }
15101562

15111563
// TODO: RenderTexture interpolation
1564+
1565+
public override int GetHashCode()
1566+
{
1567+
int hash = base.GetHashCode();
1568+
1569+
unchecked
1570+
{
1571+
if (value != null)
1572+
hash = 23 * CoreUtils.GetTextureHash(value);
1573+
}
1574+
1575+
return hash;
1576+
}
15121577
}
15131578

15141579
/// <summary>
@@ -1524,6 +1589,19 @@ public class NoInterpRenderTextureParameter : VolumeParameter<RenderTexture>
15241589
/// <param name="overrideState">The initial override state for the parameter.</param>
15251590
public NoInterpRenderTextureParameter(RenderTexture value, bool overrideState = false)
15261591
: base(value, overrideState) { }
1592+
1593+
public override int GetHashCode()
1594+
{
1595+
int hash = base.GetHashCode();
1596+
1597+
unchecked
1598+
{
1599+
if (value != null)
1600+
hash = 23 * CoreUtils.GetTextureHash(value);
1601+
}
1602+
1603+
return hash;
1604+
}
15271605
}
15281606

15291607
/// <summary>
@@ -1540,6 +1618,19 @@ public class CubemapParameter : VolumeParameter<Texture>
15401618
public CubemapParameter(Texture value, bool overrideState = false)
15411619
: base(value, overrideState) { }
15421620
// TODO: Cubemap interpolation
1621+
1622+
public override int GetHashCode()
1623+
{
1624+
int hash = base.GetHashCode();
1625+
1626+
unchecked
1627+
{
1628+
if (value != null)
1629+
hash = 23 * CoreUtils.GetTextureHash(value);
1630+
}
1631+
1632+
return hash;
1633+
}
15431634
}
15441635

15451636
/// <summary>
@@ -1555,6 +1646,19 @@ public class NoInterpCubemapParameter : VolumeParameter<Cubemap>
15551646
/// <param name="overrideState">The initial override state for the parameter.</param>
15561647
public NoInterpCubemapParameter(Cubemap value, bool overrideState = false)
15571648
: base(value, overrideState) { }
1649+
1650+
public override int GetHashCode()
1651+
{
1652+
int hash = base.GetHashCode();
1653+
1654+
unchecked
1655+
{
1656+
if (value != null)
1657+
hash = 23 * CoreUtils.GetTextureHash(value);
1658+
}
1659+
1660+
return hash;
1661+
}
15581662
}
15591663

15601664
/// <summary>

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2525
- Fixed artifacts on gpu light culling when the frustum near and far are very spread out (case 1386436)
2626
- Fixed an issue where forced sky update (like PBR sky amortized updated) would not update ambient probe.
2727
- Fixed a null ref exception in Volume Explorer
28+
- Fixed static lighting sky update when using an HDRI sky with a render texture in parameter.
2829

2930
## [12.1.4] - 2021-12-07
3031

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ public override int GetHashCode()
150150
hash = hash * 23 + dirLightShadow.overrideState.GetHashCode();
151151
hash = hash * 23 + rectLightShadow.overrideState.GetHashCode();
152152
#else
153-
hash = hdriSky.value != null ? hash * 23 + hdriSky.GetHashCode() : hash;
154-
hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash;
153+
hash = hash * 23 + hdriSky.GetHashCode();
154+
hash = hash * 23 + flowmap.GetHashCode();
155155
hash = hash * 23 + distortionMode.GetHashCode();
156156
hash = hash * 23 + upperHemisphereOnly.GetHashCode();
157157
hash = hash * 23 + scrollOrientation.GetHashCode();

0 commit comments

Comments
 (0)