|
@@ -1,10 +1,10 @@
|
|
= How to Use Material Definitions (.j3md)
|
|
= How to Use Material Definitions (.j3md)
|
|
-:revnumber: 2.0
|
|
|
|
-:revdate: 2020/07/15
|
|
|
|
|
|
+:revnumber: 2.1
|
|
|
|
+:revdate: 2020/07/23
|
|
:keywords: Material, SDK, MatDef, file, documentation
|
|
:keywords: Material, SDK, MatDef, file, documentation
|
|
|
|
|
|
|
|
|
|
-All Geometries need a Material to be visible. Every Material is based on a Material Definition. Material definitions provide the “logic for the material, and a shader draws the material according to the parameters specified in the definition. The J3MD file abstracts the shader and its configuration away from the user, allowing a simple interface where the user can simply set a few parameters on the material to change its appearance and the way its handled by the shaders.
|
|
|
|
|
|
+All Geometries need a Material to be visible. Every Material is based on a Material Definition. Material definitions provide the "`logic`" for the material, and a shader draws the material according to the parameters specified in the definition. The J3MD file abstracts the shader and its configuration away from the user, allowing a simple interface where the user can simply set a few parameters on the material to change its appearance and the way its handled by the shaders.
|
|
|
|
|
|
The most common Material Definitions are included in the engine, advanced users can create custom ones. In this case you will also be interested in the xref:jme3/advanced/material_specification.adoc[in-depth developer specification of the jME3 material system].
|
|
The most common Material Definitions are included in the engine, advanced users can create custom ones. In this case you will also be interested in the xref:jme3/advanced/material_specification.adoc[in-depth developer specification of the jME3 material system].
|
|
|
|
|
|
@@ -30,12 +30,12 @@ If you use one custom material with certain settings very often, learn about sto
|
|
|
|
|
|
== Preparing a Material
|
|
== Preparing a Material
|
|
|
|
|
|
-In the xref:jme3/advanced/materials_overview.adoc[Materials Overview] list:
|
|
|
|
|
|
+In the xref:material/materials_overview.adoc[Materials Overview] list:
|
|
|
|
|
|
. Choose a Material Definition that has the features that you need.
|
|
. Choose a Material Definition that has the features that you need.
|
|
** Tip: If you don't know, start with `Unshaded.j3md` or `Lighting.j3md`.
|
|
** Tip: If you don't know, start with `Unshaded.j3md` or `Lighting.j3md`.
|
|
|
|
|
|
-. Look at the applicable parameters of the Material Definition and determine which parameters you need to achieve the desired effect (e.g. “glow or “color). Most parameters are optional!
|
|
|
|
|
|
+. Look at the applicable parameters of the Material Definition and determine which parameters you need to achieve the desired effect (e.g. "`glow`" or "`color`"). Most parameters are optional!
|
|
. Create and save the necessary Texture files to your `assets/Textures` directory.
|
|
. Create and save the necessary Texture files to your `assets/Textures` directory.
|
|
** E.g. mytex_diffuse.png as ColorMap / DiffuseMap, mytex_normal.png as NormalMap, mytex_alpha.png as AlphaMap, etc…
|
|
** E.g. mytex_diffuse.png as ColorMap / DiffuseMap, mytex_normal.png as NormalMap, mytex_alpha.png as AlphaMap, etc…
|
|
|
|
|
|
@@ -55,7 +55,7 @@ In your Java code,
|
|
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
----
|
|
----
|
|
|
|
|
|
-. Configure your Material by setting the appropriate values listed in the xref:jme3/advanced/materials_overview.adoc[Materials Overview] table.
|
|
|
|
|
|
+. Configure your Material by setting the appropriate values listed in the xref:material/materials_overview.adoc[Materials Overview] table.
|
|
+
|
|
+
|
|
[source,java]
|
|
[source,java]
|
|
----
|
|
----
|
|
@@ -84,11 +84,11 @@ For details see also: xref:tutorials:concepts/how_to_use_materials.adoc[How to U
|
|
|
|
|
|
Here are examples of the methods that set the different data types:
|
|
Here are examples of the methods that set the different data types:
|
|
|
|
|
|
-* `mat.setColor( “Color, ColorRGBA.White );`
|
|
|
|
-* `mat.setTexture( “ColorMap, assetManager.loadTexture(“Interface/Logo/Monkey.png ));`
|
|
|
|
-* `mat.setFloat( “Shininess, 5f);`
|
|
|
|
-* `mat.setBoolean( “SphereMap, true);`
|
|
|
|
-* `mat.setVector3( “NormalScale, new Vector3f(1f,1f,1f));`
|
|
|
|
|
|
+* `mat.setColor( "Color", ColorRGBA.White );`
|
|
|
|
+* `mat.setTexture( "ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.png" ));`
|
|
|
|
+* `mat.setFloat( "Shininess", 5f);`
|
|
|
|
+* `mat.setBoolean( "SphereMap", true);`
|
|
|
|
+* `mat.setVector3( "NormalScale", new Vector3f(1f,1f,1f));`
|
|
|
|
|
|
A simpled textured material.
|
|
A simpled textured material.
|
|
|
|
|