Skip to content

Commit

Permalink
New WebGLNodeBuilder + Nodes: transmission (mrdoob#24453)
Browse files Browse the repository at this point in the history
* Cache CheckerNode if necessary

* Nodes: Refactor, ior, specular, transmission nodes

* update example

* add transmission example

* update transmission

* update transmission (2)

* update screenshot
  • Loading branch information
sunag authored and abernier committed Sep 16, 2022
1 parent 0bc64a2 commit e0809bb
Show file tree
Hide file tree
Showing 10 changed files with 483 additions and 311 deletions.
1 change: 1 addition & 0 deletions examples/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
],
"webgl / nodes": [
"webgl_nodes_loader_gltf_iridescence",
"webgl_nodes_loader_gltf_transmission",
"webgl_nodes_loader_gltf_sheen",
"webgl_nodes_materials_instance_uniform",
"webgl_nodes_materials_physical_clearcoat",
Expand Down
16 changes: 16 additions & 0 deletions examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
this.iridescenceIORNode = null;
this.iridescenceThicknessNode = null;

this.specularIntensityNode = null;
this.specularColorNode = null;

this.transmissionNode = null;
this.thicknessNode = null;
this.attenuationDistanceNode = null;
this.attenuationColorNode = null;

this.sheen = 0;
this.clearcoat = 0;
this.iridescence = 0;
Expand All @@ -47,6 +55,14 @@ export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
this.iridescenceIORNode = source.iridescenceIORNode;
this.iridescenceThicknessNode = source.iridescenceThicknessNode;

this.specularIntensityNode = source.specularIntensityNode;
this.specularColorNode = source.specularColorNode;

this.transmissionNode = source.transmissionNode;
this.thicknessNode = source.thicknessNode;
this.attenuationDistanceNode = source.attenuationDistanceNode;
this.attenuationColorNode = source.attenuationColorNode;

return super.copy( source );

}
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/nodes/procedural/CheckerNode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Node from '../core/Node.js';
import TempNode from '../core/TempNode.js';
import { ShaderNode, uv, add, mul, floor, mod, sign } from '../shadernode/ShaderNodeBaseElements.js';

const checkerShaderNode = new ShaderNode( ( inputs ) => {
Expand All @@ -13,7 +13,7 @@ const checkerShaderNode = new ShaderNode( ( inputs ) => {

} );

class CheckerNode extends Node {
class CheckerNode extends TempNode {

constructor( uvNode = uv() ) {

Expand Down
12 changes: 8 additions & 4 deletions examples/jsm/renderers/webgl/nodes/SlotNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import Node from 'three-nodes/core/Node.js';

class SlotNode extends Node {

constructor( node, name, nodeType ) {
constructor( params ) {

super( nodeType );
super( params.nodeType );

this.node = node;
this.name = name;
this.node = null;
this.source = null;
this.target = null;
this.inclusionType = 'replace';

Object.assign( this, params );

}

Expand Down
Loading

0 comments on commit e0809bb

Please sign in to comment.