如何将纹理应用到THREE.ExtrudeGeometry? [英] How to apply a texture to THREE.ExtrudeGeometry?

查看:2454
本文介绍了如何将纹理应用到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 );

纹理(512x512): http://f3.s.qip.ru/cMfvUhNj.png

Texture (512x512): http://f3.s.qip.ru/cMfvUhNj.png

结果: http://f3.s.qip.ru/cMfvUhNh.png

如何填充纹理图?

推荐答案

请参见使用多个孔来挤出多个多边形,并对组合形状

你很幸运。您尝试执行的操作已在以下示例中完成:

You are lucky. What you are trying to do has been done in the following example:

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

您必须指定自己的UV发生器功能。这个例子告诉你如何做。

You have to specify your own UV generator function. This example shows you how to do that.

记住,这只是一个例子。这可能不正确,或在您的情况下很容易实施。

Remember, this is just an example. It may not be correct -- or easy to implement in your case.

这篇关于如何将纹理应用到THREE.ExtrudeGeometry?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆