Forum: help
Monitor Forum | | RE: How to read in OBJ files that include texture information on their faces [ Reply ] By: Duncan Murdoch on 2020-02-05 20:12 | [forum:47366] |
|
rgl supports 2-D texture coordinates, but doesn't have any support for 3-D textures. So the best you could hope for is to ignore the 3rd coordinate. It turns out that's a relatively easy change to make (it was a case of dimensions being dropped when they should be kept). I'll commit a patch to fix this soon. |
|
| How to read in OBJ files that include texture information on their faces [ Reply ] By: Trevor Davis on 2020-02-05 01:00 | [forum:47365] |
|
I'm trying to use `readOBJ` to read in some OBJ files with texture information but unless I completely drop texture information from the faces I keep getting an error: `Error in vlinks[[i]][, 2]: incorrect number of dimensions` error. I've upgraded to the development version of `rgl` and checked that both OBJ files seem fine with 'meshlab' and keep getting errors. Is there some extra OBJ information that is mandatory for `rgl` to correctly read it such files or is importing OBJ face texture information not supported by `readOBJ`? Here is a simplifed OBJ file of just a single 4-vertex face: v -1 1 0.125 v -1 -1 0.125 v 1 -1 0.125 v 1 1 0.125 vt 0 0 vt 0 1 vt 0.5 1 vt 0.5 0 f 1/1 2/2 3/3 4/4 Here is a verbose alternative with vertex normals thrown in and optional "w" coordinates added to the texture coordinates: v -1 1 0.125 v -1 -1 0.125 v 1 -1 0.125 v 1 1 0.125 vn 0 0 1 vn 0 0 1 vn 0 0 1 vn 0 0 1 vt 0 0 0 vt 0 1 0 vt 0.5 1 0 vt 0.5 0 0 f 1/1/1 2/2/2 3/3/3 4/4/4 Thanks! |
|

