Skip to content

Commit

Permalink
remove material.ambient from everything per discussion here: mrdoob#5…
Browse files Browse the repository at this point in the history
  • Loading branch information
bhouston committed Dec 23, 2014
1 parent 209c8e1 commit 6f8d6dd
Show file tree
Hide file tree
Showing 69 changed files with 96 additions and 180 deletions.
13 changes: 0 additions & 13 deletions editor/js/Sidebar.Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,6 @@ Sidebar.Material = function ( editor ) {

}

if ( material.ambient !== undefined ) {

material.ambient.setHex( materialAmbient.getHexValue() );

}

if ( material.emissive !== undefined ) {

material.emissive.setHex( materialEmissive.getHexValue() );
Expand Down Expand Up @@ -639,7 +633,6 @@ Sidebar.Material = function ( editor ) {
var properties = {
'name': materialNameRow,
'color': materialColorRow,
'ambient': materialAmbientRow,
'emissive': materialEmissiveRow,
'specular': materialSpecularRow,
'shininess': materialShininessRow,
Expand Down Expand Up @@ -703,12 +696,6 @@ Sidebar.Material = function ( editor ) {

}

if ( material.ambient !== undefined ) {

materialAmbient.setHexValue( material.ambient.getHexString() );

}

if ( material.emissive !== undefined ) {

materialEmissive.setHexValue( material.emissive.getHexString() );
Expand Down
8 changes: 2 additions & 6 deletions examples/js/ShaderSkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ THREE.ShaderSkin = {

"diffuse": { type: "c", value: new THREE.Color( 0xeeeeee ) },
"specular": { type: "c", value: new THREE.Color( 0x111111 ) },
"ambient": { type: "c", value: new THREE.Color( 0x050505 ) },
"opacity": { type: "f", value: 1 },

"uRoughness": { type: "f", value: 0.15 },
Expand All @@ -65,7 +64,6 @@ THREE.ShaderSkin = {
"uniform bool enableBump;",
"uniform bool enableSpecular;",

"uniform vec3 ambient;",
"uniform vec3 diffuse;",
"uniform vec3 specular;",
"uniform float opacity;",
Expand Down Expand Up @@ -295,7 +293,7 @@ THREE.ShaderSkin = {
"totalLight += hemiTotal;",
"#endif",

"gl_FragColor.xyz = gl_FragColor.xyz * ( totalLight + ambientLightColor * ambient ) + specularTotal;",
"gl_FragColor.xyz = gl_FragColor.xyz * ( totalLight + ambientLightColor ) + specularTotal;",

THREE.ShaderChunk[ "shadowmap_fragment" ],
THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
Expand Down Expand Up @@ -377,7 +375,6 @@ THREE.ShaderSkin = {

"diffuse": { type: "c", value: new THREE.Color( 0xeeeeee ) },
"specular": { type: "c", value: new THREE.Color( 0x111111 ) },
"ambient": { type: "c", value: new THREE.Color( 0x050505 ) },
"opacity": { type: "f", value: 1 },

"uRoughness": { type: "f", value: 0.15 },
Expand All @@ -389,7 +386,6 @@ THREE.ShaderSkin = {

fragmentShader: [

"uniform vec3 ambient;",
"uniform vec3 diffuse;",
"uniform vec3 specular;",
"uniform float opacity;",
Expand Down Expand Up @@ -595,7 +591,7 @@ THREE.ShaderSkin = {

"gl_FragColor.xyz *= pow( colDiffuse.xyz, vec3( 0.5 ) );",

"gl_FragColor.xyz += ambientLightColor * ambient * colDiffuse.xyz + specularTotal;",
"gl_FragColor.xyz += ambientLightColor * colDiffuse.xyz + specularTotal;",

"#ifndef VERSION1",

Expand Down
6 changes: 2 additions & 4 deletions examples/js/ShaderTerrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ THREE.ShaderTerrain = {

"diffuse": { type: "c", value: new THREE.Color( 0xeeeeee ) },
"specular": { type: "c", value: new THREE.Color( 0x111111 ) },
"ambient": { type: "c", value: new THREE.Color( 0x050505 ) },
"shininess": { type: "f", value: 30 },
"opacity": { type: "f", value: 1 },

Expand All @@ -57,7 +56,6 @@ THREE.ShaderTerrain = {

fragmentShader: [

"uniform vec3 ambient;",
"uniform vec3 diffuse;",
"uniform vec3 specular;",
"uniform float shininess;",
Expand Down Expand Up @@ -288,8 +286,8 @@ THREE.ShaderTerrain = {

"#endif",

//"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient) + totalSpecular;",
"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );",
//"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor) + totalSpecular;",
"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor + totalSpecular );",

THREE.ShaderChunk[ "shadowmap_fragment" ],
THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
Expand Down
2 changes: 0 additions & 2 deletions examples/js/exporters/SceneExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ THREE.SceneExporter.prototype = {
' "type" : "MeshLambertMaterial",',
' "parameters" : {',
' "color" : ' + m.color.getHex() + ',',
' "ambient" : ' + m.ambient.getHex() + ',',
' "emissive" : ' + m.emissive.getHex() + ',',

m.map ? ' "map" : ' + LabelString( getTextureName( m.map ) ) + ',' : '',
Expand All @@ -498,7 +497,6 @@ THREE.SceneExporter.prototype = {
' "type" : "MeshPhongMaterial",',
' "parameters" : {',
' "color" : ' + m.color.getHex() + ',',
' "ambient" : ' + m.ambient.getHex() + ',',
' "emissive" : ' + m.emissive.getHex() + ',',
' "specular" : ' + m.specular.getHex() + ',',
' "shininess" : ' + m.shininess + ',',
Expand Down
7 changes: 0 additions & 7 deletions examples/js/loaders/AssimpJSONLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,6 @@ THREE.AssimpJSONLoader.prototype = {
else if(prop.key === '$clr.specular') {
init_props.specular = toColor(prop.value);
}
else if(prop.key === '$clr.ambient') {
init_props.ambient = toColor(prop.value);
}
else if(prop.key === '$clr.emissive') {
init_props.emissive = toColor(prop.value);
}
Expand All @@ -281,10 +278,6 @@ THREE.AssimpJSONLoader.prototype = {
}
}

if(!init_props.ambient) {
init_props.ambient = init_props.color;
}

// note: three.js does not like it when a texture is added after the geometry
// has been rendered once, see http://stackoverflow.com/questions/16531759/.
// for this reason we fill all slots upfront with default textures
Expand Down
1 change: 0 additions & 1 deletion examples/js/loaders/BabylonLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ THREE.BabylonLoader.prototype = {

var material = new THREE.MeshPhongMaterial();
material.name = data.name;
material.ambient.fromArray( data.ambient );
material.color.fromArray( data.diffuse );
material.emissive.fromArray( data.emissive );
material.specular.fromArray( data.specular );
Expand Down
1 change: 0 additions & 1 deletion examples/js/loaders/ColladaLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3576,7 +3576,6 @@ THREE.ColladaLoader = function () {

switch ( child.nodeName ) {

case 'ambient':
case 'emission':
case 'diffuse':
case 'specular':
Expand Down
3 changes: 0 additions & 3 deletions examples/js/loaders/MTLLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ THREE.MTLLoader.MaterialCreator.prototype = {

// Ambient color (color under shadow) using RGB values

params[ 'ambient' ] = new THREE.Color().fromArray( value );

break;

case 'ks':
Expand Down Expand Up @@ -350,7 +348,6 @@ THREE.MTLLoader.MaterialCreator.prototype = {

if ( params[ 'diffuse' ] ) {

if ( !params[ 'ambient' ]) params[ 'ambient' ] = params[ 'diffuse' ];
params[ 'color' ] = params[ 'diffuse' ];

}
Expand Down
5 changes: 0 additions & 5 deletions examples/js/loaders/gltf/glTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,6 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
params.shininess = shininess;
}

if (!(values.ambient === undefined) && !(typeof(values.ambient) == 'string'))
{
params.ambient = RgbArraytoHex(values.ambient);
}

if (!(values.emission === undefined))
{
params.emissive = RgbArraytoHex(values.emission);
Expand Down
6 changes: 3 additions & 3 deletions examples/js/renderers/SoftwareRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ THREE.SoftwareRenderer = function ( parameters ) {
}

function getPalette( material, bSimulateSpecular ) {
var diffuseR = material.ambient.r + material.color.r * 255;
var diffuseG = material.ambient.g + material.color.g * 255;
var diffuseB = material.ambient.b + material.color.b * 255;
var diffuseR = material.color.r * 255;
var diffuseG = material.color.g * 255;
var diffuseB = material.color.b * 255;
var palette = new Uint8Array(256*3);

if ( bSimulateSpecular ) {
Expand Down
5 changes: 2 additions & 3 deletions examples/js/shaders/NormalDisplacementShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ THREE.NormalDisplacementShader = {

"diffuse": { type: "c", value: new THREE.Color( 0xffffff ) },
"specular": { type: "c", value: new THREE.Color( 0x111111 ) },
"ambient": { type: "c", value: new THREE.Color( 0xffffff ) },
"shininess": { type: "f", value: 30 },
"opacity": { type: "f", value: 1 },

Expand Down Expand Up @@ -429,11 +428,11 @@ THREE.NormalDisplacementShader = {

" #ifdef METAL",

" gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );",
" gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor + totalSpecular );",

" #else",

" gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;",
" gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor ) + totalSpecular;",

" #endif",

Expand Down
1 change: 0 additions & 1 deletion examples/misc_controls_fly.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@

var materialNormalMap = new THREE.MeshPhongMaterial( {

ambient: 0x000000,
specular: 0x333333,
shininess: 15,
map: THREE.ImageUtils.loadTexture( "textures/planets/earth_atmos_2048.jpg" ),
Expand Down
16 changes: 8 additions & 8 deletions examples/scenes/test_scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,32 +562,32 @@

"phong_ben": {
"type": "MeshPhongMaterial",
"parameters": { "color": 1118481, "ambient": 1118481, "specular": 5601245, "shininess": 12, "bumpMap": "texture_bump_repeat", "bumpScale": 0.125 }
"parameters": { "color": 1118481, "specular": 5601245, "shininess": 12, "bumpMap": "texture_bump_repeat", "bumpScale": 0.125 }
},

"phong_man": {
"type": "MeshPhongMaterial",
"parameters": { "color": 16737894, "ambient": 16737894, "specular": 2236962, "shininess": 40, "wrapAround": true, "wrapRGB": [ 0.15, 0.02, 0.01 ] }
"parameters": { "color": 16737894, "specular": 2236962, "shininess": 40, "wrapAround": true, "wrapRGB": [ 0.15, 0.02, 0.01 ] }
},

"phong_hand": {
"type": "MeshPhongMaterial",
"parameters": { "color": 14531481, "ambient": 14531481, "specular": 2236962, "shininess": 40, "wrapAround": true, "wrapRGB": [ 0.15, 0.02, 0.01 ] }
"parameters": { "color": 14531481, "specular": 2236962, "shininess": 40, "wrapAround": true, "wrapRGB": [ 0.15, 0.02, 0.01 ] }
},

"phong_bunny": {
"type": "MeshPhongMaterial",
"parameters": { "color": 16777215, "ambient": 16777215, "specular": 1118481, "shininess": 10 }
"parameters": { "color": 16777215, "specular": 1118481, "shininess": 10 }
},

"phong_monster": {
"type": "MeshPhongMaterial",
"parameters": { "color": 16777215, "ambient": 16777215, "specular": 1118481, "shininess": 10 }
"parameters": { "color": 16777215, "specular": 1118481, "shininess": 10 }
},

"phong_disk": {
"type": "MeshPhongMaterial",
"parameters": { "color": 16733491, "ambient": 16733491, "specular": 1118481, "shininess": 30, "wireframe": false }
"parameters": { "color": 16733491, "specular": 1118481, "shininess": 30, "wireframe": false }
},

"phong_normal": {
Expand All @@ -597,12 +597,12 @@

"phong_morph": {
"type": "MeshPhongMaterial",
"parameters": { "color": 0, "ambient": 0, "specular": 16777215, "shininess": 50, "envMap": "cube_reflection", "reflectivity": 0.125, "combine": "MixOperation", "shading": "flat", "side": "double", "morphTargets": true, "morphNormals" : true }
"parameters": { "color": 0, "specular": 16777215, "shininess": 50, "envMap": "cube_reflection", "reflectivity": 0.125, "combine": "MixOperation", "shading": "flat", "side": "double", "morphTargets": true, "morphNormals" : true }
},

"phong_skin": {
"type": "MeshPhongMaterial",
"parameters": { "color": 0, "ambient": 0, "specular": 16777215, "shininess": 50, "envMap": "cube_reflection", "reflectivity": 0.5, "combine": "MixOperation", "skinning": true, "morphTargets": true }
"parameters": { "color": 0, "specular": 16777215, "shininess": 50, "envMap": "cube_reflection", "reflectivity": 0.5, "combine": "MixOperation", "skinning": true, "morphTargets": true }
},

"phong_compressed_cube": {
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_animation_cloth.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
clothTexture.wrapS = clothTexture.wrapT = THREE.RepeatWrapping;
clothTexture.anisotropy = 16;

var clothMaterial = new THREE.MeshPhongMaterial( { alphaTest: 0.5, ambient: 0xffffff, color: 0xffffff, specular: 0x030303, emissive: 0x111111, shiness: 10, map: clothTexture, side: THREE.DoubleSide } );
var clothMaterial = new THREE.MeshPhongMaterial( { alphaTest: 0.5, color: 0xffffff, specular: 0x030303, emissive: 0x111111, shiness: 10, map: clothTexture, side: THREE.DoubleSide } );

// cloth geometry
clothGeometry = new THREE.ParametricGeometry( clothFunction, cloth.w, cloth.h );
Expand Down
1 change: 0 additions & 1 deletion examples/webgl_animation_skinning_morph.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@
m.specular.setHSL( 0, 0, 0.1 );

m.color.setHSL( 0.6, 0, 0.6 );
m.ambient.copy( m.color );

//m.map = map;
//m.envMap = envMap;
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
geometry.computeBoundingSphere();

var material = new THREE.MeshPhongMaterial( {
color: 0xaaaaaa, ambient: 0xaaaaaa, specular: 0xffffff, shininess: 250,
color: 0xaaaaaa, specular: 0xffffff, shininess: 250,
side: THREE.DoubleSide, vertexColors: THREE.VertexColors
} );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry_uint.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
geometry.computeBoundingSphere();

var material = new THREE.MeshPhongMaterial( {
color: 0xaaaaaa, ambient: 0xaaaaaa, specular: 0xffffff, shininess: 250,
color: 0xaaaaaa, specular: 0xffffff, shininess: 250,
side: THREE.DoubleSide, vertexColors: THREE.VertexColors
} );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_effects_oculusrift.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
texture.magFilter = THREE.NearestFilter;
texture.minFilter = THREE.LinearMipMapLinearFilter;

var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { map: texture, ambient: 0xbbbbbb } ) );
var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { map: texture } ) );
scene.add( mesh );

var ambientLight = new THREE.AmbientLight( 0xcccccc );
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_geometries.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
map.wrapS = map.wrapT = THREE.RepeatWrapping;
map.anisotropy = 16;

var material = new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: map, side: THREE.DoubleSide } );
var material = new THREE.MeshLambertMaterial( { map: map, side: THREE.DoubleSide } );

//

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_geometries2.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
map.anisotropy = 16;

materials = [
new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: map, side: THREE.DoubleSide } ),
new THREE.MeshLambertMaterial( { map: map, side: THREE.DoubleSide } ),
new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1, side: THREE.DoubleSide } )
];

Expand Down
1 change: 0 additions & 1 deletion examples/webgl_geometry_colors_lookuptable.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@
side: THREE.DoubleSide,
specular: 0xF5F5F5,
color: 0xF5F5F5,
ambient : 0xFFFFFF,
shininess: 5,
vertexColors: THREE.VertexColors

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_geometry_convex.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
map.anisotropy = 16;

materials = [
new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: map } ),
new THREE.MeshLambertMaterial( { map: map } ),
new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1 } )
];

Expand Down
1 change: 0 additions & 1 deletion examples/webgl_geometry_extrude_shapes2.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@
color = new THREE.Color( theColors[i] );
material = new THREE.MeshLambertMaterial({
color: color,
ambient: color,
emissive: color,
});
amount = theAmounts[i];
Expand Down
6 changes: 3 additions & 3 deletions examples/webgl_geometry_large_mesh.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ <h1>Large mesh test</h1>

loader.load( 'obj/lucy/Lucy100k_bin.js', function ( geometry, materials ) {

addMesh( geometry, 0.75, 900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x030303, specular: 0x990000, shininess: 30 } ) );
addMesh( geometry, 0.75, 900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x030303, specular: 0x990000, shininess: 30 } ) );
addMesh( geometry, 0.75, 300, 0, 0, 0,0,0, new THREE.MeshFaceMaterial( materials ) );
addMesh( geometry, 0.75, -300, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x111111, specular: 0xffaa00, shininess: 10 } ) );
addMesh( geometry, 0.75, -900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x555555, specular: 0x666666, shininess: 10 } ) );
addMesh( geometry, 0.75, -300, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x111111, specular: 0xffaa00, shininess: 10 } ) );
addMesh( geometry, 0.75, -900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x555555, specular: 0x666666, shininess: 10 } ) );

loader.statusDomElement.style.display = "none";

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_geometry_minecraft.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
texture.magFilter = THREE.NearestFilter;
texture.minFilter = THREE.LinearMipMapLinearFilter;

var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { map: texture, ambient: 0xbbbbbb } ) );
var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { map: texture } ) );
scene.add( mesh );

var ambientLight = new THREE.AmbientLight( 0xcccccc );
Expand Down
Loading

0 comments on commit 6f8d6dd

Please sign in to comment.