Friday, 15 March 2013

javascript - How to apply a texture to THREE.ExtrudeGeometry? -



javascript - How to apply a texture to THREE.ExtrudeGeometry? -

var arcshape = new three.shape(); arcshape.moveto( 50, 10 ); arcshape.absarc( 10, 10, 40, 0, math.pi*2, false ); var map1 = new three.imageutils.loadtexture( 'moon.jpg' ); var geometry = new three.extrudegeometry( arcshape, extrudesettings ); var new3d = new three.mesh( geometry, new three.meshbasicmaterial( { map: map1 } ) ); new3d.receiveshadow = true; obj3dmassive.add( new3d );

texture (512x512): http://f3.s.qip.ru/cmfvuhnj.png

result: http://f3.s.qip.ru/cmfvuhnh.png

how fill texture figure?

edit: reply outdated. see extruding multiple polygons multiple holes , texturing combined shape instead.

you lucky. trying has been done in next example:

https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_extrude_uvs2.html

you have specify own uv generator function. illustration shows how that.

remember, example. may not right -- or easy implement in case.

javascript html5 canvas three.js

No comments:

Post a Comment