0

I would like to build a vertex shader with 1 texture map but multiple uv sets. So far, I stored the differents UV sets in FaceVertexUvs[0] and FaceVertexUvs[1].

However, in the vertex shader, I can access only the first uv set using "vUv".

varying float vUv;
void main() {
(...)
vUv = uv;
(...)
}

It seems like 'uv' is something magical from threejs. Does something like uv2, uv3 exists? I need something to access the uv mapping in FaceVertexUvs[1].

My goal is to build a house with wall using part of a texture, and windows in another part of the same texture, and blend both.

Is it the correct way to do it? In which part of three.js source code is that magical 'uv' set?

Andrea
  • 11,801
  • 17
  • 65
  • 72
  • Can you provide a _simple_, live example to demonstrate your problem accessing uv2? What revision of three.js are you using? – WestLangley Aug 25 '15 at 23:51
  • Hello, did you ever figure out a solution for this? Is it even possible with three.js? – Niall Thompson Apr 03 '16 at 09:07
  • It's possible you just need to define `attribute vec2 uv2` in your shader. Otherwise, you'll have to use a `BufferGeometry` and define a second UV `BufferAttribute` yourself. – BMac Oct 21 '16 at 02:55

0 Answers0