Doc > Nodes > SOP > AttribAddMult

Doc > Nodes > SOP > AttribAddMult

Simple math operation of a numeric attribute


This allows you to quickly add and multiply a numeric attribute of the input geometry.


Name Type Description
name string attribute name
preAdd float value to add before the multiplication
mult float value to multiply
postAdd float value to add after the multiplication

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();

// build a geometry that will use an attribute called 'height'
const geo = root.createNode('geo');
const plane = geo.createNode('plane');
plane.p.size.set([4, 4]);
//let's increase the resolution of the plane

// create an attrib create
const attribCreate = geo.createNode('attribCreate');
attribCreate.setInput(0, plane);'height');
// here we set the attribute value with an expression
// that depends on the z position of each point

// create the attribAddMult
const attribAddMult = geo.createNode('attribAddMult');
attribAddMult.setInput(0, attribCreate);'height');

// create a point SOP to use the height attribute to deform the plane
const point = geo.createNode('point');
point.setInput(0, attribAddMult);
// by setting another expression,
// we set the y position to equal the height attribute

// 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.