提交 b593b45f 编写于 作者: B Ben Houston

add lightScale parameter which varies the intensity of the lightMap.

上级 f7bb20d4
......@@ -100,7 +100,7 @@
// LIGHTS
var hemiLight = new THREE.HemisphereLight( 0xaabbff, 0x040404, 0.5 );
var hemiLight = new THREE.HemisphereLight( 0xaabbff, 0x040404, 0.3 );
hemiLight.position.y = 500;
scene.add( hemiLight );
......@@ -152,7 +152,12 @@
var loader = new THREE.JSONLoader();
loader.load( "obj/lightmap/lightmap.js", function ( geometry, materials ) {
for( var i = 0; i < materials.length; i ++ ) {
materials[i].lightScale = 0.75;
}
var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) );
mesh.scale.multiplyScalar( 100 );
scene.add( mesh );
......
......@@ -12,7 +12,10 @@
* map: new THREE.Texture( <Image> ),
*
* lightMap: new THREE.Texture( <Image> ),
* lightScale: <float>
*
* aoMap: new THREE.Texture( <Image> ),
* aoScale: <float>
*
* bumpMap: new THREE.Texture( <Image> ),
* bumpScale: <float>,
......@@ -66,6 +69,8 @@ THREE.MeshPhongMaterial = function ( parameters ) {
this.map = null;
this.lightMap = null;
this.lightScale = null;
this.aoMap = null;
this.aoScale = 1.0;
......@@ -125,6 +130,8 @@ THREE.MeshPhongMaterial.prototype.clone = function () {
material.map = this.map;
material.lightMap = this.lightMap;
material.lightScale = this.lightScale;
material.aoMap = this.aoMap;
material.aoScale = this.aoScale;
......
......@@ -4596,6 +4596,7 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms.map.value = material.map;
uniforms.lightMap.value = material.lightMap;
uniforms.lightScale.value = material.lightScale;
uniforms.aoMap.value = material.aoMap;
uniforms.aoScale.value = material.aoScale;
uniforms.specularMap.value = material.specularMap;
......
#ifdef USE_LIGHTMAP
outgoingLight += diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;
outgoingLight += diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz * lightScale;
#endif
\ No newline at end of file
#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightScale;
#endif
\ No newline at end of file
......@@ -13,6 +13,7 @@ THREE.UniformsLib = {
"offsetRepeat" : { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
"lightMap" : { type: "t", value: null },
"lightScale" : { type: "f", value: 1 },
"aoMap" : { type: "t", value: null },
"aoScale" : { type: "f", value: 1 },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册