Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

three.js - Buffer Geometry with aoMap and second uv coordinates

I'm working with a SEA3D model, loaded as BufferGeometry, and adding externally an aoMap.

However there is some problem with both maps.

  • The aoMap just does not affect the color of the model.

In three.js documentation, there is the a reference

The aoMap requires a second set of UVs.

In BufferGeometry, I know the UV info is on the geometry.attributes.uv.

How do I get the second set of UV's so I can get the aoMap?

Thank you

like image 584
Rui d'Orey Avatar asked Dec 19 '22 19:12

Rui d'Orey


1 Answers

You can add a 2nd set of UVs to a BufferGeometry like so:

var uvs = geometry.attributes.uv.array;
geometry.addAttribute( 'uv2', new THREE.BufferAttribute( uvs, 2 ) );

(Of course, using this pattern, the 2nd set will match the first set.)

three.js r.74

like image 131
WestLangley Avatar answered Feb 23 '23 14:02

WestLangley