提交 3287e640 编写于 作者: R Ricardo Cabello

Merge pull request #6360 from WestLangley/dev-wrap

Removed wrap lighting from Phong and Lambert
......@@ -53,20 +53,6 @@
<div>
Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.<br />
</div>
<h3>[property:boolean wrapAround]</h3>
<div>
Define whether the diffuse lighting wraps around the model or not. This option adds a little more (tintable) light
onto the side of the object in relation to a light.
</div>
<h3>[property:Vector3 wrapRGB]</h3>
<div>
Decide how much of the wrap around values get used if the wrapAround option is set. The x, y, z values correspond
to the r, g, b values respectively. The typical range is of each is from 0 to 1. For example setting all of the
vector values to 0.5 will add a moderate amount of light to the side of the model. Changing *b* to 1 will
tint the light on the side to be more blue. Defaults to *(1,1,1)*.
</div>
<h3>[property:Texture map]</h3>
<div>Set color texture map. Default is null.</div>
......
......@@ -74,20 +74,6 @@
underlying colors.
</div>
<h3>[property:boolean wrapAround]</h3>
<div>
Define whether the diffuse lighting wraps around the model or not. This option adds a little more (tintable) light
onto the side of the object in relation to a light.
</div>
<h3>[property:Vector3 wrapRGB]</h3>
<div>
Decide how much of the wrap around values get used if the wrapAround option is set. The x, y, z values correspond
to the r, g, b values respectively. The typical range is of each is from 0 to 1. For example setting all of the
vector values to 0.5 will add a moderate amount of light to the side of the model. Changing *b* to 1 will
tint the light on the side to be more blue. Defaults to (1,1,1).
</div>
<h3>[property:Texture map]</h3>
<div>Set color texture map. Default is null.</div>
......
......@@ -205,7 +205,6 @@ THREE.MD2Character = function () {
var materialWireframe = new THREE.MeshPhongMaterial( { color: 0xffaa00, specular: 0x111111, shininess: 50, wireframe: true, shading: THREE.SmoothShading, map: whiteMap, morphTargets: true, morphNormals: true, metal: false } );
var materialTexture = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 50, wireframe: false, shading: THREE.SmoothShading, map: skinMap, morphTargets: true, morphNormals: true, metal: false } );
materialTexture.wrapAround = true;
//
......
......@@ -528,7 +528,6 @@ THREE.MD2CharacterComplex = function () {
var materialWireframe = new THREE.MeshPhongMaterial( { color: 0xffaa00, specular: 0x111111, shininess: 50, wireframe: true, shading: THREE.SmoothShading, map: whiteMap, morphTargets: true, morphNormals: true, metal: true } );
var materialTexture = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 50, wireframe: false, shading: THREE.SmoothShading, map: skinMap, morphTargets: true, morphNormals: true, metal: true } );
materialTexture.wrapAround = true;
//
......
......@@ -101,8 +101,7 @@ THREE.UCSCharacter = function() {
specular: 10.0,
map: skins[ i ],
skinning: true,
morphTargets: true,
wrapAround: true
morphTargets: true
} );
}
......
......@@ -567,12 +567,12 @@
"phong_man": {
"type": "MeshPhongMaterial",
"parameters": { "color": 16737894, "specular": 2236962, "shininess": 40, "wrapAround": true, "wrapRGB": [ 0.15, 0.02, 0.01 ] }
"parameters": { "color": 16737894, "specular": 2236962, "shininess": 40 }
},
"phong_hand": {
"type": "MeshPhongMaterial",
"parameters": { "color": 14531481, "specular": 2236962, "shininess": 40, "wrapAround": true, "wrapRGB": [ 0.15, 0.02, 0.01 ] }
"parameters": { "color": 14531481, "specular": 2236962, "shininess": 40 }
},
"phong_bunny": {
......
......@@ -241,8 +241,6 @@
//m.combine = THREE.MixOperation;
//m.reflectivity = 0.75;
m.wrapAround = true;
}
mesh = new THREE.SkinnedMesh( geometry, new THREE.MeshFaceMaterial( materials ) );
......
......@@ -189,8 +189,6 @@
specularMap: THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-SPEC.jpg" ),
normalMap: THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" ),
normalScale: new THREE.Vector2( 0.8, 0.8 ),
wrapRGB: new THREE.Vector3( 0.75, 0.5, 0.5 ),
wrapAround: true
} );
......
......@@ -159,13 +159,6 @@
node.castShadow = true;
node.receiveShadow = true;
if ( node.material && node.material.name === "skin" ) {
node.material.wrapAround = true;
node.material.wrapRGB.set( 0.6, 0.2, 0.1 );
}
} );
}, { normalizeRGB: true } );
......@@ -186,13 +179,6 @@
node.castShadow = true;
node.receiveShadow = true;
if ( node.material && ( node.material.name === "head" || node.material.name === "skinbody" ) ) {
node.material.wrapAround = true;
node.material.wrapRGB.set( 0.6, 0.2, 0.1 );
}
} );
}, { normalizeRGB: true } );
......
......@@ -126,8 +126,6 @@
specularMap: THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-SPEC.jpg" ),
normalMap: THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" ),
normalScale: new THREE.Vector2( 0.8, 0.8 ),
wrapRGB: new THREE.Vector3( 0.575, 0.5, 0.5 ),
wrapAround: true
} );
loader = new THREE.JSONLoader( true );
......
......@@ -58,6 +58,8 @@
scene = new THREE.Scene();
scene.add( new THREE.AmbientLight( 0x050505 ) );
var light = new THREE.PointLight( 0x0011ff, 1, 5500 );
light.position.set( 4000, 0, 0 );
scene.add( light );
......@@ -82,8 +84,6 @@
reflectionCube.format = THREE.RGBFormat;
var material = new THREE.MeshPhongMaterial( { specular: 0x101010, shininess: 100, envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.1, side: THREE.DoubleSide } );
material.wrapAround = true;
material.wrapRGB.set( 0.5, 0.5, 0.5 );
var geometry = new THREE.SphereGeometry( 1, 32, 16, 0, Math.PI );
......
......@@ -227,7 +227,7 @@
geometry.computeMorphNormals();
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x333333, shininess: 20, wrapAround: true, morphTargets: true, morphNormals: true, vertexColors: THREE.NoColors, shading: THREE.FlatShading } );
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x333333, shininess: 20, morphTargets: true, morphNormals: true, vertexColors: THREE.NoColors, shading: THREE.FlatShading } );
var meshAnim = new THREE.MorphAnimMesh( geometry, material );
meshAnim.duration = 3000;
......@@ -260,9 +260,6 @@
originalMaterial.specular.setHSL( 0, 0, 0.1 );
originalMaterial.shininess = 75;
originalMaterial.wrapAround = true;
originalMaterial.wrapRGB.set( 1, 0.5, 0.5 );
}
var s = 18.5;
......
......@@ -231,7 +231,7 @@
mapHeight.anisotropy = 4;
mapHeight.format = THREE.RGBFormat;
var material = new THREE.MeshPhongMaterial( { map: mapColor, bumpMap: mapHeight, bumpScale: 2.5, shininess: 75, specular: 0x333333, wrapAround: true, metal: true } );
var material = new THREE.MeshPhongMaterial( { map: mapColor, bumpMap: mapHeight, bumpScale: 2.5, shininess: 75, specular: 0x333333, metal: true } );
var object = new THREE.Mesh( geometry, material );
object.scale.multiplyScalar( 8 );
......@@ -243,8 +243,6 @@
var loader = new THREE.BinaryLoader();
loader.load( "obj/female02/Female02_bin.js", function( geometry, materials ) {
for ( var i = 0; i < materials.length; i ++ ) materials[ i ].wrapAround = true;
var object = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) );
object.position.x = -50;
object.position.y = -48;
......@@ -255,8 +253,6 @@
loader.load( "obj/male02/Male02_bin.js", function( geometry, materials ) {
for ( var i = 0; i < materials.length; i ++ ) materials[ i ].wrapAround = true;
var object = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) );
object.position.x = 50;
object.position.y = -48;
......@@ -295,7 +291,7 @@
var matPlane = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 50, bumpMap: mapHeight2, bumpScale: 0.5 } );
var matPlane2 = new THREE.MeshPhongMaterial( { color: 0x331919, specular: 0x111111, shininess: 50, bumpMap: mapHeight2, bumpScale: 1 } );
var matPlane3 = new THREE.MeshPhongMaterial( { color: 0x00aaff, specular: 0xffffff, shininess: 200, bumpMap: mapHeight3, bumpScale: 1.2, wrapAround: true } );
var matPlane3 = new THREE.MeshPhongMaterial( { color: 0x00aaff, specular: 0xffffff, shininess: 200, bumpMap: mapHeight3, bumpScale: 1.2 } );
var matPlane4 = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 50, bumpMap: mapHeight3, bumpScale: 1 } );
// bottom
......
......@@ -47,9 +47,6 @@ THREE.MeshLambertMaterial = function ( parameters ) {
this.color = new THREE.Color( 0xffffff ); // diffuse
this.emissive = new THREE.Color( 0x000000 );
this.wrapAround = false;
this.wrapRGB = new THREE.Vector3( 1, 1, 1 );
this.map = null;
this.lightMap = null;
......@@ -94,9 +91,6 @@ THREE.MeshLambertMaterial.prototype.clone = function () {
material.color.copy( this.color );
material.emissive.copy( this.emissive );
material.wrapAround = this.wrapAround;
material.wrapRGB.copy( this.wrapRGB );
material.map = this.map;
material.lightMap = this.lightMap;
......
......@@ -63,9 +63,6 @@ THREE.MeshPhongMaterial = function ( parameters ) {
this.metal = false;
this.wrapAround = false;
this.wrapRGB = new THREE.Vector3( 1, 1, 1 );
this.map = null;
this.lightMap = null;
......@@ -124,9 +121,6 @@ THREE.MeshPhongMaterial.prototype.clone = function () {
material.metal = this.metal;
material.wrapAround = this.wrapAround;
material.wrapRGB.copy( this.wrapRGB );
material.map = this.map;
material.lightMap = this.lightMap;
......
......@@ -2007,7 +2007,6 @@ THREE.WebGLRenderer = function ( parameters ) {
alphaTest: material.alphaTest,
metal: material.metal,
wrapAround: material.wrapAround,
doubleSided: material.side === THREE.DoubleSide,
flipSided: material.side === THREE.BackSide
......@@ -2572,24 +2571,12 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms.emissive.value = material.emissive;
uniforms.specular.value = material.specular;
if ( material.wrapAround ) {
uniforms.wrapRGB.value.copy( material.wrapRGB );
}
}
function refreshUniformsLambert ( uniforms, material ) {
uniforms.emissive.value = material.emissive;
if ( material.wrapAround ) {
uniforms.wrapRGB.value.copy( material.wrapRGB );
}
}
function refreshUniformsLights ( uniforms, lights ) {
......
......@@ -35,9 +35,3 @@ uniform vec3 ambientLightColor;
uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];
#endif
#ifdef WRAP_AROUND
uniform vec3 wrapRGB;
#endif
......@@ -21,25 +21,6 @@ for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
#ifdef WRAP_AROUND
vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
#endif
#endif
#ifdef WRAP_AROUND
vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );
#ifdef DOUBLE_SIDED
directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );
#endif
#endif
vLightFront += directionalLightColor[ i ] * directionalLightWeighting;
......@@ -72,25 +53,6 @@ for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
#ifdef WRAP_AROUND
vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
#endif
#endif
#ifdef WRAP_AROUND
vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );
#ifdef DOUBLE_SIDED
pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );
#endif
#endif
vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;
......@@ -129,25 +91,6 @@ for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
#ifdef WRAP_AROUND
vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
#endif
#endif
#ifdef WRAP_AROUND
vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );
#ifdef DOUBLE_SIDED
spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );
#endif
#endif
vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;
......
......@@ -48,7 +48,7 @@ vec3 totalSpecularLight = vec3( 0.0 );
// diffuse
vec3 cosineTerm = calcCosineTerm( normal, lightDir );
float cosineTerm = saturate( dot( normal, lightDir ) );
totalDiffuseLight += lightColor * attenuation * cosineTerm;
......@@ -88,7 +88,7 @@ vec3 totalSpecularLight = vec3( 0.0 );
// diffuse
vec3 cosineTerm = calcCosineTerm( normal, lightDir );
float cosineTerm = saturate( dot( normal, lightDir ) );
totalDiffuseLight += lightColor * attenuation * cosineTerm;
......@@ -114,7 +114,7 @@ vec3 totalSpecularLight = vec3( 0.0 );
// diffuse
vec3 cosineTerm = calcCosineTerm( normal, lightDir );
float cosineTerm = saturate( dot( normal, lightDir ) );
totalDiffuseLight += lightColor * cosineTerm;
......
......@@ -43,12 +43,6 @@ uniform vec3 ambientLightColor;
#endif
#ifdef WRAP_AROUND
uniform vec3 wrapRGB;
#endif
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
......@@ -56,20 +50,3 @@ varying vec3 vViewPosition;
varying vec3 vNormal;
#endif
vec3 calcCosineTerm( in vec3 normal, in vec3 lightDir ) {
float dotProduct = dot( normal, lightDir );
vec3 cosineTerm = vec3( saturate( dotProduct ) );
#ifdef WRAP_AROUND
vec3 cosineTermHalf = vec3( saturate( 0.5 * dotProduct + 0.5 ) );
cosineTerm = mix( cosineTerm, cosineTermHalf, wrapRGB );
#endif
return cosineTerm;
}
......@@ -120,7 +120,6 @@ THREE.ShaderLib = {
{
"emissive" : { type: "c", value: new THREE.Color( 0x000000 ) },
"wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
}
] ),
......@@ -261,7 +260,6 @@ THREE.ShaderLib = {
"emissive" : { type: "c", value: new THREE.Color( 0x000000 ) },
"specular" : { type: "c", value: new THREE.Color( 0x111111 ) },
"shininess": { type: "f", value: 30 },
"wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
}
] ),
......
......@@ -206,7 +206,6 @@ THREE.WebGLProgram = ( function () {
parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
parameters.morphNormals ? '#define USE_MORPHNORMALS' : '',
parameters.wrapAround ? '#define WRAP_AROUND' : '',
parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
parameters.flipSided ? '#define FLIP_SIDED' : '',
......@@ -315,7 +314,6 @@ THREE.WebGLProgram = ( function () {
parameters.flatShading ? '#define FLAT_SHADED': '',
parameters.metal ? '#define METAL' : '',
parameters.wrapAround ? '#define WRAP_AROUND' : '',
parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
parameters.flipSided ? '#define FLIP_SIDED' : '',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册