How can I get a cylindrical texture?

This picture is better than my words…

You can use two materials. One for side, the other one for caps (top, bottom).

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!

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.

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