1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3 4<head> 5<title></title> 6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7</head> 8<body> 9 10The <code>com.jme3.material</code> package contains classes for manipulating 11jMonkeyEngine materials. 12Materials are applied to {@link com.jme3.scene.Geometry geometries} in the 13scene. 14Each geometry has a single material which is used to render that 15geometry. 16<p> 17Materials (also known as material instances) are extended from 18material definitions. 19 20<h3>Material definitions</h3> 21<p> 22Material definitions provide the "logic" for the material. Usually a shader that 23will handle drawing the object, and corresponding parameters that allow 24configuration of the shader. 25Material definitions can be created through J3MD files. 26The J3MD file abstracts the shader and its configuration away from the user, allowing a 27simple interface where one can simply set a few parameters on the material to change its 28appearance and the way its handled. 29 30<h3>Techniques</h3> 31<p> 32Techniques specify a specific way of rendering a material. Typically 33a technique is used to implement the same material for each configuration 34of the system. For GPUs that do not support shaders, a "fixed function pipeline" 35technique could exist to take care of rendering for that configuration 36 37<h3>Render states</h3> 38<p> 39See {@link com.jme3.material.RenderState}. 40 41<h3>Example Usage</h3> 42<p> 43Creating a textured material 44<code> 45// Create a material instance 46Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); 47 48// Load the texture. 49Texture tex = assetManager.loadTexture("Textures/Test/Test.jpg"); 50 51// Set the parameters 52mat.setTexture("ColorMap", tex); 53</code> 54 55 56 57</body> 58</html> 59