Doc > Nodes > MAT > MeshBasic

Doc > Nodes > MAT > MeshBasic

Creates a Mesh Basic Material

Description

This material only emits a color and does not react to light. It is therefore the less resource intensive material.

Parameters

Name Type Description
color color material color
useVertexColors boolean defines if the color attribute on the geometry is used
transparent boolean sets the material to transparent
opacity float sets the material opacity
alphaTest float sets the min alpha below which the material is invisible
useMap boolean toggle on to use a map affecting color
map node_path texture map affecting color
useAlphaMap boolean toggle if you want to use an alpha map
alphaMap node_path specify the alpha map COP node
useAOMap boolean toggle if you want to use an ambient occlusion map
aoMap node_path specify the AO map COP node
aoMapIntensity float ambient occlusion intensity
useEnvMap boolean toggle if you want to use an environment map
envMap node_path specify the environment map COP node. Note that this only works with CubeCamera
combine integer defines how the env map is combined with the color
reflectivity float environment intensity
refractionRatio float refraction ratio
useLightMap boolean toggle if you want to use a light map
lightMap node_path specify the light map COP node
lightMapIntensity float light. When set to 0, reflections from environment maps will be very sharp, or blurred when 1. Any value between 0 and 1 can help modulate this.
doubleSided boolean defines if the material is double sided or not
front boolean if the material is not double sided, it can be front sided, or back sided
overrideShadowSide boolean override the default shadowSide behavior
shadowDoubleSided boolean defines which side(s) are used when rendering shadows
shadowFront boolean if the material is not double sided, it can be front sided, or back sided, when computing shadows
colorWrite boolean defines if the objects using this material will be rendered in the color buffer. Setting it to false can have those objects occlude the ones behind
depthWrite boolean defines if the objects using this material will be rendered in the depth buffer. This can often help transparent objects
depthTest boolean toggle depth test
premultipliedAlpha boolean premultipliedAlpha
blending integer blending
dithering boolean dithering, which can be useful when using postprocessing and banding appears on some objects
polygonOffset boolean activate polygon offset
wireframe boolean toggle on to set material to wireframe
wireframeLinecap integer define appearance of line ends
wireframeLinejoin integer Define appearance of line joints
useFog boolean toggle on if you have a fog in the scene and the material should be affected by it

Edit code in JsFiddle , Codepen , view in a new tab or Open in the Editor


// create a scene
const scene = new PolyScene();
const root = scene.root();

// create a few objects
const geo = root.createNode('geo');
const sphere = geo.createNode('sphere');
sphere.p.center.x.set(-2);
const box = geo.createNode('box');
box.p.center.x.set(2);
const torus = geo.createNode('torus');
torus.p.center.z.set(-2);
const torusKnot = geo.createNode('torusKnot');
torusKnot.p.center.z.set(2);

// merge the geometries
const merge = geo.createNode('merge');
merge.setInput(0, sphere);
merge.setInput(1, box);
merge.setInput(2, torus);
merge.setInput(3, torusKnot);

// create the material
const materials = root.createNode('materialsNetwork');
const meshBasic = materials.createNode('meshBasic');
meshBasic.p.color.set([0, 0.5, 1]);

// assign the material
const material = geo.createNode('material');
material.setInput(0, merge);
material.p.material.setNode(meshBasic);
// set the display flag on the material node
material.flags.display.set(true);

// no need to add a light for meshBasic material
// scene.root.createNode('hemisphereLight');

// create a camera
const perspectiveCamera1 = root.createNode('perspectiveCamera');
perspectiveCamera1.p.t.set([5, 5, 5]);
// add orbitControls
const events1 = perspectiveCamera1.createNode('eventsNetwork');
const orbitsControls = events1.createNode('cameraOrbitControls');
perspectiveCamera1.p.controls.setNode(orbitsControls);

// mount the viewer
const element = document.getElementById('app');
perspectiveCamera1.createViewer(element);