|
@@ -12,37 +12,37 @@ Or find more background info on <a href="../../jme3/advanced/material_definition
|
|
|
<div class="paragraph"><p>Most Material parameters are optional. For example, it is okay to specify solely the <code>DiffuseMap</code> and <code>NormalMap</code> when using <code>Lighting.j3md</code>, and leave the other texture maps empty. In this case, you are only using a subset of the possible features, but that’s fine if it already makes in the material look the way that you want. You can always add more texture maps later.</p></div>
|
|
|
<div class="sect2"><h3 id="unshaded-coloring-and-textures">Unshaded Coloring and Textures</h3><div class="paragraph"><p>jMonkeyEngine supports illuminated and unshaded Material Definitions.</p></div>
|
|
|
<div class="ulist"><ul><li><p>Phong Illuminated materials look more naturalistic.</p></li><li><p>Unshaded materials look more abstract.</p></li></ul></div>
|
|
|
-<div class="paragraph"><p>“Unshaded materials look somewhat abstract because they ignore lighting and shading. Unshaded Materials work even if the scene does not include a light source. These Materials can be single-colored or textured. For example, they are used for cards and tiles, for the sky, billboards and UI elements, for toon-style games, or for testing.</p></div>
|
|
|
-<table class="tableblock frame-all grid-all spread"><caption class="title">Table 1. Standard Unshaded</caption><colgroup><col style="width: 20%;"><col style="width: 40%;"><col style="width: 40%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Definition</th><th class="tableblock halign-left valign-top">Usage</th><th class="tableblock halign-left valign-top">Material Parameters</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Misc/<br>
|
|
|
+<div class="paragraph"><p>“Unshaded” materials look somewhat abstract because they ignore lighting and shading. Unshaded Materials work even if the scene does not include a light source. These Materials can be single-colored or textured. For example, they are used for cards and tiles, for the sky, billboards and UI elements, for toon-style games, or for testing.</p></div>
|
|
|
+<table class="tableblock frame-all grid-all spread"><caption class="title">Table 1. Standard Unshaded</caption><colgroup><col style="width: 20%;"><col style="width: 35%;"><col style="width: 45%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Definition</th><th class="tableblock halign-left valign-top">Usage</th><th class="tableblock halign-left valign-top">Material Parameters</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Misc/<br>
|
|
|
Unshaded.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Standard, non-illuminated Materials.<br>
|
|
|
Use this for simple coloring and texturing, glow, and transparency.<br>
|
|
|
See also: <a href="../../jme3/beginner/hello_material.html">Hello Material</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p><strong>Texture Maps</strong><br>
|
|
|
-setTexture(“ColorMap, assetManager.loadTexture(“));<br>
|
|
|
-setBoolean(“SeparateTexCoord,true);<br>
|
|
|
-setTexture(“LightMap, assetManager.loadTexture(“));<br>
|
|
|
+setTexture(“ColorMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setBoolean(“SeparateTexCoord”,true);<br>
|
|
|
+setTexture(“LightMap”, assetManager.loadTexture(“name”));<br>
|
|
|
<strong>Colors</strong><br>
|
|
|
-setColor(“Color, ColorRGBA.White);<br>
|
|
|
-setBoolean(“VertexColor,true);<br>
|
|
|
+setColor(“Color”, ColorRGBA.White);<br>
|
|
|
+setBoolean(“VertexColor”,true);<br>
|
|
|
<strong>Glow</strong><br>
|
|
|
-setTexture(“GlowMap, assetManager.loadTexture(“));<br>
|
|
|
-setColor(“GlowColor, ColorRGBA.White);</p></div></div></td></tr></tbody></table>
|
|
|
+setTexture(“GlowMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setColor(“GlowColor”, ColorRGBA.White);</p></div></div></td></tr></tbody></table>
|
|
|
<div class="paragraph"><p>Other useful, but less commonly used material definitions:</p></div>
|
|
|
-<table class="tableblock frame-all grid-all spread"><caption class="title">Table 2. Special Unshaded</caption><colgroup><col style="width: 20%;"><col style="width: 40%;"><col style="width: 40%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Definition</th><th class="tableblock halign-left valign-top">Usage</th><th class="tableblock halign-left valign-top">Material Parameters</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Misc/<br>
|
|
|
+<table class="tableblock frame-all grid-all spread"><caption class="title">Table 2. Special Unshaded</caption><colgroup><col style="width: 20%;"><col style="width: 35%;"><col style="width: 45%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Definition</th><th class="tableblock halign-left valign-top">Usage</th><th class="tableblock halign-left valign-top">Material Parameters</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Misc/<br>
|
|
|
Sky.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>A solid skyblue, or use with a custom SkyDome texture.<br>
|
|
|
-See also: <a href="../../jme3/advanced/sky.html">Sky</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTexture(“TextureCubeMap, assetManager.loadTexture(“));<br>
|
|
|
-setBoolean(“SphereMap,true);<br>
|
|
|
-setVector3(“NormalScale, new Vector3f(0,0,0));</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Terrain/<br>
|
|
|
+See also: <a href="../../jme3/advanced/sky.html">Sky</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTexture(“TextureCubeMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setBoolean(“SphereMap”,true);<br>
|
|
|
+setVector3(“NormalScale”, new Vector3f(0,0,0));</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Terrain/<br>
|
|
|
Terrain.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Splat textures for e.g. terrains.<br>
|
|
|
-See also: <a href="../../jme3/beginner/hello_terrain.html">Hello Terrain</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTexture(“Tex1, assetManager.loadTexture(“));<br>
|
|
|
+See also: <a href="../../jme3/beginner/hello_terrain.html">Hello Terrain</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTexture(“Tex1”, assetManager.loadTexture(“name”));<br>
|
|
|
(red)<br>
|
|
|
-setFloat(“Tex1Scale,1f);<br>
|
|
|
-setTexture(“Tex2, assetManager.loadTexture(“));<br>
|
|
|
+setFloat(“Tex1Scale”,1f);<br>
|
|
|
+setTexture(“Tex2”, assetManager.loadTexture(“name”));<br>
|
|
|
(green)<br>
|
|
|
-setFloat(“Tex2Scale,1f);<br>
|
|
|
-setTexture(“Tex3, assetManager.loadTexture(“));<br>
|
|
|
+setFloat(“Tex2Scale”,1f);<br>
|
|
|
+setTexture(“Tex3”, assetManager.loadTexture(“name”));<br>
|
|
|
(blue)<br>
|
|
|
-setFloat(“Tex3Scale,1f);<br>
|
|
|
-setTexture(“Alpha, assetManager.loadTexture(“));</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Terrain/<br>
|
|
|
+setFloat(“Tex3Scale”,1f);<br>
|
|
|
+setTexture(“Alpha”, assetManager.loadTexture(“name”));</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Terrain/<br>
|
|
|
HeightBasedTerrain.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>A multi-layered texture for terrains.<br>
|
|
|
Specify four textures and a Vector3f describing the region in which each texture should appear:<br>
|
|
|
X = start height,<br>
|
|
@@ -52,61 +52,61 @@ Texture regions can overlap.<br>
|
|
|
For example: Specify a seafloor texture for the lowest areas,<br>
|
|
|
a sandy texture for the beaches,<br>
|
|
|
a grassy texure for inland areas,<br>
|
|
|
-and a rocky texture for mountain tops.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setFloat(“terrainSize,512f);<br>
|
|
|
-setTexture(“region1ColorMap, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“region2ColorMap, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“region3ColorMap, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“region4ColorMap, assetManager.loadTexture(“));<br>
|
|
|
-setVector3(“region1, new Vector3f(0,0,0));<br>
|
|
|
-setVector3(“region2, new Vector3f(0,0,0));<br>
|
|
|
-setVector3(“region3, new Vector3f(0,0,0));<br>
|
|
|
-setVector3(“region4, new Vector3f(0,0,0));<br>
|
|
|
+and a rocky texture for mountain tops.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setFloat(“terrainSize”,512f);<br>
|
|
|
+setTexture(“region1ColorMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“region2ColorMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“region3ColorMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“region4ColorMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setVector3(“region1”, new Vector3f(0,0,0));<br>
|
|
|
+setVector3(“region2”, new Vector3f(0,0,0));<br>
|
|
|
+setVector3(“region3”, new Vector3f(0,0,0));<br>
|
|
|
+setVector3(“region4”, new Vector3f(0,0,0));<br>
|
|
|
<strong>Settings for steep areas:</strong><br>
|
|
|
-setTexture(“slopeColorMap, assetManager.loadTexture(“));<br>
|
|
|
-setFloat(“slopeTileFactor,1f);</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Misc/<br>
|
|
|
+setTexture(“slopeColorMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setFloat(“slopeTileFactor”,1f);</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Misc/<br>
|
|
|
Particle.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Used with texture masks for particle effects, or for point sprites.<br>
|
|
|
The Quadratic value scales the particle for perspective view (<a href="https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java">formula</a>).<br>
|
|
|
Does support an optional colored glow effect.<br>
|
|
|
-See also: <a href="../../jme3/beginner/hello_effects.html">Hello Effects</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTexture(“Texture, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“GlowMap, assetManager.loadTexture(“));<br>
|
|
|
-setColor(“GlowColor, ColorRGBA.White);<br>
|
|
|
-setFloat(“Quadratic,1f);<br>
|
|
|
-setBoolean(“PointSprite,true);</p></div></div></td></tr></tbody></table></div>
|
|
|
+See also: <a href="../../jme3/beginner/hello_effects.html">Hello Effects</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTexture(“Texture”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“GlowMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setColor(“GlowColor”, ColorRGBA.White);<br>
|
|
|
+setFloat(“Quadratic”,1f);<br>
|
|
|
+setBoolean(“PointSprite”,true);</p></div></div></td></tr></tbody></table></div>
|
|
|
<div class="sect2"><h3 id="phong-illuminated">Phong Illuminated</h3><div class="paragraph"><p>jMonkeyEngine supports illuminated and unshaded Material Definitions.</p></div>
|
|
|
<div class="ulist"><ul><li><p>Phong Illuminated materials look more naturalistic.</p></li><li><p>Unshaded materials look more abstract.</p></li></ul></div>
|
|
|
<div class="paragraph"><p>Illuminated materials require a <a href="../../jme3/advanced/light_and_shadow.html">light source</a> added to at least one of their parent nodes! (e.g. rootNode.) Illuminated materials are darker on the sides facing away from light sources. They use Phong illumination model (default), or the Ward isotropic gaussian specular shader (WardIso) which looks more like plastic. They do not cast <a href="../../jme3/advanced/light_and_shadow.html">drop shadows</a> unless you use a FilterPostProcessor.</p></div>
|
|
|
-<table class="tableblock frame-all grid-all spread"><caption class="title">Table 3. Standard Illuminated</caption><colgroup><col style="width: 20%;"><col style="width: 40%;"><col style="width: 40%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Definition</th><th class="tableblock halign-left valign-top">Usage</th><th class="tableblock halign-left valign-top">Material Parameters</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Light/<br>
|
|
|
+<table class="tableblock frame-all grid-all spread"><caption class="title">Table 3. Standard Illuminated</caption><colgroup><col style="width: 20%;"><col style="width: 35%;"><col style="width: 45%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Definition</th><th class="tableblock halign-left valign-top">Usage</th><th class="tableblock halign-left valign-top">Material Parameters</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Light/<br>
|
|
|
Lighting.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Commonly used Material with Phong illumination.<br>
|
|
|
Use this material together with DiffuseMap, SpecularMap, BumpMap (NormalMaps, ParalaxMap) textures.<br>
|
|
|
Supports shininess, transparency, and plain material colors (Diffuse, Ambient, Specular colors).<br>
|
|
|
See also: <a href="../../jme3/beginner/hello_material.html">Hello Material</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p><strong>Texture Maps</strong><br>
|
|
|
-setTexture(“DiffuseMap, assetManager.loadTexture(“));<br>
|
|
|
-setBoolean(“UseAlpha,true); <span class="footnote">[<a class="footnote" id="_footnoteref_1" href="#_footnote_1" title="View footnote.">1</a>]</span> <br>
|
|
|
-setTexture(“NormalMap, assetManager.loadTexture(“));<br>
|
|
|
-setBoolean(“LATC,true); <span class="footnote">[<a class="footnote" id="_footnoteref_2" href="#_footnote_2" title="View footnote.">2</a>]</span> <br>
|
|
|
-setTexture(“SpecularMap, assetManager.loadTexture(“));<br>
|
|
|
-setFloat(“Shininess,64f);<br>
|
|
|
-setTexture(“ParallaxMap, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“AlphaMap, assetManager.loadTexture(“));<br>
|
|
|
-setFloat(“AlphaDiscardThreshold,1f);<br>
|
|
|
-setTexture(“ColorRamp, assetManager.loadTexture(“));<br>
|
|
|
+setTexture(“DiffuseMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setBoolean(“UseAlpha”,true); <span class="footnote">[<a class="footnote" id="_footnoteref_1" href="#_footnote_1" title="View footnote.">1</a>]</span> <br>
|
|
|
+setTexture(“NormalMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setBoolean(“LATC”,true); <span class="footnote">[<a class="footnote" id="_footnoteref_2" href="#_footnote_2" title="View footnote.">2</a>]</span> <br>
|
|
|
+setTexture(“SpecularMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setFloat(“Shininess”,64f);<br>
|
|
|
+setTexture(“ParallaxMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“AlphaMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setFloat(“AlphaDiscardThreshold”,1f);<br>
|
|
|
+setTexture(“ColorRamp”, assetManager.loadTexture(“name”));<br>
|
|
|
<strong>Glow</strong><br>
|
|
|
-setTexture(“GlowMap, assetManager.loadTexture(“));<br>
|
|
|
-setColor(“GlowColor, ColorRGBA.White);<br>
|
|
|
+setTexture(“GlowMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setColor(“GlowColor”, ColorRGBA.White);<br>
|
|
|
<strong>Performance and quality</strong><br>
|
|
|
-setBoolean(“VertexLighting,true);<br>
|
|
|
-setBoolean(“UseVertexColor,true);<br>
|
|
|
-setBoolean(“LowQuality,true);<br>
|
|
|
-setBoolean(“HighQuality,true);<br>
|
|
|
+setBoolean(“VertexLighting”,true);<br>
|
|
|
+setBoolean(“UseVertexColor”,true);<br>
|
|
|
+setBoolean(“LowQuality”,true);<br>
|
|
|
+setBoolean(“HighQuality”,true);<br>
|
|
|
<strong>Material Colors</strong><br>
|
|
|
-setBoolean(“UseMaterialColors,true);<br>
|
|
|
-setColor(“Diffuse, ColorRGBA.White);<br>
|
|
|
-setColor(“Ambient, ColorRGBA.White);<br>
|
|
|
-setColor(“Specular, ColorRGBA.White);<br>
|
|
|
+setBoolean(“UseMaterialColors”,true);<br>
|
|
|
+setColor(“Diffuse”, ColorRGBA.White);<br>
|
|
|
+setColor(“Ambient”, ColorRGBA.White);<br>
|
|
|
+setColor(“Specular”, ColorRGBA.White);<br>
|
|
|
<strong>Tangent shading:</strong><br>
|
|
|
-setBoolean(“VTangent,true);<br>
|
|
|
-setBoolean(“Minnaert,true); <span class="footnote">[<a class="footnote" id="_footnoteref_3" href="#_footnote_3" title="View footnote.">3</a>]</span><br>
|
|
|
-setBoolean(“WardIso,true); <span class="footnote">[<a class="footnote" id="_footnoteref_4" href="#_footnote_4" title="View footnote.">4</a>]</span></p></div><div id="footnotes"><hr><div class="footnote" id="_footnote_1"><a href="#_footnoteref_1">1</a>. UseAlpha specifies whether DiffuseMap uses the alpha channel</div><div class="footnote" id="_footnote_2"><a href="#_footnoteref_2">2</a>. LATC Specifies whether NormalMap is BC5/ATI2n/LATC/3Dc-compressed</div><div class="footnote" id="_footnote_3"><a href="#_footnoteref_3">3</a>. Minnaert is a shader type.</div><div class="footnote" id="_footnote_4"><a href="#_footnoteref_4">4</a>. WardIso is a shader type.</div></div></div></td></tr></tbody></table>
|
|
|
+setBoolean(“VTangent”,true);<br>
|
|
|
+setBoolean(“Minnaert”,true); <span class="footnote">[<a class="footnote" id="_footnoteref_3" href="#_footnote_3" title="View footnote.">3</a>]</span><br>
|
|
|
+setBoolean(“WardIso”,true); <span class="footnote">[<a class="footnote" id="_footnoteref_4" href="#_footnote_4" title="View footnote.">4</a>]</span></p></div><div id="footnotes"><hr><div class="footnote" id="_footnote_1"><a href="#_footnoteref_1">1</a>. UseAlpha specifies whether DiffuseMap uses the alpha channel</div><div class="footnote" id="_footnote_2"><a href="#_footnoteref_2">2</a>. LATC Specifies whether NormalMap is BC5/ATI2n/LATC/3Dc-compressed</div><div class="footnote" id="_footnote_3"><a href="#_footnoteref_3">3</a>. Minnaert is a shader type.</div><div class="footnote" id="_footnote_4"><a href="#_footnoteref_4">4</a>. WardIso is a shader type.</div></div></div></td></tr></tbody></table>
|
|
|
<table class="tableblock frame-all grid-all spread"><caption class="title">Table 4. Special Illuminated</caption><colgroup><col style="width: 20%;"><col style="width: 40%;"><col style="width: 40%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Definitions</th><th class="tableblock halign-left valign-top">Usage</th><th class="tableblock halign-left valign-top">Material Parameters</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Terrain/<br>
|
|
|
TerrainLighting.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Same kind of multi-layered splat texture as Terrain.j3md, but with illumination and shading.<br>
|
|
|
Typically used for terrains, but works on any mesh.<br>
|
|
@@ -115,37 +115,37 @@ You can use a total of 11 texture maps in the terrain’s splat texture:<br>
|
|
|
Note that diffuse and normal maps all count against that.<br>
|
|
|
For example, you can use a maximum of 9 diffuse textures, two of which can have normal maps;<br>
|
|
|
or, five textures with both diffuse and normal maps.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p><strong>Texture Splat Maps</strong><br>
|
|
|
-setTexture(“DiffuseMap, assetManager.loadTexture(“));<br>
|
|
|
-setFloat(“DiffuseMap_0_scale,1f);<br>
|
|
|
-setTexture(“NormalMap, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“DiffuseMap_1, assetManager.loadTexture(“));<br>
|
|
|
-setFloat(“DiffuseMap_1_scale,1f);<br>
|
|
|
-setTexture(“NormalMap_1, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“DiffuseMap_2, assetManager.loadTexture(“));<br>
|
|
|
-setFloat(“DiffuseMap_2_scale,1f);<br>
|
|
|
-setTexture(“NormalMap_2, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“DiffuseMap_3, assetManager.loadTexture(“));<br>
|
|
|
-setFloat(“DiffuseMap_3_scale,1f);<br>
|
|
|
-setTexture(“NormalMap_3, assetManager.loadTexture(“));<br>
|
|
|
+setTexture(“DiffuseMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setFloat(“DiffuseMap_0_scale”,1f);<br>
|
|
|
+setTexture(“NormalMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“DiffuseMap_1”, assetManager.loadTexture(“name”));<br>
|
|
|
+setFloat(“DiffuseMap_1_scale”,1f);<br>
|
|
|
+setTexture(“NormalMap_1”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“DiffuseMap_2”, assetManager.loadTexture(“name”));<br>
|
|
|
+setFloat(“DiffuseMap_2_scale”,1f);<br>
|
|
|
+setTexture(“NormalMap_2”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“DiffuseMap_3”, assetManager.loadTexture(“name”));<br>
|
|
|
+setFloat(“DiffuseMap_3_scale”,1f);<br>
|
|
|
+setTexture(“NormalMap_3”, assetManager.loadTexture(“name”));<br>
|
|
|
etc, up to 11.<br>
|
|
|
<strong>Alpha Maps</strong><br>
|
|
|
-setTexture(“AlphaMap, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“AlphaMap_1, assetManager.loadTexture(“));<br>
|
|
|
-setTexture(“AlphaMap_2, assetManager.loadTexture(“));<br>
|
|
|
+setTexture(“AlphaMap”, assetManager.loadTexture("name"));<br>
|
|
|
+setTexture(“AlphaMap_1”, assetManager.loadTexture(“name”));<br>
|
|
|
+setTexture(“AlphaMap_2”, assetManager.loadTexture(“name”));<br>
|
|
|
<strong>Glowing</strong><br>
|
|
|
-setTexture(“GlowMap, assetManager.loadTexture(“));<br>
|
|
|
-setColor(“GlowColor, ColorRGBA.White);<br>
|
|
|
+setTexture(“GlowMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setColor(“GlowColor”, ColorRGBA.White);<br>
|
|
|
<strong>Miscellaneous</strong><br>
|
|
|
-setColor(“Diffuse, ColorRGBA.White);<br>
|
|
|
-setColor(“Ambient, ColorRGBA.White);<br>
|
|
|
-setFloat(“Shininess,64f);<br>
|
|
|
-setColor(“Specular, ColorRGBA.White);<br>
|
|
|
-setTexture(“SpecularMap, assetManager.loadTexture(“));<br>
|
|
|
-setBoolean(“WardIso,true);<br>
|
|
|
-setBoolean(“useTriPlanarMapping,true);<br>
|
|
|
-setBoolean(“isTerrainGrid,true);</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Light/<br>
|
|
|
-Reflection.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Reflective glass material with environment map (CubeMap/SphereMap). See also: <a href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/texture/TestCubeMap.java">TestCubeMap.java</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTexture(“Texture, assetManager.loadTexture(“));<br>
|
|
|
-setBoolean(“SphereMap,true);</p></div></div></td></tr></tbody></table></div>
|
|
|
+setColor(“Diffuse”, ColorRGBA.White);<br>
|
|
|
+setColor(“Ambient”, ColorRGBA.White);<br>
|
|
|
+setFloat(“Shininess”,64f);<br>
|
|
|
+setColor(“Specular”, ColorRGBA.White);<br>
|
|
|
+setTexture(“SpecularMap”, assetManager.loadTexture(“name”));<br>
|
|
|
+setBoolean(“WardIso”,true);<br>
|
|
|
+setBoolean(“useTriPlanarMapping”,true);<br>
|
|
|
+setBoolean(“isTerrainGrid”,true);</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Light/<br>
|
|
|
+Reflection.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Reflective glass material with environment map (CubeMap/SphereMap). See also: <a href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/texture/TestCubeMap.java">TestCubeMap.java</a></p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTexture(“Texture”, assetManager.loadTexture(“name”));<br>
|
|
|
+setBoolean(“SphereMap”,true);</p></div></div></td></tr></tbody></table></div>
|
|
|
<div class="sect2"><h3 id="other-test-and-debug">Other: Test and Debug</h3><table class="tableblock frame-all grid-all spread"><caption class="title">Table 5. Testing</caption><colgroup><col style="width: 20%;"><col style="width: 80%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Definition</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Common/MatDefs/Misc/<br>
|
|
|
ShowNormals.j3md</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>A color gradient calculated from the model’s surface normals. You can use this built-in material to debug the generation of normals in meshes, to preview models that have no material and no lights, or as fall-back default material. This built-in material has no parameters.</p></div></div></td></tr></tbody></table></div></div>
|
|
|
<div class="sect1"><h2 id="renderstates">RenderStates</h2><div class="sectionbody"><table class="tableblock frame-all grid-all spread"><caption class="title">Table 6. Transparancy</caption><colgroup><col style="width: 33.3333%;"><col style="width: 33.3333%;"><col style="width: 33.3334%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Option</th><th class="tableblock halign-left valign-top">Description</th><th class="tableblock halign-left valign-top">Example</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState().<br>
|
|
@@ -154,15 +154,15 @@ setBlendMode(BlendMode.Off);</p></div></div></td><td class="tableblock halign-le
|
|
|
.setDepthWrite(false);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Disables writing of the pixel’s depth value to the depth buffer.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Use this on Materials if you have several transparent/translucent objects obscuring one another, but you want to see through both.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
.setAlphaFallOff(0.5f);<br>
|
|
|
getAdditionalRenderState()<br>
|
|
|
-.setAlphaTest(true)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Enables Alpha Testing with a “AlphaDiscardThreshold in the AlphaMap.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Activate Alpha Testing for (partially) <strong>transparent</strong> objects such as foliage, hair, etc.<br>
|
|
|
+.setAlphaTest(true)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Enables Alpha Testing with a “AlphaDiscardThreshold” in the AlphaMap.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Activate Alpha Testing for (partially) <strong>transparent</strong> objects such as foliage, hair, etc.<br>
|
|
|
Deactivate Alpha Testing for gradually <strong>translucent</strong> objects, such as colored glass, smoked glass, ghosts.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
.setBlendMode(BlendMode.Additive);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>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.<br>
|
|
|
<strong>Note:</strong> Viewed in front of a white background, Additive textures become fully transparent!</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>This is the default for Particle.j3md-based textures that have a black color background.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
-.setBlendMode(BlendMode.AlphaAdditive);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Same as “Additive, except first it multiplies the current pixel color by the pixel alpha.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>This can be used for particle effects that have alpha as background.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
+.setBlendMode(BlendMode.AlphaAdditive);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Same as “Additive”, except first it multiplies the current pixel color by the pixel alpha.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>This can be used for particle effects that have alpha as background.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
.setBlendMode(BlendMode.Color);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Blends by color.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Generally useless.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
.setBlendMode(BlendMode.Modulate);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Multiplies the background pixel by the current pixel.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>?</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
-.setBlendMode(BlendMode.ModulateX2);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Same as “Modulate, except the result is doubled.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>?</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
-.setBlendMode(BlendMode.PremultAlpha);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Pre-multiplied alpha blending. E.g. if the color of the object has already been multiplied by its alpha, this is used instead of “Alpha blend mode.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>For use with Premult Alpha textures.</p></div></div></td></tr></tbody></table>
|
|
|
+.setBlendMode(BlendMode.ModulateX2);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Same as “Modulate”, except the result is doubled.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>?</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
+.setBlendMode(BlendMode.PremultAlpha);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Pre-multiplied alpha blending. E.g. if the color of the object has already been multiplied by its alpha, this is used instead of “Alpha” blend mode.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>For use with Premult Alpha textures.</p></div></div></td></tr></tbody></table>
|
|
|
<div class="paragraph"><p>If the DiffuseMap has an alpha channel, use:</p></div>
|
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java">mat.setBoolean(<span class="string"><span class="delimiter">"</span><span class="content">UseAlpha</span><span class="delimiter">"</span></span>,<span class="predefined-constant">true</span>);</code></pre></div></div>
|
|
|
<div class="paragraph"><p>Later, put the Geometry (not the Material!) in the appropriate render queue.</p></div>
|
|
@@ -176,10 +176,10 @@ Deactivate Alpha Testing for gradually <strong>translucent</strong> objects, suc
|
|
|
.setFaceCullMode(FaceCullMode.FrontAndBack)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Culls both backfaces and frontfaces.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Use this as an efficient way to make an object temporarily invisible, while keeping all its other in-game properties (such as node attachment, collision shapes, interactions, etc) active.</p></div></div></td></tr></tbody></table>
|
|
|
<table class="tableblock frame-all grid-all spread"><caption class="title">Table 8. Miscellaneous</caption><colgroup><col style="width: 33.3333%;"><col style="width: 33.3333%;"><col style="width: 33.3334%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Material Option</th><th class="tableblock halign-left valign-top">Useage</th><th class="tableblock halign-left valign-top">Example</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
.setColorWrite(false);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Disable writing the color of pixels.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Use this together with setDepthWrite(true) to write pixels only to the depth buffer, for example.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
-.setPointSprite(true);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Enables point-sprite mode, e.g. meshes with “Mode.Points will be rendered as textured sprites. Note that gl_PointCoord must be set in the shader.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Point sprites are used internally for hardware accelerated particle effects.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
+.setPointSprite(true);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Enables point-sprite mode, e.g. meshes with “Mode”.Points will be rendered as textured sprites. Note that gl_PointCoord must be set in the shader.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Point sprites are used internally for hardware accelerated particle effects.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAdditionalRenderState()<br>
|
|
|
.setPolyOffset();</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Enable polygon offset.</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Use this when you have meshes that have triangles really close to each over (e.g. <a href="http://en.wikipedia.org/wiki/Coplanarity">Coplanar</a>), it will shift the depth values to prevent <a href="http://en.wikipedia.org/wiki/Z-fighting">Z-fighting</a>.</p></div></div></td></tr></tbody></table>
|
|
|
<div class="paragraph"><p><strong>Related Links</strong></p></div>
|
|
|
-<div class="ulist"><ul><li><p><a href="../../jme3/advanced/material_specification.html">Developer specification of the jME3 material system (.j3md,.j3m)</a></p></li></ul></div></div></div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2018-07-13 20:11:03 +00:00</div></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script><script>docsearch({
|
|
|
+<div class="ulist"><ul><li><p><a href="../../jme3/advanced/material_specification.html">Developer specification of the jME3 material system (.j3md,.j3m)</a></p></li></ul></div></div></div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2018-07-26 14:58:46 +00:00</div></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script><script>docsearch({
|
|
|
apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
|
|
|
indexName: 'jmonkeyengine',
|
|
|
inputSelector: '#doc-search',
|