Skip to content

Commit

Permalink
[Backport 2023.2][HDRP] Fix clouds not affected by intensity multiplier
Browse files Browse the repository at this point in the history
Backport of #47069
  • Loading branch information
remi-chapelain authored and Evergreen committed Apr 10, 2024
1 parent a5c4e53 commit 475e9f1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ These settings define the emissive behavior of your Light. You can set the Light
| **Affect Specular** | Enable the checkbox to apply [specular](https://docs.unity3d.com/Manual/shader-NormalSpecular.html) lighting to this Light.<br />This property only appears when you enable [additional properties](expose-all-additional-properties.md) for this section. It's only available in Realtime or Mixed light **Mode**. |
| **Range Attenuation** | Enable the checkbox to make this Light shine uniformly across its range. This stops light from fading around the edges. This setting is useful when the range limit isn't visible on screen, and you don't want the edges of your light to fade out. This property is available for all **Light Types** except **Directional**.<br />This property only appears when you enable [additional properties](expose-all-additional-properties.md) for this section. It's only available in Realtime or Mixed light **Mode** for **Type** Area. |
| **Fade Distance** | The distance between the Light source and the Camera at which the Light begins to fade out. Measured in meters. This property is available for all **Light Types** except **Directional**.<br />This property only appears when you enable [additional properties](expose-all-additional-properties.md) for this section. It's only available in Realtime or Mixed light **Mode**. |
| **Intensity Multiplier** | A multiplier that gets applied to the intensity of the Light. Doesn't affect the intensity value, but only gets applied during the evaluation of the lighting. You can also modify this property via [Timeline](https://docs.unity3d.com/Manual/TimelineSection.html), Scripting or [animation](https://docs.unity3d.com/Manual/animeditor-AnimatingAGameObject.html). The parameter lets you fade the Light in and out without having to store its original intensity.<br />This property only appears when you enable [additional properties](expose-all-additional-properties.md) for this section. It's only available in Realtime or Mixed light **Mode**. |
| **Intensity Multiplier** | A multiplier that gets applied to the intensity of the Light. Doesn't affect the intensity value, but only gets applied during the evaluation of the lighting. You can also modify this property via [Timeline](https://docs.unity3d.com/Manual/TimelineSection.html), Scripting or [animation](https://docs.unity3d.com/Manual/animeditor-AnimatingAGameObject.html). The parameter lets you fade the Light in and out without having to store its original intensity.<br />This property does not affect the [Physically Based Sky](physically-based-sky-volume-override-reference.html) rendering for the main directionnal light.<br />This property only appears when you enable [additional properties](expose-all-additional-properties.md) for this section. It's only available in Realtime or Mixed light **Mode**. |
| **Display Emissive Mesh** | Enable the checkbox to make Unity automatically generate a Mesh with an emissive Material using the size, color, and intensity of this Light. Unity automatically adds the Mesh and Material to the GameObject the Light component is attached to. This property is available for **Rectangle** and **Tube** Lights.<br />This property only appears when you enable [additional properties](expose-all-additional-properties.md) for this section. (In case of an IES profile and a cookie used at the same time, only the cookie will be displayed). |
| **Include For Ray Tracing** | Enable the checkbox to make this Light active when you enable the **Ray Tracing** [Frame Setting](Frame-Settings.md) on the Camera. This applies to rasterization and [ray tracing](Ray-Tracing-Getting-Started.md) passes.<br />This property only appears when you enable [additional properties](expose-all-additional-properties.md) for this section. It's only available in Realtime or Mixed light **Mode**. |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ sealed class Styles
public readonly GUIContent affectDiffuse = EditorGUIUtility.TrTextContent("Affect Diffuse", "When disabled, HDRP does not calculate diffuse lighting for this Light. Does not increase performance as HDRP still calculates the diffuse lighting.");
public readonly GUIContent affectSpecular = EditorGUIUtility.TrTextContent("Affect Specular", "When disabled, HDRP does not calculate specular lighting for this Light. Does not increase performance as HDRP still calculates the specular lighting.");
public readonly GUIContent nonLightmappedOnly = EditorGUIUtility.TrTextContent("Shadowmask Mode", "Determines Shadowmask functionality when using Mixed lighting. Distance Shadowmask casts real-time shadows within the Shadow Distance, and baked shadows beyond. In Shadowmask mode, static GI contributors always cast baked shadows.\nEnable Shadowmask support in the HDRP asset to make use of this feature. Only available when Lighting Mode is set to Shadowmask in the Lighting window.");
public readonly GUIContent lightDimmer = EditorGUIUtility.TrTextContent("Intensity Multiplier", "Multiplies the intensity of the Light by the given number. This is useful for modifying the intensity of multiple Lights simultaneously without needing know the intensity of each Light.");
public readonly GUIContent lightDimmer = EditorGUIUtility.TrTextContent("Intensity Multiplier", "Multiplies the intensity of the Light by the given number. This is useful for modifying the intensity of multiple Lights simultaneously without needing know the intensity of each Light. This property does not affect the Physically Based Sky rendering for the main directionnal light.");
public readonly GUIContent fadeDistance = EditorGUIUtility.TrTextContent("Fade Distance", "Sets the distance from the camera at which light smoothly fades out before HDRP culls it completely. This minimizes popping.");
public readonly GUIContent innerOuterSpotAngle = EditorGUIUtility.TrTextContent("Inner / Outer Spot Angle", "Controls the inner and outer angles in degrees, at the base of a Spot light's cone.");
public readonly GUIContent spotIESCutoffPercent = EditorGUIUtility.TrTextContent("IES Cutoff Angle (%)", "Cutoff the IES Light in percent, of the base angle of the Spot Light's cone.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void UpdateShaderVariableslClouds(ref ShaderVariablesClouds cb, HDCamera hdCamer
// Grab the target sun additional data
m_CurrentSunLight.TryGetComponent<HDAdditionalLightData>(out additionalLightData);
// m_CurrentSunLightDataIndex is supposed to be guaranteed to be non -1 if the current sun is not null
cb._SunLightColor = m_GpuLightsBuilder.directionalLights[m_CurrentSunLightDataIndex].color * settings.sunLightDimmer.value;
cb._SunLightColor = m_GpuLightsBuilder.directionalLights[m_CurrentSunLightDataIndex].color * settings.sunLightDimmer.value * additionalLightData.lightDimmer;
cb._SunDirection = -currentSun.transform.forward;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public override void RenderClouds(BuiltinSkyParameters builtinParams, bool rende

var lightComponent = builtinParams.sunLight.GetComponent<Light>();
var additionalLightData = builtinParams.sunLight.GetComponent<HDAdditionalLightData>();
lightColor = LightUtils.EvaluateLightColor(lightComponent, additionalLightData);
lightColor = LightUtils.EvaluateLightColor(lightComponent, additionalLightData) * additionalLightData.lightDimmer;
}

s_VectorArray[0] = cloudLayer.layerA.Color * lightColor; s_VectorArray[1] = cloudLayer.layerB.Color * lightColor;
Expand Down

0 comments on commit 475e9f1

Please sign in to comment.