3d - THREE.JS loads the textures from an OBJ/MTL file half way -
i have obj, mtl , texture images exported cinema 4d
. designers gave me files in zip. trying display them of three.js
. use following code:
var mtlloader = new three.mtlloader(); mtlloader.setpath('shipka-obj/'); mtlloader.load('shipka.mtl', function (materials) { materials.preload(); var objloader = new three.objloader(); objloader.setmaterials(materials); objloader.setpath('shipka-obj/'); objloader.load('shipka.obj', function (object) { scene.add(object); }); });
the problem monument missing parts:
the designers wrong can't see can be? please, help! thanks.
edit: i've uploaded zip obj, mtl , texture images dropbox. here link. https://www.dropbox.com/s/ah8yhjadgihrihr/shipka-obj.zip?dl=0
you didn't wrong. looked @ obj, , looks person modeled geometry made few mistakes:
faces:
three.js can render three-sided faces (triangles). understands quads, automatically subdivides triangles, doesn't know how handle faces 5 or more edges. obj given has poor tesselation, eight, twelve, 20-sided faces!
as can see, faces more 4 edges not being rendered in three.js, quads , tris rendered expected:
i recommend request mesh better tesselation. ask faces reduced quads or tris avoid issue.
normals
in image below, can see platform structure sits on has normals pointing inwards:
the three.js renderer thinks want faces point in direction. that's why can see underside of far slopes of platform, not ones closest camera:
i recommend ask 3d artist go through geometry , ensure normals facing outward instead of inward, way renderer understands side of faces want have rendered.
alternatively, ask renderer render backside, or both sides of faces, don't recommend this, because you'll picking , choosing objects day. additionally, it's more computationally expensive render both sides.
Comments
Post a Comment