Skip to content

Commit 8eaf494

Browse files
committed
Refactored ShadowMap code.
Currently MeshBasicMaterial/MeshLambertMaterial doesn't support shadows. Not sure if they'll get that back.
1 parent 3337a01 commit 8eaf494

18 files changed

Lines changed: 208 additions & 270 deletions

editor/js/Sidebar.Project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,4 @@ Sidebar.Project = function ( editor ) {
123123

124124
return container;
125125

126-
}
126+
};

examples/js/ShaderSkin.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,6 @@ THREE.ShaderSkin = {
246246

247247
"#endif",
248248

249-
THREE.ShaderChunk[ "shadowmap_fragment" ],
250-
251-
"totalDiffuseLight *= shadowMask;",
252-
"totalSpecularLight *= shadowMask;",
253-
254249
"outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor * diffuse ) + totalSpecularLight;",
255250

256251
THREE.ShaderChunk[ "linear_to_gamma_fragment" ],

examples/js/ShaderTerrain.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ THREE.ShaderTerrain = {
232232

233233
"outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
234234

235-
THREE.ShaderChunk[ "shadowmap_fragment" ],
236235
THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
237236
THREE.ShaderChunk[ "fog_fragment" ],
238237

examples/js/loaders/MMDLoader.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3822,8 +3822,6 @@ THREE.ShaderLib[ 'mmd' ] = {
38223822
THREE.ShaderChunk[ "normal_fragment" ],
38233823
THREE.ShaderChunk[ "emissivemap_fragment" ],
38243824

3825-
THREE.ShaderChunk[ "shadowmap_fragment" ],
3826-
38273825
// accumulation
38283826
THREE.ShaderChunk[ "lights_phong_fragment" ],
38293827
THREE.ShaderChunk[ "lights_template" ],

examples/js/nodes/materials/PhongNode.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ THREE.PhongNode.prototype.build = function( builder ) {
207207
output.push( 'material.diffuseColor = ' + ( light ? 'vec3( 1.0 )' : 'diffuseColor' ) + ';' );
208208

209209
output.push(
210-
THREE.ShaderChunk[ "shadowmap_fragment" ],
211-
212210
// accumulation
213211
'material.specularColor = specular;',
214212
'material.specularShininess = shininess;',

examples/js/nodes/materials/StandardNode.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ THREE.StandardNode.prototype.build = function( builder ) {
219219
output.push( 'material.diffuseColor = ' + ( light ? 'vec3( 1.0 )' : 'diffuseColor * (1.0 - metalnessFactor)' ) + ';' );
220220

221221
output.push(
222-
THREE.ShaderChunk[ "shadowmap_fragment" ],
223-
224222
// accumulation
225223
'material.specularRoughness = clamp( roughnessFactor, 0.001, 1.0 );', // disney's remapping of [ 0, 1 ] roughness to [ 0.001, 1 ]
226224
'material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );',

examples/webgl_geometry_spline_editor.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
light.shadowCameraFar = camera.far;
7575
light.shadowCameraFov = 70;
7676
light.shadowBias = -0.000222;
77-
light.shadowDarkness = 0.25;
7877
light.shadowMapWidth = 1024;
7978
light.shadowMapHeight = 1024;
8079
scene.add( light );

examples/webgl_particles_general.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,6 @@
513513
pointLight.castShadow = true;
514514
pointLight.shadowCameraNear = 1;
515515
pointLight.shadowCameraFar = 1000;
516-
pointLight.shadowDarkness = .8;
517-
// pointLight.shadowCameraVisible = true;
518516
pointLight.shadowMapWidth = 4096;
519517
pointLight.shadowMapHeight = 2048;
520518
pointLight.shadowBias = - 0.5;

src/Three.Legacy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ Object.defineProperties( THREE.Light.prototype, {
314314
},
315315
shadowDarkness: {
316316
set: function ( value ) {
317-
this.shadow.darkness = value;
317+
console.warn( 'THREE.Light: .shadowDarkness has been removed.' );
318318
}
319319
},
320320
shadowMapWidth: {

src/lights/LightShadow.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ THREE.LightShadow = function ( camera ) {
77
this.camera = camera;
88

99
this.bias = 0;
10-
this.darkness = 1;
1110

1211
this.mapSize = new THREE.Vector2( 512, 512 );
1312

@@ -25,7 +24,6 @@ THREE.LightShadow.prototype = {
2524
this.camera = source.camera.clone();
2625

2726
this.bias = source.bias;
28-
this.darkness = source.darkness;
2927

3028
this.mapSize.copy( source.mapSize );
3129

0 commit comments

Comments
 (0)