Skip to content

Commit 0bc1367

Browse files
mvaligurskyMartin Valigursky
and
Martin Valigursky
authored
DOF support for WebGPU (#7218)
Co-authored-by: Martin Valigursky <[email protected]>
1 parent b068027 commit 0bc1367

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

examples/src/examples/graphics/depth-of-field.example.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @config WEBGPU_DISABLED
21
import { data } from 'examples/observer';
32
import { deviceType, rootPath } from 'examples/utils';
43
import * as pc from 'playcanvas';

src/extras/render-passes/render-pass-dof-blur.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class RenderPassDofBlur extends RenderPassShaderQuad {
8888
for (int i = 0; i < ${kernelCount}; i++)
8989
{
9090
vec2 uv = uv0 + step * kernel[i];
91-
vec3 tap = texture2D(nearTexture, uv).rgb;
91+
vec3 tap = texture2DLodEXT(nearTexture, uv, 0.0).rgb;
9292
sum += tap.rgb;
9393
}
9494
@@ -103,10 +103,10 @@ class RenderPassDofBlur extends RenderPassShaderQuad {
103103
for (int i = 0; i < ${kernelCount}; i++)
104104
{
105105
vec2 uv = uv0 + step * kernel[i];
106-
vec3 tap = texture2D(farTexture, uv).rgb;
106+
vec3 tap = texture2DLodEXT(farTexture, uv, 0.0).rgb;
107107
108108
// block out sharp objects to avoid leaking to far blur
109-
float cocThis = texture2D(cocTexture, uv).g;
109+
float cocThis = texture2DLodEXT(cocTexture, uv, 0.0).g;
110110
tap *= cocThis;
111111
sumCoC += cocThis;
112112

0 commit comments

Comments
 (0)