Closed trevorld closed 4 years ago
Nevermind. I was able to modify my minimal OBJ example so that approach 1 (and 2) now works. It seems tinyobjloader
needs a "usemtl" statement in the OBJ file and "newmtl" statement in the associated MTL file in order to correctly import a texture.
"mtllib rect.mtl
v -1 1 0.125
v -1 -1 0.125
v 1 -1 0.125
v 1 1 0.125
vt 0 1
vt 0 0
vt 0.5 0
vt 0.5 1
usemtl material_0
f 1/1 2/2 3/3 4/4
" %>% writeLines("rect.obj")
"newmtl material_0
map_Kd texture.png
" %>% writeLines("rect.mtl")
Hi,
The documentation for
obj_model
suggests it can read obj model textures. Is there some trick to do so? I've tried three different ways to do so without success:Attempts 1 and 2 get a black render:
Attempt 3 gets an incorrect color render:
For reference this is how
meshlab
rendersrect.obj
:I've also tried various ways of writing
rect.obj
(i.e. explicitly including vector normals etc.) but get the same results either way.Thanks for the awesome package!