This table shows you which material definitions jME supplies by default, and how to make the most of your designer's 3D models by using material parameters.
If you are looking for information about how to use these materials in code, look at Material Definitions and j3M Material Files.
Tip: The two most commonly used materials are Lighting.j3md and Unshaded.j3md (standard materials with and without Phong illumination, respectively).
Some parameters are "optional" because they are somewhat advanced. If you don't know what an option means, chances are that you are not using this feature in your textures – and you don't need to specify it. (E.g. YCoCg and LATC are image compression formats; Minnaert and WardIso are shader types.)
Also note that many other parameters are optional, even if they are not explicitly marked optional. For example, it's okay to specify solely the DiffuseMap
and NormalMap
when using Lighting.j3md
. You are only using a subset of what is possible, but if that's what you want, you can do that. The developer should be in contact with the designer regarding what jME features individual Materials/Textures require.
Material Definition | Usage | Parameter : Type |
---|---|---|
Common/MatDefs/Misc/Unshaded.j3md | Standard unlit Material. Use this for simple coloring, simple texturing, simple glow, simple transparency. See also: Hello Material | ColorMap : Texture LightMap : Texture Color : Color VertexColor : Boolean SeparateTexCoord : Boolean GlowMap : Texture GlowColor: Color |
Common/MatDefs/Misc/Sky.j3md | A solid skyblue, or use with a custom SkyDome texture. See also: Sky | Texture : TextureCubeMap SphereMap : Boolean NormalScale : Vector3 |
Common/MatDefs/Terrain/Terrain.j3md | Splat textures for e.g. terrains. See also: Hello Terrain | Texture1 : Texture (red) Texture1Scale : Float Texture2 : Texture (green) Texture2Scale : Float Texture3 : Texture (blue) Texture3Scale : Float Alpha : Texture |
Common/MatDefs/Misc/Particle.j3md | Used with texture masks for particle effects, or for point sprites. The Quadratic value scales the particle for perspective view (formula). Does support an optional colored glow effect. See also: Hello Effects | Texture : Texture GlowMap : Texture GlowColor : Color Quadratic : Float PointSprite : Boolean |
Material Definition | Usage | Parameters |
---|---|---|
Common/MatDefs/Light/Lighting.j3md | Standard lit 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: Hello Material Note: Lit materials require a light source! Glowing materials require a FilterPostProcessor! | DiffuseMap : Texture UseAlpha1) : Boolean NormalMap : Texture LATC2) : Boolean SpecularMap : Texture Shininess : Float ParallaxMap : Texture AlphaMap : Texture AlphaDiscardThreshold: Float ColorRamp : Texture Glow (optional) GlowMap : Texture GlowColor : Color Performance and quality (optional) VertexLighting : Boolean UseVertexColor : Boolean LowQuality : Boolean HighQuality : Boolean Material Colors (optional) UseMaterialColors : Boolean Diffuse : Color Ambient : Color Specular : Color Tangent shading (optional): VTangent : Boolean Minnaert3) : Boolean WardIso4) : Boolean |
Common/MatDefs/Terrain/TerrainLighting.j3md | Same kind of splat texture as Terrain.j3md, but with shading. Requires a light source. | Color Diffuse : Color Ambient : Color Shininess : Float Specular : Color SpecularMap : Texture WardIso : Boolean useTriPlanarMapping : Boolean Texture Splat Maps DiffuseMap : Texture DiffuseMap_0_scale : Float NormalMap : Texture DiffuseMap_1 : Texture DiffuseMap_1_scale : Float NormalMap_1 : Texture DiffuseMap_2 : Texture DiffuseMap_2_scale : Float NormalMap_2 : Texture DiffuseMap_3 : Texture DiffuseMap_3_scale : Float NormalMap_3 : Texture Alpha Maps AlphaMap : Texture AlphaMap_1 : Texture AlphaMap_2 : Texture Glowing GlowMap : Texture GlowColor : Color |
Common/MatDefs/Light/Reflection.j3md | Reflective glass material with environment map (CubeMap/SphereMap). Requires light source. See also: TestCubeMap.java | Texture : Texture SphereMap: Boolean |
Material Definition | Usage | Parameters |
---|---|---|
Common/MatDefs/Misc/ShowNormals.j3md | A color gradient calculated from the model's surface normals. You can use this built-in material to test models that have no material, or as fall-back default material. | – |
Note: Common/MatDefs/Misc/SimpleTextured.j3md, ColoredTextured.j3md, VertexColor.j3md, Wireframe.j3md have been deprecated. Use equivalent features of Unshaded.j3md instead.
Most Material Definitions support an alpha channel for transparency. In an RGBA color, the last float is the alpha channel: 0.0f is transparent, 1.0f is opaque.
For example: mat.setColor("Color", new ColorRGBA(1,0,0,0.5f));
is a half-opaque red.
Additionally, you must specify a blendmode:
Option | Usage |
---|---|
mat.getAdditionalRenderState().setBlendMode(BlendMode.Off); | Opaque |
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); | Use this for normal transparency. Interpolates the background pixel with the current by using the current pixel's alpha. E.g. alpha-blended vegetation. |
mat.getAdditionalRenderState().setBlendMode(BlendMode.Additive); | Additive alpha blending adds colors in a commutative way, i.e. the result does not depend on the order of transparent layers. Adds the background pixel color with the current pixel color. E.g. particle effects that have black color as background. |
mat.getAdditionalRenderState().setBlendMode(BlendMode.AlphaAdditive); | Same as "Additive", except first it multiplies the current pixel color by the pixel alpha. E.g. used for particle effects that have alpha as background. |
mat.getAdditionalRenderState().setBlendMode(BlendMode.Color); | Blends by color. Generally useless. |
mat.getAdditionalRenderState().setBlendMode(BlendMode.Modulate); | Multiplies the background pixel by the current pixel. |
mat.getAdditionalRenderState().setBlendMode(BlendMode.ModulateX2); | Same as "Modulate", except the result is doubled. |
mat.getAdditionalRenderState().setBlendMode(BlendMode.PremultAlpha); | 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. |
mat.getAdditionalRenderState().setDepthWrite(false); | Use this if you have several transparent objects obscuring one another. Disables writing of the pixel's depth value to the depth buffer. |
mat.getAdditionalRenderState().setAlphaFallOff(0.5f); mat.getAdditionalRenderState().setAlphaTest(true) | Enables alpha test, generally used for vegetation. Works the same way as "AlphaDiscardThreshold". |
Also note the AlphaDiscardThreshold value for materials based on Lighting.j3md. The renderer does not render pixels whose transparancy is below the threshold.
mat.getAdditionalRenderState().setWireframe(true); | Switch to showing the (textured) Material in wireframe mode |
mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front); mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back); mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack) | Activate back- or frontface culling, both (=invisible), or off. Backface culling is activated by default as an optimization. |
mat.getAdditionalRenderState().setColorWrite(false); | Disable writing the color of pixels. Use this together with setDepthWrite(true) to write pixels only to the depth buffer for example. |
mat.getAdditionalRenderState().setPointSprite(true); | Enables point-sprite mode, so meshes with "Mode.Points" will be rendered as textured sprites. Note that gl_PointCoord must be set in the shader. Point sprites are used for hardware accelerated particle effects. |
mat.getAdditionalRenderState().setPolyOffset(); | Enable polygon offset. Use this when you have meshes that have triangles really close to each over (e.g. Coplanar), it will shift the depth values to prevent Z-fighting. |