Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: Compute Snow Example #27400

Merged
merged 7 commits into from
Dec 19, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
"webgpu_compute_audio",
"webgpu_compute_particles",
"webgpu_compute_particles_rain",
"webgpu_compute_particles_snow",
"webgpu_compute_points",
"webgpu_compute_texture",
"webgpu_compute_texture_pingpong",
Expand Down
5 changes: 5 additions & 0 deletions examples/jsm/nodes/display/GaussianBlurNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ class GaussianBlurNode extends TempNode {

this.updateBeforeType = NodeUpdateType.RENDER;

this.resolution = new Vector2( 1, 1 );

}

setSize( width, height ) {

width = Math.max( Math.round( width * this.resolution.x ), 1 );
height = Math.max( Math.round( height * this.resolution.y ), 1 );

this._invSize.value.set( 1 / width, 1 / height );
this._horizontalRT.setSize( width, height );
this._verticalRT.setSize( width, height );
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/materials/NodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class NodeMaterial extends ShaderMaterial {

const toneMappingNode = builder.toneMappingNode;

if ( toneMappingNode ) {
if ( this.toneMapped === true && toneMappingNode ) {

outputNode = vec4( toneMappingNode.context( { color: outputNode.rgb } ), outputNode.a );

Expand Down
28 changes: 27 additions & 1 deletion examples/jsm/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ class Renderer {

renderObject( object, scene, camera, geometry, material, group, lightsNode ) {

material = scene.overrideMaterial !== null ? scene.overrideMaterial : material;
let overridePositionNode;

//

Expand All @@ -951,6 +951,24 @@ class Renderer {

//

if ( scene.overrideMaterial !== null ) {

const overrideMaterial = scene.overrideMaterial;

if ( material.positionNode && material.positionNode.isNode ) {

overridePositionNode = overrideMaterial.positionNode;

overrideMaterial.positionNode = material.positionNode;

}

material = overrideMaterial;

}

//

if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {

material.side = BackSide;
Expand All @@ -969,6 +987,14 @@ class Renderer {

//

if ( overridePositionNode !== undefined ) {

scene.overrideMaterial.positionNode = overridePositionNode;

}

//

object.onAfterRender( this, scene, camera, geometry, material, group );

}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.