How can I get a cylindrical texture?

texture
This picture is better than my words…

Hi!
You can use two materials. One for side, the other one for caps (top, bottom).
https://jsfiddle.net/prisoner849/ns724xw3/

Neat! I’ve never used THREE.CylinderGeometry before…

So what’s really going on in the rendering engine here? How does one mesh map to two different textures? At first I thought it would create two separate materials, but looking at my shader editor, it looks like it’s just one!

shader
See it only says Program0, and there’s no Program1

I also see the fragment shader receives only one varying vec2 vUv and only one uniform sampler2D map;. So, what I’m trying to figure out is, where does the multiple texture mapping take place? I can’t figure out how it’s happening.

@marquizzo
I didn’t dig so deep :slight_smile:
But, THREE.CylinderGeometry()/THREE.CylinderBufferGeometry() supports up to 3 materials (one for side, one for top, one for bottom) and it’s controlled by groups and their material indices (if to trust to the source code) :slight_smile:

1 Like