Material

Material是描述物體外觀的基礎類別,許多不同的材質都繼承自這個類別,而在Three.js中有幾種Material可以選擇:

  1. LineBasicMaterial - 用來建立線架構幾何體。
  2. LineDashedMaterial - 用來建立線架構幾何體, with dashed lines.
  3. MeshBasicMaterial - 用來建立簡單陰影的物件,如平面、線架構。
  4. MeshDepthMaterial - 以深淺作為繪製的依據,離攝影機愈遠則越白,反之越黑。
  5. MultiMaterial - A Material to define multiple materials for the same geometry. The geometry decides which material is used for which faces by the faces materialindex. The materialindex corresponds with the index of the material in the materials array.
  6. MeshLambertMaterial - 用來建立非光澤(Lambertian)表面的材質,每一像素計算一次。
  7. MeshNormalMaterial - A material that maps the normal vectors to RGB colors.
  8. MeshPhongMaterial - 用來建立有光澤的表面,每一像素計算一次。
  9. PointsMaterial - 粒子系統的預設材質。
  10. RawShaderMaterial - This class works just like ShaderMaterial, except that definitions of built-in uniforms and attributes are not automatically prepended to the GLSL shader code.
  11. ShaderMaterial
  12. SpriteMaterial - Sprite的材質。

Material Constants

給定參數能夠改變材質的性質、功能:

Side 對應參數side

THREE.FrontSide
THREE.BackSide
THREE.DoubleSide

Shading 對應參數Shading

THREE.FlatShading
THREE.SmoothShading

Colors 對應參數vertexColor

THREE.NoColors
THREE.FaceColors
THREE.VertexColors

Blending Mode 對應參數blending

THREE.NoBlending - 不混合
THREE.NormalBlending - 普通混合
THREE.AdditiveBlending - 相加
THREE.SubtractiveBlending - 相減
THREE.MultiplyBlending - 相乘
THREE.CustomBlending - 自定義

參數

大部分的材質都有共同的參數,不過還是要看情況,有些不同:

繼承自Material:

transparent - 材質是否透明,預設為false。
opacity - 透明度,由0.0到1.0,預設為1。
visible - 預設為true。
needsUpdate - Specifies that the material needs to be updated at the WebGL level. Set it to true if you made changes that need to be reflected in WebGL. This property is automatically set to true when instancing a new material.

其他:

color - 十六進制,幾何體的顏色,預設為0xffffff。
map - 紋理,預設為null。
wireframe - 是否以線架構渲染,布林值。
wireframeLinewidth - 線架構厚度,預設為1。
specular - 材質的反射顏色,Setting this the same color as the diffuse value (times some intensity) makes the material more metallic-looking; setting this to some gray makes the material look more plastic. Default is dark gray.
shininess - specular反射的程度,預設30。
emissive - 材質的放射光顏色,essentially a solid color unaffected by other lighting.預設黑色。
emissiveIntensity - 放射光的強度. Modulates the emissive color. 預設為1。

results matching ""

    No results matching ""