SHARE
TWEET

Untitled

a guest Nov 6th, 2012 80 Never
  1.   this.geometry = new THREE.SphereGeometry(this.planet_radius, this.planet_geom_segments, this.planet_geom_rings);
  2.     this.geometry.computeTangents();
  3.  
  4.     this.shader = THREE.ShaderUtils.lib.normal;
  5.     this.uniforms = THREE.UniformsUtils.clone(this.shader.uniforms);
  6.  
  7.     this.uniforms.tNormal.value = THREE.ImageUtils.loadTexture(this.planet_normals_texture);
  8.     this.uniforms.uNormalScale.value.x = 1.5;
  9.     this.uniforms.uNormalScale.value.y = 1.5;
  10.  
  11.     this.uniforms.tDiffuse.value = planet_surface_texture;
  12.  
  13.     this.uniforms.tSpecular.value = THREE.ImageUtils.loadTexture(this.planet_specular_texture);
  14.     this.uniforms.enableAO.value = false;
  15.     this.uniforms.enableDiffuse.value = true;
  16.     this.uniforms.enableSpecular.value = true;
  17.     this.uniforms.uDiffuseColor.value.setHex(0xffffff);
  18.     this.uniforms.uSpecularColor.value.setHex(0x0000ff);
  19.     this.uniforms.uAmbientColor.value.setHex(0xffffff);
  20.     this.uniforms.uShininess.value = 99;
  21.     this.uniforms.uDiffuseColor.value.convertGammaToLinear();
  22.     this.uniforms.uSpecularColor.value.convertGammaToLinear();
  23.     this.uniforms.uAmbientColor.value.convertGammaToLinear();
  24.  
  25.     this.surface_material = new THREE.ShaderMaterial({
  26.         fragmentShader: this.shader.fragmentShader,
  27.         vertexShader: this.shader.vertexShader,
  28.         uniforms: this.uniforms,
  29.         lights: true
  30.     });
RAW Paste Data
Top