ThreeJS texture issue

孤人 提交于 2020-01-05 10:20:43

问题


I have a problem with my Three.js 3D application - at least according to some people I know.

My application rests at [http://176.9.149.205/planungstool/]. Some people who supposedly have the most recent version of Chrome and Firefox, can not see the textured areas. For example, they do not see the roof or front of the 3D house. They do, however, see the non-textured stuff like the tree or the floor.

What's weird is that I don't have that problem and most of the other people I asked do not have it as well. Here is what it should look like and does look like for me: [http://176.9.149.205/planungstool/house.jpg]

Does anyone have an idea what could cause this? Could it be some client-side settings? Or maybe some access control policy?

I'm loading the textures like this:

var myTexture = new THREE.ImageUtils.loadTexture('gfx/textures/texture.jpg');

And then I just create meshes with lambert material that have this texture as their map.

If you read this and do not know what could cause this error, it would be nice if you could at least tell me if you see the textured areas or not, given you have a recent version of Chrome or Firefox.


回答1:


I can see the textures on current chrome on mac. I had a similar problem with the canvas renderer (anything textured was invisible). For me I changed from using the ImageUtils.loadTexture to a texture and texture loader and it works.

var texture = new THREE.Texture();
var texLoader = new THREE.ImageLoader();
texLoader.addEventListener( 'load', function(event){
    texture.image = event.content;
    texture.needsUpdate = true;
} );
texLoader.load('texture.png');

I do however still have problems with a canvas renderer in safari but you appear to only be using the webgl renderer. Hope this helps.



来源:https://stackoverflow.com/questions/15522505/threejs-texture-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!