Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit c97f52a

Browse files
committed
Optimized texture lerping on boundary conditions
1 parent 0c45b35 commit c97f52a

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [2.1.1] - 2018-xx-xx
88

9+
### Fixed
10+
- Optimized volume texture blending.
11+
912
### Changed
1013
- Chromatic aberration is now forced to "fast mode" when running on GLES2.0 platforms due to compatibility issues.
1114

PostProcessing/Runtime/Utils/TextureLerper.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ internal Texture Lerp(Texture from, Texture to, float t)
108108
if (from == to)
109109
return from;
110110

111+
// Don't need to lerp boundary conditions
112+
if (t <= 0f) return from;
113+
if (t >= 1f) return to;
114+
111115
bool is3D = from is Texture3D
112116
|| (from is RenderTexture && ((RenderTexture)from).volumeDepth > 1);
113117

@@ -129,8 +133,12 @@ internal Texture Lerp(Texture from, Texture to, float t)
129133
m_Command.SetComputeTextureParam(compute, kernel, "_From", from);
130134
m_Command.SetComputeTextureParam(compute, kernel, "_To", to);
131135

132-
int groupSizeXY = Mathf.CeilToInt(size / 8f);
133-
int groupSizeZ = Mathf.CeilToInt(size / 8f);
136+
uint tgsX, tgsY, tgsZ;
137+
compute.GetKernelThreadGroupSizes(kernel, out tgsX, out tgsY, out tgsZ);
138+
Assert.AreEqual(tgsX, tgsY);
139+
int groupSizeXY = Mathf.CeilToInt(size / (float)tgsX);
140+
int groupSizeZ = Mathf.CeilToInt(size / (float)tgsZ);
141+
134142
m_Command.DispatchCompute(compute, kernel, groupSizeXY, groupSizeXY, groupSizeZ);
135143
return rt;
136144
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.unity.postprocessing",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"displayName": "Post Processing",
55
"unity": "2018.1",
66
"description": "The post-processing stack (v2) comes with a collection of effects and image filters you can apply to your cameras to improve the visuals of your games.",

0 commit comments

Comments
 (0)