OBJ2MESH - Phong smooth shading and texture mapping

Hi,

Thanks for the valuable information. I'm using Lightwave for modelling and
after inspecting the .obj file I used I can see that I'm missing the
information for vertex normal and UV-coordinates. I get the folowing out of
my .obj exports :

# OBJ File Generated by LightWave3D
# LightWave3D OBJ Export v2.2
# Object: 1
# Vertices: 32
# Points: 0
# Lines: 0
# Faces: 36
# Materials: 1

o 1

# Vertex list

v 1.5 1.5 0.7
v 1.65 1.5 0.740192
v 1.575 1.6299 0.740192
v 1.425 1.6299 0.740192
v 1.35 1.5 0.740192
v 1.425 1.3701 0.740192
v 1.575 1.3701 0.740192
v 1.75981 1.5 0.85
v 1.6299 1.725 0.85
v 1.3701 1.725 0.85
v 1.24019 1.5 0.85
v 1.3701 1.275 0.85
v 1.6299 1.275 0.85
v 1.8 1.5 1
v 1.65 1.75981 1
v 1.35 1.75981 1
v 1.2 1.5 1
v 1.35 1.24019 1
v 1.65 1.24019 1
v 1.75981 1.5 1.15
v 1.6299 1.725 1.15
v 1.3701 1.725 1.15
v 1.24019 1.5 1.15
v 1.3701 1.275 1.15
v 1.6299 1.275 1.15
v 1.65 1.5 1.25981
v 1.575 1.6299 1.25981
v 1.425 1.6299 1.25981
v 1.35 1.5 1.25981
v 1.425 1.3701 1.25981
v 1.575 1.3701 1.25981
v 1.5 1.5 1.3

# Point/Line/Face list

usemtl Default
f 3 2 1
f 4 3 1
f 5 4 1
f 6 5 1
f 7 6 1
f 2 7 1
f 3 9 8 2
f 10 9 3 4
f 11 10 4 5
f 12 11 5 6
f 13 12 6 7
f 2 8 13 7
f 9 15 14 8
f 16 15 9 10
f 17 16 10 11
f 18 17 11 12
f 19 18 12 13
f 8 14 19 13
f 15 21 20 14
f 22 21 15 16
f 23 22 16 17
f 24 23 17 18
f 25 24 18 19
f 14 20 25 19
f 21 27 26 20
f 28 27 21 22
f 29 28 22 23
f 30 29 23 24
f 31 30 24 25
f 20 26 31 25
f 27 32 26
f 28 32 27
f 32 28 29
f 32 29 30
f 31 32 30
f 26 32 31

# End of file

I will now investigate on a new obj exporter.

@ [email protected]
www www.VELUX.com

                 Ian Tester
                 <[email protected]>
                                              To
                 Sent by: [email protected]
                 radiance-general-bounces@rad cc
                 iance-online.org
                                              Subject
                                                      Re: [Radiance-general] OBJ2MESH - Phong smooth shading and texture mapping
                 15-02-2006 15:44
                 Please respond to
                 Radiance general discussion
                 <radiance-general@radiance-o
                 nline.org>
                 Stationery name:
                 -Untitled-
                                                                                                                                       
             [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:

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

This UV mapper tool is fantastic, I just made a test and both texture and
smooth shading was on. Thanks!

@ [email protected]
www www.VELUX.com

                 Kirk Thibault
                 <[email protected]
                 > To
                                                      Radiance general discussion <[email protected]>
                 Sent by: cc
                 radiance-general-bounces@rad
                 iance-online.org Subject
                                                      Re: [Radiance-general] OBJ2MESH - Phong smooth shading and texture mapping
                                                                                                                                       
                 15-02-2006 15:55
                 Please respond to
                 Radiance general discussion
                 <radiance-general@radiance-o
                 nline.org>
                 Stationery name:
                 -Untitled-
                                                                                                                                       
If your application (CAD) does not explicitly include vertex normal
info (vn) try this application:

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
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

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

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

Cool! Yeah - UV Mapper is pretty nice - try playing around with the actual UV maps that it can create too - the export of the map itself is a nice feature (no need for taking screenshots of the UV mesh to paint textures and patterns on). I have not actually tried the "Pro" version (that costs money) but I am going to look into its additional features. Unwrapping a complex object by hand so the UV map is minimally distorted is sort of a drag.

Glad it worked,

kirk

···

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

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

On Feb 15, 2006, at 10:38 AM, Nicolas Roy wrote:

This UV mapper tool is fantastic, I just made a test and both texture and
smooth shading was on. Thanks!

@ [email protected]
www www.VELUX.com