Using OBJ2MESH utility

Dear RADIANCE users

I have recently been experimenting with the new MESH primitive introduced in RADIANCE 3.5. Furthermore, after the latest diff_HEAD_rad3R5.patch patch file has modified R3.5, the OBJ2MESH utility appears to compile a RTM (RADIANCE triangle mesh) without any bugs apparent.

The smooth phong shading possible with the MESH primitive renders correctly, but I am unclear how to apply a bitmap as a texture map using the compiled UV mapping co-ordinates.

The OBJ2MESH help file explains how the utility reads a Wavefront .OBJ file, but it does not suggest that the utility reads and compiles the corresponding Wavefront material file .MTL. The help file implies that the .MTL file should contain a RADIANCE material description.

My question is how is it possible to interpret the Wavefront .MTL file (i.e., in Wavefront format) into a RADIANCE material definition, specifically regarding referencing the bitmap(s) that will be applied to the RADIANCE triangle mesh file?

John Graham, DAI Services

Hi John,

Unfortunately, there is no translator routine for Wavefront material files, which I only became aware of recently, myself. It might be possible to write such a translator, but the description used by Wavefront don't really correspond to physical materials, which makes translation problematic. However, it's not too difficult to use this information yourself using some intelligent guesses and simple rules. Given the following sample material:

newmtl mat_1
         Ns 32
         d 1
         illum 2
         Kd 1 1 1
         Ks 0 0 0
         Ka 0.25 0.25 0.25
         map_Kd -s 40 14 1 mat_1.bmp

One could convert the file "mat_1.bmp" to a Radiance picture file somehow (you'll need Photoshop or GraphicConverter to get it to TIFF then use ra_tiff with the -r option foor example). Your Radiance material would look something like so:

void colorpict mat_1_pat
7 red green blue mat_1.pic . frac(Lu*40) frac(Lv*14)
0

mat_1_pat plastic mat_1
0
5 0.25 0.25 0.25 0 0

-Greg

···

From: "Digital Architectural Illustration Services" <[email protected]>
Date: Fri May 9, 2003 6:38:53 AM US/Pacific
To: <[email protected]>
Subject: [Radiance-general] Using OBJ2MESH utility
Reply-To: [email protected]

Dear RADIANCE users

I have recently been experimenting with the new MESH primitive introduced in RADIANCE 3.5.� Furthermore, after the latest diff_HEAD_rad3R5.patch patch file has modified R3.5, the OBJ2MESH utility appears to compile a RTM (RADIANCE triangle mesh) without any bugs apparent.

The smooth phong shading possible with the MESH primitive renders correctly, but I am unclear how to apply a bitmap as a texture map using the compiled UV mapping co-ordinates.

The OBJ2MESH help file explains how the utility reads a Wavefront .OBJ file, but it does not suggest that the utility reads and compiles�the corresponding Wavefront material file .MTL.� The help file implies that the .MTL file should contain a RADIANCE material description.

My question is how is it possible to interpret the Wavefront .MTL file (i.e., in Wavefront format) into a RADIANCE material definition, specifically regarding referencing the bitmap(s) that will be applied to the RADIANCE triangle mesh file?

John Graham, DAI Services

Dear Greg

Thank you for your assistance with my request concerning smoothing using the
OBJ2MESH utility.

After applying your recommended materials, I successfully rendered a mesh
with both UV mapping and smoothing using the OBJ2MESH utility, with good
results. I considered this issue of importance since there is currently
little discussion on the Internet about using this utility, and also because
phong rendering curvilinear surfaces with textures applied can greatly
enhance the realism and quality of RADIANCE renders, especially in my field
of architectural illustration.

I have just updated my web page again with a final comparison between the
smoothed / texture mapped results of OBJ2MESH against the results of ConRAD
software, which is very similar. The results may be worth looking at, since
the tests seem to have revealed minor distortions in the UV mapping
co-ordinates exported by OBJ2MESH. A more detailed discussion of these
issues can be found at:

www.daiservices.btinternet.co.uk/Radiance/Radiance_v3_5_UNIX/Phong_shading_a
nd_bitmap_textures/Phong_shading_and_bitmap_textures.htm

I will leave this web page active for the benefit of any RADIANCE users
wanting to learn from the tests I conducted.

Kind regards

John MacKenzie Graham
Digital Architectural Illustration Services
[email protected]

Hi John,

From: "Digital Architectural Illustration Services" <[email protected]>

I have just updated my web page again with a final comparison between the
smoothed / texture mapped results of OBJ2MESH against the results of ConRAD
software, which is very similar. The results may be worth looking at, since
the tests seem to have revealed minor distortions in the UV mapping
co-ordinates exported by OBJ2MESH. A more detailed discussion of these
issues can be found at:

http://www.daiservices.btinternet.co.uk/Radiance/Radiance_v3_5_UNIX/Phong_shading_and_bitmap_textures/> Phong_shading_and_bitmap_textures.htm

Very strange -- I have no idea where this distortion is coming from. I conducted a little test of my own to see if something was wrong with the mesh rendering code, but I got perfectly straight lines when I mapped a grid picture onto a similar cylinder. If you e-mail me your .OBJ file <[email protected]>, I'll see if I can figure out what's going on. What is the ConRAD program? I haven't heard of that one.

-Greg

Dear Greg

Thank you for your feedback concerning smoothing and UV texture co-ordinates
using the OBJ2MESH utility.

Concerning the UV co-ordinate mapping distortion on one of my test renders.
After investigating the error further, I determined that the cause of this
minor fault was due to an independent utility that converted the CAD model
to an .OBJ file and was not due to OBJ2MESH or RADIANCE.

On my web page, I have added a technically correct render using a CAD model
correctly exported by a file conversion utility in the .OBJ format,
processed by OBJ2MESH and rendered by RADIANCE, concluding my tests
investigating RADIANCE renders combining smooth phong rendering with UV
bitmap mapping at a face level.

For the final test render, please scroll to the bottom of the page:

www.daiservices.btinternet.co.uk/Radiance/Radiance_v3_5_UNIX/Phong_shading_a
nd_bitmap_textures/Phong_shading_and_bitmap_textures.htm

ConRAD software was created by OpenEntry www.openentry.dk and serves to
convert a 3DS file to a number of RADIANCE files; in fact all files
necessary to create a high quality RADIANCE render. It works only on the PC
under Windows 9x and later (I believe) which is why RADIANCE UNIX users may
have not heard about it. It is a comprehensive and effective program which
also allows access to virtually all aspects of RADIANCE and I generally
regard it as a RADIANCE graphic user interface. Hence my preference for the
3DS file format.

Since RADIANCE v3.5 for UNIX compiles and functions perfectly with
Cygwin UNIX for the PC, it is possible to run RADIANCE UNIX in a Cygwin UNIX
window on a MS Windows desktop, simultaneously providing access to RADIANCE
UNIX and RADIANCE tools for the PC such as ConRAD - a highly functional and
productive combination.

Kind regards

John Graham