材質(zhì)決定了物體是否透明顏色等
three.js 中涉及的主要幾種材質(zhì)
-
MeshBasicMaterial
- color
- wireframe
- wireframelinewidth
- wireframelinecap
- wireframeLineJoin
- Shading
- vertexColors
- fog
-
MeshDepthMaterial
- 這個(gè)材質(zhì)不受光線和材質(zhì)屬性的影響,主要由與物體離相機(jī)的距離決定 很容易結(jié)合其他材質(zhì)產(chǎn)生陰影效果?岂昭?
- wireframe
- wireframeLineWidth
- MeshNormalMaterial
- MeshLambertMaterial
- MeshPhongMaterial
- ShaderMaterial
- LineBasicMaterial
- LineDashMaterial
材質(zhì)的混合
var cubeMaterial = new THREE.MeshDepthMaterial();
var colorMaterial = new THREE.MeshBasicMaterial({
color: 0x00ff00, transparent: true, blending: THREE.MltiplyBlending});
var cube = new THREE.SceneUtils.createMultiMaterialObject(cubeGeometry, [colorMaterial, cubeMaterial]);
// set depth to low layer
cube.children[1].scale.set(0.99, 0.99, 0.99);
材質(zhì)的主要屬性
Basic property
- id : 每產(chǎn)生一種材質(zhì)分配一個(gè)ID羡榴,并且從0開始匀归,不斷加一
- uuid:
- name : 材質(zhì)名稱
- opacity: 0~1
- transparent: true /false
- overdraw 使用THREE.CanvasRenderer多邊形是否會(huì)更大些坑资??
- visible
- Side: THREE.FrontSide / THREE.BackSide/ THREE.DoubleSide
- needsUpdate: 當(dāng)材質(zhì)改變時(shí)需要告訴THREE.js
Blending
''' Materials have a couple of generic blending-related properties. Blending determines how the colors we render interact with the colors that are behind them. '''
- blending: THREE.NormalBlending
- blendsrc
- blenddst
- blendequation
Advance
與OpenGL關(guān)系比較大
- depthTest : GL_DEPTH_TEST This parameter controls whether the depth of a pixel is used to determine a new pixel's value
- depthWrite
- polygonOffset
- alphatest