obj2rad: "bad face" and "bad triangle"

Has anyone seen these when trying to convert Rhino OBJ exports? What do they mean?

Radiance 4.0 / Rhino Mac 4.0 WIP

···

--
Randolph

One of the things they seem to mean is "Clean up your Rhino model." Another thing they probably mean is "Don't rely on WIP software." But it would be nice to know a bit more for the future.

···

On 2010-09-20 20:15:22 -0700, Randolph M. Fritz said:

Has anyone seen these when trying to convert Rhino OBJ exports? What do they mean?

Radiance 4.0 / Rhino Mac 4.0 WIP

--
Randolph

Has anyone seen these when trying to convert Rhino OBJ exports? What do they mean?

Dear Randolph,

I have encountered this before with a complex Rhino model as well. Luckily OBJ files are plain text.

In my case, a few of the points in my obj file were given a normal of 0 0 0 which obj2rad did not like. I fixed it by running a find and replace on "vn 0 0 0" with "vn 0 0 1" without any negative consequences.

The specific errors of bad face or triangle seem to come from bad vt (vertex texture-coordinate) data in your OBJ file, so I would start by looking there.

Best regards,
Alstan

...but it came back for a sequel.

The following example OBJ file fails with "bad face:"

g OFFICE_POSTER
v 6.026500225067139 94.81300354003906 288.5
v 6.026500225067139 94.81300354003906 244.4450073242188
v 6.026500225067139 144.3130035400391 244.4450073242188
v 6.026500225067139 144.3130035400391 288.5
vn 1 0 0
f 1//1 2//2 3//3 4//4

It's a rectangular face in the Y-Z plane, the vertices are ordered counter-clockwise, and the vertex normals are pointing in the X direction. Reversing the vertex directions makes it go. It looks right to me, but I wonder if I'm confused about clockwise & counterclockwise.

Ah, well. To be continued tomorrow.

Randolph

···

On 2010-09-21 04:34:26 -0700, J. Alstan Jakubiec said:

Has anyone seen these when trying to convert Rhino OBJ exports? What do they mean?

Dear Randolph,

I have encountered this before with a complex Rhino model as well. Luckily OBJ files are plain text.

In my case, a few of the points in my obj file were given a normal of 0 0 0 which obj2rad did not like. I fixed it by running a find and replace on "vn 0 0 0" with "vn 0 0 1" without any negative consequences.

The specific errors of bad face or triangle seem to come from bad vt (vertex texture-coordinate) data in your OBJ file, so I would start by looking there.

Best regards,
Alstan

Hello:

You may also try "mesh" -"mesh repair tools"-"rebuild mesh normals "

Cheers,
Jia

···

On Tue, Sep 21, 2010 at 5:03 PM, Randolph M. Fritz <[email protected]> wrote:

...but it came back for a sequel.

The following example OBJ file fails with "bad face:"

g OFFICE_POSTER
v 6.026500225067139 94.81300354003906 288.5
v 6.026500225067139 94.81300354003906 244.4450073242188
v 6.026500225067139 144.3130035400391 244.4450073242188
v 6.026500225067139 144.3130035400391 288.5
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
f 1//1 2//2 3//3 4//4

It's a rectangular face in the Y-Z plane, the vertices are ordered
counter-clockwise, and the vertex normals are pointing in the X direction.
Reversing the vertex directions makes it go. It looks right to me, but I
wonder if I'm confused about clockwise & counterclockwise.

Ah, well. To be continued tomorrow.

Randolph

On 2010-09-21 04:34:26 -0700, J. Alstan Jakubiec said:

Has anyone seen these when trying to convert Rhino OBJ exports? What do
they mean?

Dear Randolph,

I have encountered this before with a complex Rhino model as well. Luckily
OBJ files are plain text.

In my case, a few of the points in my obj file were given a normal of 0 0
0 which obj2rad did not like. I fixed it by running a find and replace on
"vn 0 0 0" with "vn 0 0 1" without any negative consequences.

The specific errors of bad face or triangle seem to come from bad vt
(vertex texture-coordinate) data in your OBJ file, so I would start by
looking there.

Best regards,
Alstan

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Good idea. I've been using the automatic meshing of Rhino export, which I expect to produce correct models, but if I manually meshed the model, that might help--maybe I'll try it.

···

On 2010-09-22 11:19:36 -0700, Jia Hu said:

You may also try "mesh" -"mesh repair tools"-"rebuild mesh normals "

--
Randolph

Hi Randolph,

I ran your OBJ snippet through the HEAD version of obj2rad, and it didn't complain. I made some recent changes at the request of Jack de Valpine.

Best,
-Greg

···

From: "Randolph M. Fritz" <[email protected]>
Date: September 22, 2010 2:54:35 PM PDT

On 2010-09-22 11:19:36 -0700, Jia Hu said:

You may also try "mesh" -"mesh repair tools"-"rebuild mesh normals "

Good idea. I've been using the automatic meshing of Rhino export, which I expect to produce correct models, but if I manually meshed the model, that might help--maybe I'll try it.

--
Randolph

Hi Randolph,

Greg added a feature to obj2rad to enable it to continue in the case of bad normals such as: vn 0 0 0. Previously obj2rad would exit with an error.

Backing up a bit, I think what I am interested in seeing is conversion tools that further support .obj as an intermediate file format for Radiance. There are lots of good applications (Rhino, SketchUp Pro, Blender, etc) that support export of .obj format files. And for those applications that do not (eg, Autocad and Revit), one route is that it is possible to get .fbx out of these applications which can then be converted to .obj. However the data output from these applications is not always perfect, which results in obj2rad exiting with errors relating to: bad normals, bad faces and bad triangles. So the issue is what to do in these cases:

   1. bad normals (vn 0 0 0) - are now passed through using the updated
      version of obj2rad from the head release.
   2. bad faces and bad triangles - In some case this is something that
      can be fixed in an application like Rhino or Blender (these are
      the ones that I know) using the repair mesh functionality.
      However, I have also noted that the following can sometimes be
      included by the exporting application: #QNAN0 or #IND. This is
      easy to check for using grep. Typically I have seen this:
      -1.#QNAN0 or -1.#IND. Since these errors occur upstream from
      obj2rad, Greg is rightly loathe to have ob2rad try to fix them. If
      you cannot fixes these in the upstream application, then the easy
      fix in these cases is to use sed or perl to zero out these
      conditions. This can be done as follows (pick your tool):
         1. perl -p -e 's/\#QNAN0/0/g;s/\#IND/0/g' fname.obj | obj2rad >
            fname.rad
         2. sed 's/\#QNAN0/0/g;s/\#IND/0/g' fname.obj | obj2rad > fname.rad

If anyone has other suggestions for managing and processing .obj files for use in Radiance please chime in! I know that Mark Stock has had good experience with MeshLab, for example.

Best,

-Jack

···

--
# Jack de Valpine
# president
#
# visarc incorporated
# http://www.visarc.com
#
# channeling technology for superior design and construction

On 9/27/2010 5:48 PM, Greg Ward wrote:

Hi Randolph,

I ran your OBJ snippet through the HEAD version of obj2rad, and it didn't complain. I made some recent changes at the request of Jack de Valpine.

Best,
-Greg

From: "Randolph M. Fritz"<[email protected]>
Date: September 22, 2010 2:54:35 PM PDT

On 2010-09-22 11:19:36 -0700, Jia Hu said:

You may also try "mesh" -"mesh repair tools"-"rebuild mesh normals "

Good idea. I've been using the automatic meshing of Rhino export, which I expect to produce correct models, but if I manually meshed the model, that might help--maybe I'll try it.

--
Randolph

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Thanks, folks. I'm beginning to think I misunderstand the use of "void" in obj2rad.

The following OBJ file:

g OFFICE_DOOR_JAMB_A
o object_23
v 2.500880479812622 10.49974822998047 192
v 3.500880241394043 10.49974822998047 192
v 2.500880479812622 10.49974822998047 231.9999847412109
vt 0.200000062584877 0
vt 0.212481752038002 0
vt 0.200000062584877 0.499267578125
vn 0 -1 0
f 1/1/1 2/2/2 3/3/3

And the following mapping file:

void (Group "OFFICE_DOOR_JAMB_A");

produces a "bad triangle" error.

If I change "void" to "wood," obj2rad succeeds.

Say, what?

At least, I think I have workarounds.

···

--
Randolph

So I got rid of the "void"s, and found another apparently good face which draws the "Bad Triangle" message.

It's a very long file--the error occurs at line 12104. So far I have not been able to construct a short example; the same face are accepted without complaint. If I don't use a mapping file, the conversion runs without incident. This is beginning to look like an obj2rad bug.

Anyone have a workaround to suggest? Also, anyone actually used a debugger with obj2rad?

···

--
Randolph

Thanks, Randolph. This was a bug. Obj2rad is supposed to quietly elide surfaces that map to the "void" type, but this has been broken, perhaps from the beginning. I just checked a fixed version into CVS.

-Greg

···

From: "Randolph M. Fritz" <[email protected]>
Date: September 28, 2010 12:46:39 PM PDT

Thanks, folks. I'm beginning to think I misunderstand the use of "void" in obj2rad.

The following OBJ file:

g OFFICE_DOOR_JAMB_A
o object_23
v 2.500880479812622 10.49974822998047 192
v 3.500880241394043 10.49974822998047 192
v 2.500880479812622 10.49974822998047 231.9999847412109
vt 0.200000062584877 0
vt 0.212481752038002 0
vt 0.200000062584877 0.499267578125
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
f 1/1/1 2/2/2 3/3/3

And the following mapping file:

void (Group "OFFICE_DOOR_JAMB_A");

produces a "bad triangle" error.

If I change "void" to "wood," obj2rad succeeds.

Say, what?

At least, I think I have workarounds.
--
Randolph

Thanks very very much for the prompt fix, Greg. This also fixed my second bug, which involved a surface which had no assigned material type and was therefore treated like "void", triggering the bug.

Randolph

···

On 2010-09-28 14:30:12 -0700, Greg Ward said:

Thanks, Randolph. This was a bug. Obj2rad is supposed to quietly elide surfaces that map to the "void" type, but this has been broken, perhaps from the beginning. I just checked a fixed version into CVS.

-Greg

From: "Randolph M. Fritz" <[email protected]>
Date: September 28, 2010 12:46:39 PM PDT

Thanks, folks. I'm beginning to think I misunderstand the use of "void" in obj2rad.

The following OBJ file:

g OFFICE_DOOR_JAMB_A
o object_23
v 2.500880479812622 10.49974822998047 192
v 3.500880241394043 10.49974822998047 192
v 2.500880479812622 10.49974822998047 231.9999847412109
vt 0.200000062584877 0
vt 0.212481752038002 0
vt 0.200000062584877 0.499267578125
vn 0 -1 0
f 1/1/1 2/2/2 3/3/3

And the following mapping file:

void (Group "OFFICE_DOOR_JAMB_A");

produces a "bad triangle" error.

If I change "void" to "wood," obj2rad succeeds.

Say, what?

At least, I think I have workarounds.
--
Randolph

--
Randolph