Przeglądaj źródła

Update materials_overview.adoc

Fixed broken new lines.
mitm001 9 lat temu
rodzic
commit
ed6ca79415
1 zmienionych plików z 139 dodań i 20 usunięć
  1. 139 20
      src/docs/asciidoc/jme3/advanced/materials_overview.adoc

+ 139 - 20
src/docs/asciidoc/jme3/advanced/materials_overview.adoc

@@ -16,7 +16,8 @@ In jMonkeyEngine 3, colors and textures are represented as Material objects.
 
 [TIP]
 ====
-Find out quickly <<jme3/intermediate/how_to_use_materials#,How to Use Materials>>, including the most commonly used code samples and RenderStates. +Or find more background info on <<jme3/advanced/material_definitions#,How to use Material Definitions>>.
+Find out quickly <<jme3/intermediate/how_to_use_materials#,How to Use Materials>>, including the most commonly used code samples and RenderStates. +
+Or find more background info on <<jme3/advanced/material_definitions#,How to use Material Definitions>>.
 ====
 
 
@@ -28,7 +29,10 @@ The following Materials table shows you the Material Definitions that jMonkeyEng
 
 [TIP]
 ====
-Looks confusing? +1) Start learning about `Unshaded.j3md` and `Lighting.j3md`, they cover 90% of the cases. +2) Use <<sdk/material_editing#,the SDK's visual material editor>> to try out and save material settings easily. +3) The <<sdk/code_editor#,SDK's Palette>> contains drag&drop code snippets for loading materials. 
+Looks confusing? +
+1) Start learning about `Unshaded.j3md` and `Lighting.j3md`, they cover 90% of the cases. +
+2) Use <<sdk/material_editing#,the SDK's visual material editor>> to try out and save material settings easily. +
+3) The <<sdk/code_editor#,SDK's Palette>> contains drag&drop code snippets for loading materials. 
 ====
 
 
@@ -51,8 +55,19 @@ a| Usage
 <a| Material Parameters  
 
 a| Common/MatDefs/Misc/Unshaded.j3md 
-a| Standard, non-illuminated Materials. +Use this for simple coloring and texturing, glow, and transparency. +See also: <<jme3/beginner/hello_material#,Hello Material>> 
-a| *Texture Maps* +setTexture(“ColorMap, assetManager.loadTexture(“)); + setBoolean(“SeparateTexCoord,true);  +setTexture(“LightMap, assetManager.loadTexture(“)); +*Colors* +setColor(“Color, ColorRGBA.White); +setBoolean(“VertexColor,true); +*Glow* +setTexture(“GlowMap, assetManager.loadTexture(“)); +setColor(“GlowColor, ColorRGBA.White); 
+a| Standard, non-illuminated Materials. +
+Use this for simple coloring and texturing, glow, and transparency. +
+See also: <<jme3/beginner/hello_material#,Hello Material>> 
+a| *Texture Maps* +
+setTexture(“ColorMap, assetManager.loadTexture(“)); +
+setBoolean(“SeparateTexCoord,true); +
+setTexture(“LightMap, assetManager.loadTexture(“)); +
+*Colors* +
+setColor(“Color, ColorRGBA.White); +
+setBoolean(“VertexColor,true); +
+*Glow* +
+setTexture(“GlowMap, assetManager.loadTexture(“)); +
+setColor(“GlowColor, ColorRGBA.White); 
 
 |===
 
@@ -65,20 +80,56 @@ a| Usage
 <a| Material Parameters  
 
 <a| Common/MatDefs/Misc/Sky.j3md            
-a| A solid skyblue, or use with a custom SkyDome texture. +See also: <<jme3/advanced/sky#,Sky>> 
-a| setTexture(“TextureCubeMap, assetManager.loadTexture(“)); + setBoolean(“SphereMap,true); +setVector3(“NormalScale, new Vector3f(0,0,0)); 
+a| A solid skyblue, or use with a custom SkyDome texture. +
+See also: <<jme3/advanced/sky#,Sky>> 
+a| setTexture(“TextureCubeMap, assetManager.loadTexture(“)); +
+setBoolean(“SphereMap,true); +setVector3(“NormalScale, new Vector3f(0,0,0)); 
 
 a| Common/MatDefs/Terrain/Terrain.j3md 
-a| Splat textures for e.g. terrains. +See also: <<jme3/beginner/hello_terrain#,Hello Terrain>> 
-a| setTexture(“Tex1, assetManager.loadTexture(“)); (red) + setFloat(“Tex1Scale,1f); + setTexture(“Tex2, assetManager.loadTexture(“)); (green) + setFloat(“Tex2Scale,1f); +setTexture(“Tex3, assetManager.loadTexture(“)); (blue)  + setFloat(“Tex3Scale,1f); +setTexture(“Alpha, assetManager.loadTexture(“)); 
+a| Splat textures for e.g. terrains. +
+See also: <<jme3/beginner/hello_terrain#,Hello Terrain>> 
+a| setTexture(“Tex1, assetManager.loadTexture(“)); (red) +
+setFloat(“Tex1Scale,1f); +
+setTexture(“Tex2, assetManager.loadTexture(“)); (green) +
+setFloat(“Tex2Scale,1f); +
+setTexture(“Tex3, assetManager.loadTexture(“)); (blue) +
+setFloat(“Tex3Scale,1f); +
+setTexture(“Alpha, assetManager.loadTexture(“)); 
 
 a|Common/MatDefs/Terrain/HeightBasedTerrain.j3md
-a|A multi-layered texture for terrains. +Specify four textures and a Vector3f describing the region in which each texture should appear: +X = start height, +Y = end height, +Z = texture scale. +Texture regions can overlap. +For example: Specify a seafloor texture for the lowest areas, +a sandy texture for the beaches, +a grassy texure for inland areas, +and a rocky texture for mountain tops.
-a| setFloat(“terrainSize,512f); +setTexture(“region1ColorMap, assetManager.loadTexture(“)); +setTexture(“region2ColorMap, assetManager.loadTexture(“)); +setTexture(“region3ColorMap, assetManager.loadTexture(“)); +setTexture(“region4ColorMap, assetManager.loadTexture(“)); +setVector3(“region1, new Vector3f(0,0,0)); + setVector3(“region2, new Vector3f(0,0,0)); + setVector3(“region3, new Vector3f(0,0,0)); + setVector3(“region4, new Vector3f(0,0,0)); +*Settings for steep areas:* +setTexture(“slopeColorMap, assetManager.loadTexture(“)); + setFloat(“slopeTileFactor,1f);
+a|A multi-layered texture for terrains. +
+Specify four textures and a Vector3f describing the region in which each texture should appear: +
+X = start height, +
+Y = end height, +
+Z = texture scale. +
+Texture regions can overlap. +
+For example: Specify a seafloor texture for the lowest areas, +
+a sandy texture for the beaches, +
+a grassy texure for inland areas, +
+and a rocky texture for mountain tops.
+a| setFloat(“terrainSize,512f); +
+setTexture(“region1ColorMap, assetManager.loadTexture(“)); +
+setTexture(“region2ColorMap, assetManager.loadTexture(“)); +
+setTexture(“region3ColorMap, assetManager.loadTexture(“)); +
+setTexture(“region4ColorMap, assetManager.loadTexture(“)); +
+setVector3(“region1, new Vector3f(0,0,0)); +
+setVector3(“region2, new Vector3f(0,0,0)); +
+setVector3(“region3, new Vector3f(0,0,0)); +
+setVector3(“region4, new Vector3f(0,0,0)); +
+*Settings for steep areas:* +
+setTexture(“slopeColorMap, assetManager.loadTexture(“)); +
+setFloat(“slopeTileFactor,1f);
 
 <a| Common/MatDefs/Misc/Particle.j3md       
-a| Used with texture masks for particle effects, or for point sprites. +The Quadratic value scales the particle for perspective view (link:http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/effect/ParticleEmitter.java[formula]). +Does support an optional colored glow effect. +See also: <<jme3/beginner/hello_effects#,Hello Effects>> 
-a| setTexture(“Texture, assetManager.loadTexture(“)); +setTexture(“GlowMap, assetManager.loadTexture(“)); +setColor(“GlowColor, ColorRGBA.White); + setFloat(“Quadratic,1f); + setBoolean(“PointSprite,true); 
+a| Used with texture masks for particle effects, or for point sprites. +
+The Quadratic value scales the particle for perspective view (link:http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/effect/ParticleEmitter.java[formula]). +
+Does support an optional colored glow effect. +
+See also: <<jme3/beginner/hello_effects#,Hello Effects>> 
+a| setTexture(“Texture, assetManager.loadTexture(“)); +
+setTexture(“GlowMap, assetManager.loadTexture(“)); +
+setColor(“GlowColor, ColorRGBA.White); +
+setFloat(“Quadratic,1f); +
+setBoolean(“PointSprite,true); 
 
 |===
 
@@ -99,8 +150,37 @@ a| Usage
 a| Material Parameters 
 
 <a| Common/MatDefs/Light/Lighting.j3md      
-a| Commonly used Material with Phong illumination. +Use this material together with DiffuseMap, SpecularMap, BumpMap (NormalMaps, ParalaxMap) textures. +Supports shininess, transparency, and plain material colors (Diffuse, Ambient, Specular colors). +See also: <<jme3/beginner/hello_material#,Hello Material>> 
-<a| *Texture Maps* +setTexture(“DiffuseMap, assetManager.loadTexture(“)); +setBoolean(“UseAlpha,true);footnote:[UseAlpha specifies whether DiffuseMap uses the alpha channel]  +setTexture(“NormalMap, assetManager.loadTexture(“)); +setBoolean(“LATC,true); footnote:[LATC Specifies whether NormalMap is BC5/ATI2n/LATC/3Dc-compressed]  +setTexture(“SpecularMap, assetManager.loadTexture(“)); + setFloat(“Shininess,64f); +setTexture(“ParallaxMap, assetManager.loadTexture(“)); +setTexture(“AlphaMap, assetManager.loadTexture(“)); + setFloat(“AlphaDiscardThreshold,1f); +setTexture(“ColorRamp, assetManager.loadTexture(“)); +*Glow* +setTexture(“GlowMap, assetManager.loadTexture(“)); +setColor(“GlowColor, ColorRGBA.White); +*Performance and quality* +setBoolean(“VertexLighting,true); +  setBoolean(“UseVertexColor,true); + setBoolean(“LowQuality,true); + setBoolean(“HighQuality,true); +*Material Colors* + setBoolean(“UseMaterialColors,true); +setColor(“Diffuse, ColorRGBA.White); + setColor(“Ambient, ColorRGBA.White); +setColor(“Specular, ColorRGBA.White); +*Tangent shading:* + setBoolean(“VTangent,true); + setBoolean(“Minnaert,true);footnote:[Minnaert is a shader type.] +setBoolean(“WardIso,true);footnote:[WardIso is a shader type.]  
+a| Commonly used Material with Phong illumination. +
+Use this material together with DiffuseMap, SpecularMap, BumpMap (NormalMaps, ParalaxMap) textures. +
+Supports shininess, transparency, and plain material colors (Diffuse, Ambient, Specular colors). +
+See also: <<jme3/beginner/hello_material#,Hello Material>> 
+<a| *Texture Maps* +
+setTexture(“DiffuseMap, assetManager.loadTexture(“)); +
+setBoolean(“UseAlpha,true); footnote:[UseAlpha specifies whether DiffuseMap uses the alpha channel]  +
+setTexture(“NormalMap, assetManager.loadTexture(“)); +
+setBoolean(“LATC,true); footnote:[LATC Specifies whether NormalMap is BC5/ATI2n/LATC/3Dc-compressed]  +
+setTexture(“SpecularMap, assetManager.loadTexture(“)); +
+setFloat(“Shininess,64f); +
+setTexture(“ParallaxMap, assetManager.loadTexture(“)); +
+setTexture(“AlphaMap, assetManager.loadTexture(“)); +
+setFloat(“AlphaDiscardThreshold,1f); +
+setTexture(“ColorRamp, assetManager.loadTexture(“)); +
+*Glow* +setTexture(“GlowMap, assetManager.loadTexture(“)); +
+setColor(“GlowColor, ColorRGBA.White); +
+*Performance and quality* +
+setBoolean(“VertexLighting,true); +
+setBoolean(“UseVertexColor,true); +
+setBoolean(“LowQuality,true); +
+setBoolean(“HighQuality,true); +
+*Material Colors* +
+setBoolean(“UseMaterialColors,true); +
+setColor(“Diffuse, ColorRGBA.White); +
+setColor(“Ambient, ColorRGBA.White); +
+setColor(“Specular, ColorRGBA.White); +
+*Tangent shading:* +
+setBoolean(“VTangent,true); +
+setBoolean(“Minnaert,true); footnote:[Minnaert is a shader type.] +
+setBoolean(“WardIso,true); footnote:[WardIso is a shader type.]  
 
 |===
 [cols="3", options="header"]
@@ -111,12 +191,48 @@ a| Usage
 a| Material Parameters 
 
 a|Common/MatDefs/Terrain/TerrainLighting.j3md
-a|Same kind of multi-layered splat texture as Terrain.j3md, but with illumination and shading. +Typically used for terrains, but works on any mesh. +For every 3 splat textures, you need one alpha map. +You can use a total of 11 texture maps in the terrain's splat texture: +Note that diffuse and normal maps all count against that. +For example, you can use a maximum of 9 diffuse textures, two of which can have normal maps; +or, five textures with both diffuse and normal maps.
-a|*Texture Splat Maps* + setTexture(“DiffuseMap, assetManager.loadTexture(“)); + setFloat(“DiffuseMap_0_scale,1f); +setTexture(“NormalMap, assetManager.loadTexture(“)); +setTexture(“DiffuseMap_1, assetManager.loadTexture(“)); + setFloat(“DiffuseMap_1_scale,1f); +setTexture(“NormalMap_1, assetManager.loadTexture(“)); +setTexture(“DiffuseMap_2, assetManager.loadTexture(“)); + setFloat(“DiffuseMap_2_scale,1f); +setTexture(“NormalMap_2, assetManager.loadTexture(“)); +setTexture(“DiffuseMap_3, assetManager.loadTexture(“)); + setFloat(“DiffuseMap_3_scale,1f); +setTexture(“NormalMap_3, assetManager.loadTexture(“)); +etc, up to 11. +*Alpha Maps* +setTexture(“AlphaMap, assetManager.loadTexture(“)); +setTexture(“AlphaMap_1, assetManager.loadTexture(“)); +setTexture(“AlphaMap_2, assetManager.loadTexture(“)); +*Glowing* +setTexture(“GlowMap, assetManager.loadTexture(“)); +setColor(“GlowColor, ColorRGBA.White); +*Miscellaneous* +setColor(“Diffuse, ColorRGBA.White); +setColor(“Ambient, ColorRGBA.White); +setFloat(“Shininess,64f); +setColor(“Specular, ColorRGBA.White); +setTexture(“SpecularMap, assetManager.loadTexture(“)); +setBoolean(“WardIso,true); + setBoolean(“useTriPlanarMapping,true); + setBoolean(“isTerrainGrid,true); 
+a|Same kind of multi-layered splat texture as Terrain.j3md, but with illumination and shading. +
+Typically used for terrains, but works on any mesh. +
+For every 3 splat textures, you need one alpha map. +
+You can use a total of 11 texture maps in the terrain's splat texture: +
+Note that diffuse and normal maps all count against that. +
+For example, you can use a maximum of 9 diffuse textures, two of which can have normal maps; +
+or, five textures with both diffuse and normal maps.
+a|*Texture Splat Maps* +
+setTexture(“DiffuseMap, assetManager.loadTexture(“)); +
+setFloat(“DiffuseMap_0_scale,1f); +
+setTexture(“NormalMap, assetManager.loadTexture(“)); +
+setTexture(“DiffuseMap_1, assetManager.loadTexture(“)); +
+setFloat(“DiffuseMap_1_scale,1f); +
+setTexture(“NormalMap_1, assetManager.loadTexture(“)); +
+setTexture(“DiffuseMap_2, assetManager.loadTexture(“)); +
+setFloat(“DiffuseMap_2_scale,1f); +
+setTexture(“NormalMap_2, assetManager.loadTexture(“)); +
+setTexture(“DiffuseMap_3, assetManager.loadTexture(“)); +
+setFloat(“DiffuseMap_3_scale,1f); +
+setTexture(“NormalMap_3, assetManager.loadTexture(“)); +
+etc, up to 11. +
+*Alpha Maps* +
+setTexture(“AlphaMap, assetManager.loadTexture(“)); +
+setTexture(“AlphaMap_1, assetManager.loadTexture(“)); +
+setTexture(“AlphaMap_2, assetManager.loadTexture(“)); +
+*Glowing* +
+setTexture(“GlowMap, assetManager.loadTexture(“)); +
+setColor(“GlowColor, ColorRGBA.White); +
+*Miscellaneous* +
+setColor(“Diffuse, ColorRGBA.White); +
+setColor(“Ambient, ColorRGBA.White); +
+setFloat(“Shininess,64f); +
+setColor(“Specular, ColorRGBA.White); +
+setTexture(“SpecularMap, assetManager.loadTexture(“)); +
+setBoolean(“WardIso,true); +
+setBoolean(“useTriPlanarMapping,true); +
+setBoolean(“isTerrainGrid,true); 
 
 <a| Common/MatDefs/Light/Reflection.j3md    
 a| Reflective glass material with environment map (CubeMap/SphereMap). See also: link:http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/texture/TestCubeMap.java[TestCubeMap.java] 
-a| setTexture(“Texture, assetManager.loadTexture(“)); + setBoolean(“SphereMap,true); 
+a| setTexture(“Texture, assetManager.loadTexture(“)); +
+setBoolean(“SphereMap,true); 
 
 |===
 
@@ -157,12 +273,15 @@ a|getAdditionalRenderState().setDepthWrite(false);
 a|Disables writing of the pixel's depth value to the depth buffer.
 a|Use this on Materials if you have several transparent/translucent objects obscuring one another, but you want to see through both.
 
-a|getAdditionalRenderState().setAlphaFallOff(0.5f); +getAdditionalRenderState().setAlphaTest(true)
+a|getAdditionalRenderState().setAlphaFallOff(0.5f); +
+getAdditionalRenderState().setAlphaTest(true)
 a|Enables Alpha Testing with a “AlphaDiscardThreshold in the AlphaMap.
-a|Activate Alpha Testing for (partially) *transparent* objects such as foliage, hair, etc. +Deactivate Alpha Testing for gradually *translucent* objects, such as colored glass, smoked glass, ghosts.
+a|Activate Alpha Testing for (partially) *transparent* objects such as foliage, hair, etc. +
+Deactivate Alpha Testing for gradually *translucent* objects, such as colored glass, smoked glass, ghosts.
 
 a|getAdditionalRenderState().setBlendMode(BlendMode.Additive);
-a|Additive alpha blending adds colors in a commutative way, i.e. the result does not depend on the order of transparent layers, since it adds the scene's background pixel color to the current pixel color. This is useful if you have lots of transparent textures overlapping and don't care about the order. +*Note:* Viewed in front of a white background, Additive textures become fully transparent! 
+a|Additive alpha blending adds colors in a commutative way, i.e. the result does not depend on the order of transparent layers, since it adds the scene's background pixel color to the current pixel color. This is useful if you have lots of transparent textures overlapping and don't care about the order. +
+*Note:* Viewed in front of a white background, Additive textures become fully transparent! 
 a| This is the default for Particle.j3md-based textures that have a black color background. 
 
 a|getAdditionalRenderState().setBlendMode(BlendMode.AlphaAdditive);