filtering normal information from an obj

Hi!

As obj2mesh doesn't support something as obj2rad's -f option to filter surface normal information, and mgffilt cannot be used here because native radiance-format is not involved using obj2mesh (well, I could use obj2rad -f and than the new rad-to-obj filter, but that does not seam to make sense to me with all my large files), I wonder how people get rid of normals if needed.

I started with grep -v "vn", but that only removes the vertices, not their referneces in the face (f) lines. So I need a sed-command maybe, that finds the normal vertex reference by examining the /-seperated triples in lines beginning with f and replace the normal vertex index by 0. And it should take care of lines that are continued after a line break, indicated by a backslash, as that seams to be valid in obj.

I am not very good in sed. If someone has a tested sed-string (I guess so) it would be great if you could post it, might be of general interest. If not, I will have to think myself :wink: and make hundreds of failed attempts to get this done...

Thanks... Lars.

Just a short question about the whole surface / vertex normal topic... I guess the normal interpolation is effective only in the direct calculation, right? So I should not expect too much performance gain from removing it, only rpict occupying some fewer bytes, right?

Lars.

THis may not be the most elegant solution, but if you want more control over how your .obj files are structured, give the utility UVMapper a try:

http://www.uvmapper.com/

It is available for Windows and Mac and the "Classic" version is free (at least for the Mac). You can load your obj into UVMapper and then export it with or without normals, UVs, Regions, etc.

If you have a lot of obj's this may not be the greatest solution, but try it out. This is a must have if you model in Lightwave and export your models in obj format and you WANT normals, because LW does not export normal info.

kirk

···

--------------------------------------------------
Kirk L. Thibault, Ph.D.

Biomechanics, Inc.
439 S. Governor Printz Blvd.
Essington, PA 19029

p. 215.271.7720
f 215.271.7740

[email protected]
skype: kirkthibault

On Aug 10, 2006, at 4:18 AM, Lars O. Grobe wrote:

Hi!

As obj2mesh doesn't support something as obj2rad's -f option to filter surface normal information, and mgffilt cannot be used here because native radiance-format is not involved using obj2mesh (well, I could use obj2rad -f and than the new rad-to-obj filter, but that does not seam to make sense to me with all my large files), I wonder how people get rid of normals if needed.

I started with grep -v "vn", but that only removes the vertices, not their referneces in the face (f) lines. So I need a sed-command maybe, that finds the normal vertex reference by examining the /-seperated triples in lines beginning with f and replace the normal vertex index by 0. And it should take care of lines that are continued after a line break, indicated by a backslash, as that seams to be valid in obj.

I am not very good in sed. If someone has a tested sed-string (I guess so) it would be great if you could post it, might be of general interest. If not, I will have to think myself :wink: and make hundreds of failed attempts to get this done...

Thanks... Lars.

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

Kirk Thibault wrote:

THis may not be the most elegant solution, but if you want more control over how your .obj files are structured, give the utility UVMapper a try:

http://www.uvmapper.com/

Hi Kirk,

thank you, but the task is to (optionally) switch off normal processing in a script. It is about some dozens or maybe hundreds of obj's. I hope to improve processing speed in radiance, but I do not really want to delete the normals from the obj-Model, as they fit quite well.

Lars.

Hi Lars,

You can try it, but if your purpose is to reduce rendering times, I don't expect you'll see much difference from taking the surface normals away. The implementation of normal interpolation in Radiance meshes is fairly efficient.

I also wrote a utility for manipulating .OBJ files (a bit), but it was written under contract with someone else and depends on some other code I developed that isn't part of Radiance. I could distribute binaries, but compiling under multiple architectures is beyond my abilities right now.

-Greg

···

From: "Lars O. Grobe" <[email protected]>
Date: August 10, 2006 6:57:23 AM PDT

Kirk Thibault wrote:

THis may not be the most elegant solution, but if you want more control over how your .obj files are structured, give the utility UVMapper a try:
http://www.uvmapper.com/

Hi Kirk,

thank you, but the task is to (optionally) switch off normal processing in a script. It is about some dozens or maybe hundreds of obj's. I hope to improve processing speed in radiance, but I do not really want to delete the normals from the obj-Model, as they fit quite well.

Lars.

Here's a simple try:

grep -v '^vn' file.obj | sed -e 's|\([0-9]*/[0-9]*/\)[0-9]*|\1|g'

Seems to work ok on an OBJ file produced with Wings3D. As far as I know,
only the face lines have slashes in them, so you don't have to match for
the 'f' at the beginning of the line or do anything special for broken
lines. Can line breaks occur in the middle of a v/vt/vn triplet? That
would be the only problem with my solution. The next step then would be a
Perl script...

bye

···

On Thu, 10 Aug 2006 11:18:00 +0300 "Lars O. Grobe" <[email protected]> wrote:

Hi!

As obj2mesh doesn't support something as obj2rad's -f option to filter
surface normal information, and mgffilt cannot be used here because
native radiance-format is not involved using obj2mesh (well, I could use
obj2rad -f and than the new rad-to-obj filter, but that does not seam to
make sense to me with all my large files), I wonder how people get rid
of normals if needed.

I started with grep -v "vn", but that only removes the vertices, not
their referneces in the face (f) lines. So I need a sed-command maybe,
that finds the normal vertex reference by examining the /-seperated
triples in lines beginning with f and replace the normal vertex index by
0. And it should take care of lines that are continued after a line
break, indicated by a backslash, as that seams to be valid in obj.

I am not very good in sed. If someone has a tested sed-string (I guess
so) it would be great if you could post it, might be of general
interest. If not, I will have to think myself :wink: and make hundreds of
failed attempts to get this done...

grep -v '^vn' file.obj | sed -e 's|\([0-9]*/[0-9]*/\)[0-9]*|\1|g'

Seems to work ok on an OBJ file produced with Wings3D.

Yes, it seams to work here, too. Thank you! I will do some more serious testing with my obj's tomorrow.

Lars.