Doc > Nodes > SOP > UvUnwrap

Doc > Nodes > SOP > UvUnwrap

Unwraps UVs of each input geometries one by one

Description

This node can use 2 methods to unwrap UVs:

  • potpack: this uses a very basic unwrap algorithm, and works much better preceded with a sop/Face node that will make every face separate from its neighbours
  • xatlast: this gives better results on light geometries, but can run for a very long time on larger models.

Parameters

Name Type Description
method integer method
uv string attribute to unwrap

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

const MAT = geo.createNode('materialsNetwork');
const meshBasic = MAT.createNode('meshBasic');
meshBasic.p.wireframe.set(1);

// create an add node
const sphere = geo.createNode('sphere');
const plane = geo.createNode('plane');
const merge = geo.createNode('merge');
const uvUnwrap = geo.createNode('uvUnwrap');
const point = geo.createNode('point');
const material = geo.createNode('material');

merge.setInput(0, sphere);
merge.setInput(1, plane);
merge.p.compact.set(1);
uvUnwrap.setInput(0, merge);
point.setInput(0, uvUnwrap);
point.p.updateX.set(1);
point.p.updateY.set(1);
point.p.updateZ.set(1);
point.p.x.set('@uv.x');
point.p.y.set('@uv.y');
point.p.z.set('0');
material.setInput(0, point);
material.p.material.setNode(meshBasic);
material.flags.display.set(true);

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