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
13 changes: 2 additions & 11 deletions examples/jsm/tsl/display/GodraysNode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Frustum, Matrix4, RenderTarget, Vector2, RendererUtils, QuadMesh, TempNode, NodeMaterial, NodeUpdateType, Vector3, Plane, WebGPUCoordinateSystem } from 'three/webgpu';
import { Frustum, Matrix4, RenderTarget, Vector2, RendererUtils, QuadMesh, TempNode, NodeMaterial, NodeUpdateType, Vector3, Plane } from 'three/webgpu';
import { cubeTexture, clamp, viewZToPerspectiveDepth, logarithmicDepthToViewZ, float, Loop, max, Fn, passTexture, uv, dot, uniformArray, If, getViewPosition, uniform, vec4, add, interleavedGradientNoise, screenCoordinate, round, mul, uint, mix, exp, vec3, distance, pow, reference, lightPosition, vec2, bool, texture, perspectiveDepthToViewZ, lightShadowMatrix } from 'three/tsl';

const _quadMesh = /*@__PURE__*/ new QuadMesh();
Expand Down Expand Up @@ -351,8 +351,6 @@ class GodraysNode extends TempNode {
*/
setup( builder ) {

const { renderer } = builder;

const uvNode = uv();
const lightPos = lightPosition( this._light );

Expand Down Expand Up @@ -389,15 +387,8 @@ class GodraysNode extends TempNode {

const shadowPosition = lightShadowMatrix( this._light ).mul( worldPos );
const shadowCoord = shadowPosition.xyz.div( shadowPosition.w );
let coordZ = shadowCoord.z;

if ( renderer.coordinateSystem === WebGPUCoordinateSystem ) {

coordZ = coordZ.mul( 2 ).sub( 1 ); // WebGPU: Conversion [ 0, 1 ] to [ - 1, 1 ]

}

return vec3( shadowCoord.x, shadowCoord.y.oneMinus(), coordZ );
return vec3( shadowCoord.x, shadowCoord.y.oneMinus(), shadowCoord.z );

};

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/webgpu/nodes/WGSLNodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ class WGSLNodeBuilder extends NodeBuilder {
isUnfilterable( texture ) {

return this.getComponentTypeFromTexture( texture ) !== 'float' ||
( ! this.isAvailable( 'float32Filterable' ) && texture.isDataTexture === true && texture.type === FloatType ) ||
( ! this.isAvailable( 'float32Filterable' ) && texture.type === FloatType ) ||
( this.isSampleCompare( texture ) === false && texture.minFilter === NearestFilter && texture.magFilter === NearestFilter ) ||
this.renderer.backend.utils.getTextureSampleData( texture ).primarySamples > 1;

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/webgpu/utils/WebGPUBindingUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class WebGPUBindingUtils {

}

} else if ( binding.texture.isDataTexture || binding.texture.isDataArrayTexture || binding.texture.isData3DTexture ) {
} else if ( binding.texture.isDataTexture || binding.texture.isDataArrayTexture || binding.texture.isData3DTexture || binding.texture.isStorageTexture ) {

const type = binding.texture.type;

Expand Down