OBJ2MESH - Phong smooth shading and texture mapping

Hi all,

I recently tried using OBJ2MESH for applying smooth shading to models, made
using a 3rd party CAD software, and also to map textures. None of it
worked.

- I did not see any option for implementing smooth shading in the obj2mesh
manual, can anyone helps explaining how it should be specified?

- For mapping texture I used the following code, but there was no texture
on the object rendered (a ball) just plain color :

void colorpict ball_surface
7 red green blue ball.pic . frac(Lu) frac(Lv)
0
0

ball_surface plastic ball_finish
0
0
5 0.5 0.5 0.5 0 0

ball_finish mesh ball_mesh
1 ball.rtm
0
0

That's about it, any support will be appreciated.

Thanks

Sorry to hear that. I tested obj2mesh recently and it work for my
file (tested smooth shading only).

Does your CAD app provide vertex normals and uv texture coords?
obj2mesh does not generate it's own coordinates but only translates
those found in the file.

I don't know much about the *obj file format so the following
instructions may not be correct:

To check vertex normals open your *.obj file with a text editor.
For every line starting with "v " there should be a "vn "
line for the vertex normal direction. This alone is no
prove but it shows the normals are exported. I don't know
if *.obj _requires_ normals for each vertex. They still could
be face normals which would show no smoothing effect.

To check UV-coordinates check the lines starting with "f ".
The three or four sets of numbers have the form

<vertex index>/<uv-coord>/<vertex normal>

If no uv-coord is present the field will be empty (like "1//1").

If your app does not provide uv-coords and normals you could
use a 3D modeler with DXF import to convert your geometry to
*.obj files. For simple DXF files Blender (www.blender.org)
can do that.

Thomas

···

On 15.02.2006, at 13:26, Nicolas Roy wrote:

Hi all,

I recently tried using OBJ2MESH for applying smooth shading to models, made
using a 3rd party CAD software, and also to map textures. None of it
worked.

[snip]

To check UV-coordinates check the lines starting with "f ".
The three or four sets of numbers have the form

<vertex index>/<uv-coord>/<vertex normal>

If no uv-coord is present the field will be empty (like "1//1").

Almost. Sorry to nitpick, but all of the numbers in the face 'f' lines are
indexes. The preceding 'v' lines define vertex coordinates (x,y,z), the
'vt' lines defined texture coordinates (u,v), and 'vn' lines defined
normals (x,y,z).

e.g
v 0.485127 -1.896 1.33107
...
vt 4.03466 -0.392051
...
vn -0.0165774 -0.999061 0.0400231
...
f 352/1/1 358/2/1 364/3/1

All indexes start from 1. If there are no texture coordinates or a surface
normal for a face, those fields are left blank like you showed.

e.g
f 352// 358// 364//

Is this what you're seeing, Nicholas? If it is, you have to find a way to
produce a .obj file with this information. I can't be of much help
there. Otherwise obj2mesh and Radiance have nothing to work on. Then your
only option is to write your own functions for texture mapping and normal
smoothing.

bye

···

On Wed, 15 Feb 2006 13:57:52 +0100 Thomas Bleicher <[email protected]> wrote:

Nicolas,

You've received some pretty good information. If you are not concerned with texture coordinates, you could use a small tool of mine to generate surface normal vectors on a OBJ file. The program is called "rocksmooth" and it is in my "rocktools" package, available at:

http://mark.technolope.org/rocktools/

If you find that your modeller does not output texture or normal indexes, rocktools can read it and create just the normal vectors and indexes.

Good luck!

Mark

···

On Wed, 15 Feb 2006, Nicolas Roy wrote:

I recently tried using OBJ2MESH for applying smooth shading to models, made using a 3rd party CAD software, and also to map textures. None of it worked.

- I did not see any option for implementing smooth shading in the obj2mesh manual, can anyone helps explaining how it should be specified?

- For mapping texture I used the following code, but there was no texture
on the object rendered (a ball) just plain color :

If your application (CAD) does not explicitly include vertex normal info (vn) try this application:

http://www.uvmapper.com/

it gives you great flexibility in the .obj output and also does a nice job at automatically unwrapping .obj's for a UV map that you can then paint on, etc.

I use Lightwave for some modeling and it does not export vn's in its .obj file exports. I use UVMapper (Poser will also append vn's) and then use obj2mesh and it works fine. Remember also to subdivide your mesh within your CAD program to a good level of detail to help the smoothing along.

kirk

···

------------------------------

Kirk L. Thibault, Ph.D.
[email protected]

p. 215.271.7720
f. 215.271.7740
c. 267.918.6908

skype. kirkthibault

On Feb 15, 2006, at 7:26 AM, Nicolas Roy wrote:

Hi all,

I recently tried using OBJ2MESH for applying smooth shading to models, made
using a 3rd party CAD software, and also to map textures. None of it
worked.

- I did not see any option for implementing smooth shading in the obj2mesh
manual, can anyone helps explaining how it should be specified?

- For mapping texture I used the following code, but there was no texture
on the object rendered (a ball) just plain color :

void colorpict ball_surface
7 red green blue ball.pic . frac(Lu) frac(Lv)
0

ball_surface plastic ball_finish
0
5 0.5 0.5 0.5 0 0

ball_finish mesh ball_mesh
1 ball.rtm
0

That's about it, any support will be appreciated.

Thanks

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