Skip to content
Merged
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
18 changes: 9 additions & 9 deletions examples/webgl_materials_nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -2500,7 +2500,7 @@

case 'prem':

mtl.color = new Nodes.TextureCubeNode( new Nodes.TextureNode( premTexture ), undefined, undefined, bias );
mtl.color = new Nodes.TextureCubeNode( new Nodes.TextureNode( premTexture ), undefined, bias );

break;

Expand Down Expand Up @@ -2947,23 +2947,23 @@

var blurtexture = new Nodes.FunctionNode( [
// Reference: TriangleBlurShader.js
"vec4 blurtexture(sampler2D texture, vec2 uv, vec2 delta) {",
"vec4 blurtexture(sampler2D map, vec2 uv, vec2 delta) {",
" vec4 color = vec4( 0.0 );",
" float total = 0.0;",
// randomize the lookup values to hide the fixed number of samples
" float offset = rand( uv );",
" for ( float t = -BLUR_ITERATIONS; t <= BLUR_ITERATIONS; t ++ ) {",
" float percent = ( t + offset - 0.5 ) / BLUR_ITERATIONS;",
" float weight = 1.0 - abs( percent );",
" color += texture2D( texture, uv + delta * percent ) * weight;",
" color += texture2D( map, uv + delta * percent ) * weight;",
" total += weight;",
" }",
" return color / total;",
"}"
].join( "\n" ), [ new Nodes.ConstNode( "float BLUR_ITERATIONS 10.0" ) ] );

var blurredTexture = new Nodes.FunctionCallNode( blurtexture, {
texture: new Nodes.TextureNode( getTexture( "brick" ) ),
map: new Nodes.TextureNode( getTexture( "brick" ) ),
delta: delta,
uv: new Nodes.UVNode()
} );
Expand Down Expand Up @@ -3009,7 +3009,7 @@

var triplanarMapping = new Nodes.FunctionNode( [
// Reference: https://github.com/keijiro/StandardTriplanar
"vec4 triplanar_mapping( sampler2D texture, vec3 normal, vec3 position, float scale ) {",
"vec4 triplanar_mapping( sampler2D map, vec3 normal, vec3 position, float scale ) {",

// Blending factor of triplanar mapping
" vec3 bf = normalize( abs( normal ) );",
Expand All @@ -3021,17 +3021,17 @@
" vec2 tz = position.xy * scale;",

// Base color
" vec4 cx = texture2D(texture, tx) * bf.x;",
" vec4 cy = texture2D(texture, ty) * bf.y;",
" vec4 cz = texture2D(texture, tz) * bf.z;",
" vec4 cx = texture2D(map, tx) * bf.x;",
" vec4 cy = texture2D(map, ty) * bf.y;",
" vec4 cz = texture2D(map, tz) * bf.z;",

" return cx + cy + cz;",

"}"
].join( "\n" ) );

var triplanarMappingTexture = new Nodes.FunctionCallNode( triplanarMapping, {
texture: new Nodes.TextureNode( getTexture( "brick" ) ),
map: new Nodes.TextureNode( getTexture( "brick" ) ),
normal: new Nodes.NormalNode( Nodes.NormalNode.WORLD ),
position: new Nodes.PositionNode( Nodes.PositionNode.WORLD ),
scale: scale,
Expand Down