Importing a textured Obj file

Dear all,
I have created a simple object (a pavement) as an obj file with a texture 512X512 on it.

I managed to import the file in radiance with obj2mesh and create a .cal file.
I have tried to go through the documentation but I haven’t really got how to proceed when it comes to clip_r(r,g,b), clip_g(r,g,b), clip_b(r,g,b) values and pic_u pic_v for the placement of the image.

I read that the first three should prevent “reflectances greater than one” https://www.radiance-online.org/archived/radsite/radiance/digests_html/v1n5.html#COLORPICT
My guess is that, since we superimpose the picture to the material, those values replace the the specularity of the material itself. Would that be correct?
In the same page I see:
clip_r(r,g,b) = min(r,1);
clip_g(r,g,b) = min(g,1);
clip_b(r,g,b) = min(b,1);

Would that suffice for the scope?

As for pic_u and pic_v, they would help positioning the picture that by default is automatically scaled (to one unit square in my case) and centered. Is that correct?

Now I have texture coordinates coming with my obj file that I would like to use, how can I translate those?

Is object2mesh the right translator for me? I think I have read tmesh2rad being a better solution. Is there any example in case?

Sorry for this many questions :slight_smile:

Thank you for your help in advance!

The obj2mesh tool is right for the task. The built-in variables Lu and Lv access the texture coordinates given in the .OBJ file, and the Radiance mesh primitive is the only way to use those. Application is fairly straightforward. Something like:

void colorpict obj_pat
7 red green blue bird.hdr . Lu Lv
0
0
obj_pat plastic obj_mat
0
0
5 1 1 1 0 0

will usually work. You don’t really need to worry about reflectances greater than 1.0 if your image came from a standard TIFF, since that already limits the range. (The red(), green(), and blue() functions as well as clip_r(), clip_g() and clip_b() are predefined in rayinit.cal, and you do not need to specify them nor use picture.cal.)

Thank you Greg! That’s great, I’ll try it!

Hi Greg,
I have tried it and it works! Just one thing I am not sure of: the picture I have chosen is not completely covering the mesh (on purpose) but it’s a bit shifted on one axis. Usually in modeling software this means -when tile option is on- that the remaining part of the mesh is covered by the tiling of the texture.
I suspect this in Radiance has to be set and that by default what is not covered is simply black. Would this be right?
Thank you for your help!

Yes, that is correct. Tiling is not a default option. If your textures are square, you can replace “Lu” and “Lv” with “frac(Lu)” and “frac(Lv)” to get tiling behavior.

Thank you. It works perfectly!