Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ float VFXSampleDepth(float4 posSS)
return LoadCameraDepth(posSS.xy);
}

float VFXLinearEyeDepth(float depth)
{
return LinearEyeDepth(depth,_ZBufferParams);
}

void VFXApplyShadowBias(inout float4 posCS, inout float3 posWS, float3 normalWS)
{
}
Expand Down
2 changes: 2 additions & 0 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed artifacts in Speed Tree 8 billboard LODs due to SpeedTree LOD smoothing/crossfading [case 1348407]
- Fixed an issue where the scene view would turn black when bloom was enabled. [case 1298790](https://issuetracker.unity3d.com/issues/urp-bloom-and-tonemapping-causes-the-screen-to-go-black-in-scene-mode), [case 1340848](https://issuetracker.unity3d.com/issues/urp-bloom-produces-visual-artifacts-when-color-slash-emission-are-not-clamped)
- Fixed a case where camera dimension can be zero. [case 1321168](https://issuetracker.unity3d.com/issues/urp-attempting-to-get-camera-relative-temporary-rendertexture-is-thrown-when-tweening-the-viewport-rect-values-of-a-camera)
- VFX: Fixed soft particles when HDR or Opaque texture isn't enabled
- VFX: Fixed OpenGL soft particles fallback when depth texture isn't available

## [10.6.0] - 2021-04-29

Expand Down
3 changes: 1 addition & 2 deletions com.unity.visualeffectgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [10.7.0] - 2021-07-02
### Fixed
- Removed shader warnings due to SAMPLE_DEPTH_TEXTURE redefinition [Case 1331262](https://issuetracker.unity3d.com/product/unity/issues/guid/1331262/)
- Fix Soft Particle depth computation when using an orthographic camera [Case 1309961](https://issuetracker.unity3d.com/product/unity/issues/guid/1309961)


## [10.6.0] - 2021-04-29
Expand Down Expand Up @@ -62,8 +63,6 @@ The version number for this package has increased due to a version update of a r
### Added
- Added new setting to output nodes to exclude from TAA
- New Sample Point cache & Sample Attribute map operators

### Changed
- Changed the "Edit" button so it becomes "New" when no asset is set on a Visual Effect component, in order to save a new visual effect graph asset.

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ float3 VFXGetViewWorldPosition()
return (float3)0.0f;
}

float VFXLinearEyeDepth(float4 posSS)
float VFXLinearEyeDepth(float depth)
{
return 0.0f;
}

float VFXLinearEyeDepthOrthographic(float depth)
{
return 0.0f;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ float4x4 VFXGetViewToWorldMatrix()

float VFXSampleDepth(float4 posSS)
{
return LoadSceneDepth(uint2(posSS.xy));
}
float2 screenUV = GetNormalizedScreenSpaceUV(posSS.xy);

float VFXLinearEyeDepth(float depth)
{
return LinearEyeDepth(depth, _ZBufferParams);
// In URP, the depth texture is optional and could be 4x4 white texture, Load isn't appropriate in that case.
//float depth = LoadSceneDepth(screenUV * _ScreenParams.xy);
float depth = SampleSceneDepth(screenUV);

return depth;
}

void VFXApplyShadowBias(inout float4 posCS, inout float3 posWS, float3 normalWS)
Expand Down
28 changes: 26 additions & 2 deletions com.unity.visualeffectgraph/Shaders/VFXCommonOutput.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,36 @@ float4 VFXGetParticleColor(VFX_VARYING_PS_INPUTS i)
return color;
}

float VFXLinearEyeDepth(float depth)
{
return LinearEyeDepth(depth, _ZBufferParams);
}

float VFXLinearEyeDepthOrthographic(float depth)
{
#if UNITY_REVERSED_Z
return float(_ProjectionParams.z - (_ProjectionParams.z - _ProjectionParams.y) * depth);
#else
return float(_ProjectionParams.y + (_ProjectionParams.z - _ProjectionParams.y) * depth);
#endif
}

float VFXGetSoftParticleFade(VFX_VARYING_PS_INPUTS i)
{
float fade = 1.0f;
#if USE_SOFT_PARTICLE && defined(VFX_VARYING_INVSOFTPARTICLEFADEDISTANCE)
float sceneZ = VFXLinearEyeDepth(VFXSampleDepth(i.VFX_VARYING_POSCS));
fade = saturate(i.VFX_VARYING_INVSOFTPARTICLEFADEDISTANCE * (sceneZ - i.VFX_VARYING_POSCS.w));
float sceneZ, selfZ;
if(IsPerspectiveProjection())
{
sceneZ = VFXLinearEyeDepth(VFXSampleDepth(i.VFX_VARYING_POSCS));
selfZ = i.VFX_VARYING_POSCS.w;
}
else
{
sceneZ = VFXLinearEyeDepthOrthographic(VFXSampleDepth(i.VFX_VARYING_POSCS));
selfZ = VFXLinearEyeDepthOrthographic(i.VFX_VARYING_POSCS.z);
}
fade = saturate(i.VFX_VARYING_INVSOFTPARTICLEFADEDISTANCE * (sceneZ - selfZ));
fade = fade * fade * (3.0 - (2.0 * fade)); // Smoothsteping the fade
#endif
return fade;
Expand Down