Beginner's questions

Hi guys, I’ve recently started learning jMonkey (having lots of fun) but I have a few questions:
Why do so many jMonkey functions take in name arguments that seem useless(if they are actually very important, please explain why). I noticed that when I did the loadTexure() function, one of the arguments that the wiki gives is “ColorMap”. I’ve heard of texture mapping before but what is a color map and what other types of map? Those are all my questions for now, thanks!

Look for “DiffuseMap” and “NormalMap”.

“ColorMap” is similar to a “DiffuseMap”, but for a different Material (so, a different shader).
Shaders define parameters which have names.
Materials wrap Shaders and expose those parameters for you.

So whatever the name of the texture in the Shader, there will be a similar name (not the same, but similar) in the Material for you.

ColorMap = a texture that provides color for an object’s surface.
DiffuseMap = the same but for a different shader (with lighting).
NormalMap = google “normal map”.

Textures can contain anything: simple color information, surface normals (bump maps and normal maps), shadow information (light maps), mathematical information (random noise, color gradients, sine waves, etc.), roughness of an objects surface (see “specularity map” and “gloss map” and “physically based rendering”), cube maps for distant background, particle system atlas, heightmaps for terrain, heightmaps for water shaders, detail maps for tiny detail, lots of other things…

In most cases the textures represent surface information for the 3D models, but in some cases they represent mathematical information (normal maps and height maps are good examples for this).

1 Like

Here is an overview of all standard jME Materials and their parameters:

There are some additional materials inside plugins and newer (newest) versions of jME too.

Thanks for the replies! However, I’m still unsure why some jmonkey functions take in string arguments that seem useless, here is an example:
Node myNode = new Node (“pivot”);
I took out the String argument and I wasn’t getting any errors, so why did the jMonkey wiki tutorial pass this string argument, because I don’t really get the point of it

That’s for searches based on names.

You can also access these by references as you would in Java (save “myNode” to a variable in some Java class).
You can also access these by their “child index” (each Node has N child nodes, saved in something similar to a List).

So there is not really a need for the name, unless you want to identify child nodes by name - for example when doing traversal of a scene graph via a SceneGraphVisitor or your own recursive traversal.
See ‘getChild’, ‘depthFirstTraversal’, ‘breadthFirstTraversal’ in the Node's javadoc:

You can see how it’s done when looking at the source code:

jmonkeyengine/ at master · jMonkeyEngine/jmonkeyengine · GitHub

See the attribute named ‘children’:
protected SafeArrayList<Spatial> children = new SafeArrayList<Spatial>(Spatial.class);

And the methods named ‘getChild(int i)’ and ‘getChild(String name)

Note that “child nodes” is not fully correct, because actually it’s “child objects” since a Node holds a list of Spatial which can be either a Node or something else (for example a Geometry). Node children can have more Node children. Geometry children have no children but represent a vertex-based mesh or a point cloud or something like that).

In this example you pass the name for the Node, which is null if you don’t pass any name. Anyway, to avoid basic misunderstandings like this, get used to using Javadoc. You can simply press Ctrl-Space on any parameter, class, variable or anything else (or right-click it) to get the Javadoc information about that class/method/parameter or whatever. Most everything is explained there.