Skip to content

Commit 6158733

Browse files
Merge shape offset parameters (#5469)
Co-authored-by: sebastienlagarde <[email protected]>
1 parent 6114eae commit 6158733

File tree

4 files changed

+25
-31
lines changed

4 files changed

+25
-31
lines changed

com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricCloudsEditor.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ class VolumetricCloudsEditor : VolumeComponentEditor
4646
SerializedDataParameter m_DensityMultiplier;
4747
SerializedDataParameter m_ShapeFactor;
4848
SerializedDataParameter m_ShapeScale;
49-
SerializedDataParameter m_ShapeOffsetX;
50-
SerializedDataParameter m_ShapeOffsetY;
51-
SerializedDataParameter m_ShapeOffsetZ;
49+
SerializedDataParameter m_ShapeOffset;
5250
SerializedDataParameter m_ErosionFactor;
5351
SerializedDataParameter m_ErosionScale;
5452
SerializedDataParameter m_ErosionNoiseType;
@@ -126,9 +124,7 @@ public override void OnEnable()
126124
m_DensityMultiplier = Unpack(o.Find(x => x.densityMultiplier));
127125
m_ShapeFactor = Unpack(o.Find(x => x.shapeFactor));
128126
m_ShapeScale = Unpack(o.Find(x => x.shapeScale));
129-
m_ShapeOffsetX = Unpack(o.Find(x => x.shapeOffsetX));
130-
m_ShapeOffsetY = Unpack(o.Find(x => x.shapeOffsetY));
131-
m_ShapeOffsetZ = Unpack(o.Find(x => x.shapeOffsetZ));
127+
m_ShapeOffset = Unpack(o.Find(x => x.shapeOffset));
132128
m_ErosionFactor = Unpack(o.Find(x => x.erosionFactor));
133129
m_ErosionScale = Unpack(o.Find(x => x.erosionScale));
134130
m_ErosionNoiseType = Unpack(o.Find(x => x.erosionNoiseType));
@@ -234,9 +230,7 @@ public override void OnInspectorGUI()
234230
}
235231
PropertyField(m_ShapeFactor);
236232
PropertyField(m_ShapeScale);
237-
PropertyField(m_ShapeOffsetX);
238-
PropertyField(m_ShapeOffsetY);
239-
PropertyField(m_ShapeOffsetZ);
233+
PropertyField(m_ShapeOffset);
240234
PropertyField(m_ErosionFactor);
241235
PropertyField(m_ErosionScale);
242236
PropertyField(m_ErosionNoiseType);
@@ -248,11 +242,7 @@ public override void OnInspectorGUI()
248242
}
249243
}
250244
else
251-
{
252-
PropertyField(m_ShapeOffsetX);
253-
PropertyField(m_ShapeOffsetY);
254-
PropertyField(m_ShapeOffsetZ);
255-
}
245+
PropertyField(m_ShapeOffset);
256246
}
257247

258248
PropertyField(m_EarthCurvature);

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/HDRenderPipeline.VolumetricClouds.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ void UpdateShaderVariableslClouds(ref ShaderVariablesClouds cb, HDCamera hdCamer
439439
cb._ShapeScale = cloudModelData.shapeScale;
440440
cb._ErosionFactor = cloudModelData.erosionFactor;
441441
cb._ErosionScale = cloudModelData.erosionScale;
442-
cb._ShapeNoiseOffset = new Vector2(settings.shapeOffsetX.value, settings.shapeOffsetZ.value);
443-
cb._VerticalShapeNoiseOffset = settings.shapeOffsetY.value;
442+
cb._ShapeNoiseOffset = new Vector2(settings.shapeOffset.value.x, settings.shapeOffset.value.z);
443+
cb._VerticalShapeNoiseOffset = settings.shapeOffset.value.y;
444444

445445
// If the sun has moved more than 2.0°, reduce significantly the history accumulation
446446
float sunAngleDifference = 0.0f;

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricClouds.Migration.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ enum Version
2323
{
2424
Initial,
2525
GlobalWind,
26+
ShapeOffset,
2627

2728
Count
2829
}
@@ -44,6 +45,13 @@ enum Version
4445
mode = WindParameter.WindOverrideMode.Custom,
4546
customValue = c.m_ObsoleteOrientation.value
4647
};
48+
#pragma warning restore 618
49+
}),
50+
MigrationStep.New(Version.ShapeOffset, (VolumetricClouds c) =>
51+
{
52+
#pragma warning disable 618 // Type or member is obsolete
53+
c.shapeOffset.overrideState = c.m_ObsoleteShapeOffsetX.overrideState || c.m_ObsoleteShapeOffsetY.overrideState || c.m_ObsoleteShapeOffsetZ.overrideState;
54+
c.shapeOffset.value = new Vector3(c.m_ObsoleteShapeOffsetX.value, c.m_ObsoleteShapeOffsetY.value, c.m_ObsoleteShapeOffsetZ.value);
4755
#pragma warning restore 618
4856
})
4957
);
@@ -61,5 +69,13 @@ void Awake()
6169
MinFloatParameter m_ObsoleteWindSpeed = new MinFloatParameter(1.0f, 0.0f);
6270
[SerializeField, FormerlySerializedAs("orientation"), Obsolete("For Data Migration")]
6371
ClampedFloatParameter m_ObsoleteOrientation = new ClampedFloatParameter(0.0f, 0.0f, 360.0f);
72+
73+
[SerializeField, FormerlySerializedAs("shapeOffsetX"), Obsolete("For Data Migration")]
74+
FloatParameter m_ObsoleteShapeOffsetX = new FloatParameter(0.0f);
75+
[SerializeField, FormerlySerializedAs("shapeOffsetY"), Obsolete("For Data Migration")]
76+
FloatParameter m_ObsoleteShapeOffsetY = new FloatParameter(0.0f);
77+
[SerializeField, FormerlySerializedAs("shapeOffsetZ"), Obsolete("For Data Migration")]
78+
FloatParameter m_ObsoleteShapeOffsetZ = new FloatParameter(0.0f);
79+
6480
}
6581
}

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricClouds.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -379,22 +379,10 @@ public CloudFadeInModeParameter(CloudFadeInMode value, bool overrideState = fals
379379
public MinFloatParameter shapeScale = new MinFloatParameter(2.5f, 0.1f);
380380

381381
/// <summary>
382-
/// Controls the offset (world X-axis) applied when evaluating the larger noise passing through the cloud coverage.
382+
/// Controls the world space offset applied when evaluating the larger noise passing through the cloud coverage.
383383
/// </summary>
384-
[Tooltip("Controls the offset (world X-axis) applied when evaluating the larger noise passing through the cloud coverage.")]
385-
public FloatParameter shapeOffsetX = new FloatParameter(0.0f);
386-
387-
/// <summary>
388-
/// Controls the offset (world Y-axis) applied when evaluating the larger noise passing through the cloud coverage.
389-
/// </summary>
390-
[Tooltip("Controls the offset (world Y-axis) applied when evaluating the larger noise passing through the cloud coverage.")]
391-
public FloatParameter shapeOffsetY = new FloatParameter(0.0f);
392-
393-
/// <summary>
394-
/// Controls the offset (world Z-axis) applied when evaluating the larger noise passing through the cloud coverage.
395-
/// </summary>
396-
[Tooltip("Controls the offset (world Z-axis) applied when evaluating the larger noise passing through the cloud coverage.")]
397-
public FloatParameter shapeOffsetZ = new FloatParameter(0.0f);
384+
[Tooltip("Controls the world space offset applied when evaluating the larger noise passing through the cloud coverage.")]
385+
public Vector3Parameter shapeOffset = new Vector3Parameter(Vector3.zero);
398386

399387
/// <summary>
400388
/// Controls the smaller noise on the edge of the clouds. A higher value will erode clouds more significantly.

0 commit comments

Comments
 (0)