Doc > Nodes > SOP > Instance

Doc > Nodes > SOP > Instance

Copies a geometry onto every point from the right input.


Creates an instance geometry, but instancing the geometry in the left input onto every point from the right input. This is a great way to display a lot of geometries on screen with little performance penalty.


Name Type Description
attributesToCopy string attributes to copy to the instance
applyMaterial boolean toggles on to apply a material. This is useful in most cases, but there may be situations where the material would be apply later, such as when you are feeding this node to a particles system
material node_path material to apply

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 box and a sphere
const geo = root.createNode('geo');

// import dolphin geo
const file = geo.createNode('fileOBJ');

// hierarchy to remove the parent and only keep the object with a geometry
const hierarchy = geo.createNode('hierarchy');
hierarchy.setInput(0, file);

// scale and rotate the dolphin
const transform = geo.createNode('transform');
transform.setInput(0, hierarchy);

// create a sphere to instanciate the dolphins onto
const sphere = geo.createNode('sphere');
const scatter = geo.createNode('scatter');
scatter.setInput(0, sphere);

// add some jitter
const jitter = geo.createNode('jitter');
jitter.setInput(0, scatter);

// create the instance node
const instance = geo.createNode('instance');
instance.setInput(0, transform);
instance.setInput(1, jitter);

// create a material to render the instance.
// We only have to extend the existing materials
const MAT = root.createNode('materialsNetwork');
const material = MAT.createNode('meshLambertBuilder');
const output = material.createNode('output');
// all we have to do in the material is to plug an instanceTransform node into the output
const instanceTransform = material.createNode('instanceTransform');
output.setInput('position', instanceTransform, 'position');
output.setInput('normal', instanceTransform, 'normal');

// add a light

// 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');

// mount the viewer
const element = document.getElementById('app');
Is this doc helpful/not helpful? Is there any information you would like that is not available? Don't hesitate to get in touch with any question or feedback, either by email, on Discord or the forum.