I noticed that THREE.js uses shaders internally to create core material \"e.g. MeshLambertMaterial\", So I decided to copy the lambert shader from Three.js code into a new s
three.js was designed to be easy to use, not easy to modify. This may change in the future...
You need to set the material.defines
like so:
var defines = {};
defines[ "USE_MAP" ] = "";.
Then specify defines
in the material constructor.
var material = new THREE.ShaderMaterial({
name: "TerrainShader",
defines : defines,
uniforms : shaderUniforms,
vertexShader: THREE.MyShader.vertexShader,
fragmentShader: THREE.MyShader.fragmentShader,
fog:false,
lights:true
});
Regarding the texture repetitions, you need to add the repeat to your uniforms:
shaderUniforms[ "offsetRepeat" ].value.set( 0, 0, 2, 2 );
three.js r.66