mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-15 07:56:00 +10:00
Eventually I'll have to continue in the experimental branch. Want to give it a go to the ColorPass/TexturePass material API. The color + map + env_map setup feels too limiting...
Now that I have more knowledge of WebGL and shaders, this is how the ColorPass/TexturePass API looks like:
var material = [
new THREE.MeshLambertMaterial( [
new THREE.ColorPass( 0xff0000, 1, THREE.NormalBlending ),
new THREE.TexturePass( new Texture( <image>, new THREE.UVMapping() ), 0.5, THREE.NormalBlending ),
new THREE.TexturePass( new Texture( [ <image>, <image>, <image>, <image>, <image>, <image> ], new THREE.CubeRefractionMapping() ), 1, THREE.SubtractiveBlending ),
new THREE.ColorPass( 0x0000ff, 1, THREE.AdditiveBlending )
], { blending: THREE.NormalBlending } ),
new THREE.MeshBasicMaterial( [
new THREE.ColorPass( 0xff0000, 1 ),
], { blending: THREE.AdditiveBlending, wireframe: true } ),
new THREE.MeshPhongMaterial( [
new THREE.ColorPass( 0xff0000, 1 ),
], { ambient: 0x000000, specular: 0xbbaa99, shininess: 50, blending: THREE.NormalBlending } );
];
Makes things a bit longer but I think it's more intuitive this way (and pretty powerful). However, the simplest material would be like this:
var material = new THREE.MeshBasicMaterial( new THREE.ColorPass( 0xff0000 ) );
Mhh... Now I don't know whether they should called `*Pass`, or `*Layer`...