# Materials Overview

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.

## Table of Material Definitions

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.

### Coloring and Standard Textures

Material Definition | Usage | Parameter : Type
--- | --- | ---
Common/MatDefs/Misc/Unshaded.j3md | Standard unlit Material. | ColorMap : Texture LightMap : Texture Color : Color VertexColor : Boolean SeperateTexCoord : 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 ( ). Does support an optional colored glow effect. See also: Hello Effects | Texture : Texture GlowMap : Texture GlowColor : Color Quadratic : Float PointSprite : Boolean

Deprecated Material Definition | Usage | Parameter : Type
--- | --- | ---
Deprecated: use Unshaded.j3md instead Common/MatDefs/Misc/SimpleTextured.j3md | Standard unlit textured Material. | ColorMap : Texture ShowAlpha : Boolean (optional) Normalize : Boolean (optional) YCoCg1) : Boolean (optional) LATC2) : Boolean (optional)
Deprecated: use Unshaded.j3md instead Common/MatDefs/Misc/ColoredTextured.j3md | Transparent texture with one solid color bleeding through transparent areas. | ColorMap : Texture Color : Color

### Light and Shadow

Material Definition | Usage | Parameters
--- | --- | ---

Common/MatDefs/Light/Lighting.j3md

Standard lit material with Phong Lighting. Use with SpecularMap, BumpMap, NormalMaps textures, Shininess, etc.
Requires light source!

DiffuseMap : Texture
UseAlpha3) : Boolean
NormalMap : Texture
LATC4) : 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
Minnaert5) : Boolean
WardIso6) : 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: | Texture : Texture SphereMap: Boolean

### Testing and Debugging

Material Definition | Usage | Parameters
--- | --- | ---
Common/MatDefs/Misc/VertexColor.j3md | Every vertex gets a solid color, colors of mesh faces are interpolated. | –
Common/MatDefs/Misc/ShowNormals.j3md | A color gradient calculated from surface normals. | –
Common/MatDefs/Misc/Wireframe.j3md | Transparent wireframe outline. | Color : Color

## Transparency

Most Material Definitions support an alpha channel for transparency. In an RGBA color, the last float is the alpha value, whereas 0.0f = transparent, 1.0f = opaque.

For example: `mat.setColor(“Color”, new ColorRGBA(1,0,0,0.5f));` is a half-opaque red.

Additionally, 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.

## Material Options

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. ), it will shift the depth values to prevent .

## Internal Use Only

You may also come across to mentions of the following Material Definition files, but they are only used internally.

    Common/MatDefs/Blur/HGaussianBlur.j3md, VGaussianBlur.j3md, RadialBlur.j3md
    Common/MatDefs/Light/LightScattering.j3md, Deferred.j3md
    Common/MatDefs/Shadow/PreShadow.j3md, PostShadow.j3md, PostShadowPSSM.j3md
    Common/MatDefs/SSAO/normal.j3md, ssao.j3md
    Common/MatDefs/Gui/Gui.j3md
    Common/MatDefs/Hdr/LogLum.j3md, ToneMap.j3md

1) YCoCg is an image compression format.
2) LATC is an image compression format.
3) UseAlpha specifies whether DiffuseMap uses the alpha channel
4) LATC Specifies whether NormalMap is BC5/ATI2n/LATC/3Dc-compressed
5) Minnaert is a shader type.
6) WardIso is a shader type.

view online version