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
7 changes: 1 addition & 6 deletions examples/jsm/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ export * from './math/CondNode';
export * from './procedural/NoiseNode';
export * from './procedural/CheckerNode';

// bsdfs

export * from './bsdfs/BlinnShininessExponentNode';
export * from './bsdfs/BlinnExponentToRoughnessNode';
export * from './bsdfs/RoughnessToBlinnExponentNode';

// misc

export * from './misc/TextureCubeUVNode';
Expand All @@ -79,6 +73,7 @@ export * from './utils/TimerNode';
export * from './utils/VelocityNode';
export * from './utils/UVTransformNode';
export * from './utils/MaxMIPLevelNode';
export * from './utils/SpecularMIPLevelNode';
export * from './utils/ColorSpaceNode';

// effects
Expand Down
7 changes: 1 addition & 6 deletions examples/jsm/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ export { CondNode } from './math/CondNode.js';
export { NoiseNode } from './procedural/NoiseNode.js';
export { CheckerNode } from './procedural/CheckerNode.js';

// bsdfs

export { BlinnShininessExponentNode } from './bsdfs/BlinnShininessExponentNode.js';
export { BlinnExponentToRoughnessNode } from './bsdfs/BlinnExponentToRoughnessNode.js';
export { RoughnessToBlinnExponentNode } from './bsdfs/RoughnessToBlinnExponentNode.js';

// misc

export { TextureCubeUVNode } from './misc/TextureCubeUVNode.js';
Expand All @@ -81,6 +75,7 @@ export { TimerNode } from './utils/TimerNode.js';
export { VelocityNode } from './utils/VelocityNode.js';
export { UVTransformNode } from './utils/UVTransformNode.js';
export { MaxMIPLevelNode } from './utils/MaxMIPLevelNode.js';
export { SpecularMIPLevelNode } from './utils/SpecularMIPLevelNode.js';
export { ColorSpaceNode } from './utils/ColorSpaceNode.js';
export { SubSlotNode } from './utils/SubSlotNode.js';

Expand Down
13 changes: 12 additions & 1 deletion examples/jsm/nodes/accessors/ReflectNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,22 @@ ReflectNode.prototype.generate = function ( builder, output ) {
case ReflectNode.VECTOR:

var viewNormalNode = builder.context.viewNormal || new NormalNode();
var roughnessNode = builder.context.roughness;

var viewNormal = viewNormalNode.build( builder, 'v3' );
var viewPosition = new PositionNode( PositionNode.VIEW ).build( builder, 'v3' );
var roughness = roughnessNode ? roughnessNode.build( builder, 'f' ) : undefined;

var code = `inverseTransformDirection( reflect( -normalize( ${viewPosition} ), ${viewNormal} ), viewMatrix )`;
var method = `reflect( -normalize( ${viewPosition} ), ${viewNormal} )`;

if ( viewNormalNode && roughness ) {

// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.
method = `normalize( mix( ${method}, ${viewNormal}, ${roughness} * ${roughness} ) )`;

}

var code = `inverseTransformDirection( ${method}, viewMatrix )`;

if ( isUnique ) {

Expand Down
13 changes: 0 additions & 13 deletions examples/jsm/nodes/bsdfs/BlinnExponentToRoughnessNode.d.ts

This file was deleted.

52 changes: 0 additions & 52 deletions examples/jsm/nodes/bsdfs/BlinnExponentToRoughnessNode.js

This file was deleted.

10 changes: 0 additions & 10 deletions examples/jsm/nodes/bsdfs/BlinnShininessExponentNode.d.ts

This file was deleted.

31 changes: 0 additions & 31 deletions examples/jsm/nodes/bsdfs/BlinnShininessExponentNode.js

This file was deleted.

94 changes: 0 additions & 94 deletions examples/jsm/nodes/bsdfs/RoughnessToBlinnExponentNode.js

This file was deleted.

2 changes: 1 addition & 1 deletion examples/jsm/nodes/inputs/CubeTextureNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CubeTextureNode.prototype.generate = function ( builder, output ) {

if ( bias === undefined && builder.context.bias ) {

bias = new builder.context.bias( this ).build( builder, 'f' );
bias = builder.context.bias.setTexture( this ).build( builder, 'f' );

}

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/inputs/TextureNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TextureNode.prototype.generate = function ( builder, output ) {

if ( bias === undefined && builder.context.bias ) {

bias = new builder.context.bias( this ).build( builder, 'f' );
bias = builder.context.bias.setTexture( this ).build( builder, 'f' );

}

Expand Down
14 changes: 9 additions & 5 deletions examples/jsm/nodes/materials/nodes/StandardNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Node } from '../../core/Node.js';
import { ExpressionNode } from '../../core/ExpressionNode.js';
import { ColorNode } from '../../inputs/ColorNode.js';
import { FloatNode } from '../../inputs/FloatNode.js';
import { RoughnessToBlinnExponentNode } from '../../bsdfs/RoughnessToBlinnExponentNode.js';
import { SpecularMIPLevelNode } from '../../utils/SpecularMIPLevelNode.js';

function StandardNode() {

Expand Down Expand Up @@ -129,8 +129,12 @@ StandardNode.prototype.build = function ( builder ) {

} else {

var specularRoughness = new ExpressionNode('material.specularRoughness', 'f' );
var clearcoatRoughness = new ExpressionNode('material.clearcoatRoughness', 'f' );

var contextEnvironment = {
bias: RoughnessToBlinnExponentNode,
roughness: specularRoughness,
bias: new SpecularMIPLevelNode( specularRoughness ),
viewNormal: new ExpressionNode('normal', 'v3'),
gamma: true
};
Expand All @@ -140,7 +144,8 @@ StandardNode.prototype.build = function ( builder ) {
};

var contextClearcoatEnvironment = {
bias: RoughnessToBlinnExponentNode,
roughness: clearcoatRoughness,
bias: new SpecularMIPLevelNode( clearcoatRoughness ),
viewNormal: new ExpressionNode('clearcoatNormal', 'v3'),
gamma: true
};
Expand Down Expand Up @@ -235,7 +240,6 @@ StandardNode.prototype.build = function ( builder ) {
builder.requires.transparent = alpha !== undefined;

builder.addParsCode( [

"varying vec3 vViewPosition;",

"#ifndef FLAT_SHADED",
Expand Down Expand Up @@ -457,7 +461,7 @@ StandardNode.prototype.build = function ( builder ) {

if ( builder.requires.irradiance ) {

output.push( "irradiance += PI * " + environment.irradiance.result + ";" );
output.push( "iblIrradiance += PI * " + environment.irradiance.result + ";" );

}

Expand Down
Loading