Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 12:40:42 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Appearance problem while using OBJ loader
Pages: 1 [2]
Print
Author Topic: Appearance problem while using OBJ loader  (Read 3184 times)
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #15 on: 10. September 2007, 10:44:56 pm »

Just for a test, replace the content of the .obj file with the following:
Code:
v 0.0 0.0 0.0
v 10.0 0.0 0.0
v 0.0 0.0 10.0
f 1 2 3
v 10.0 0.0 10.0
v 0.0 0.0 10.0
v 10.0 0.0 0.0
f 4 5 6
Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #16 on: 10. September 2007, 11:02:40 pm »

Should i triangulate the shapes to avoid this phenomenon? If yes, how to do that?

Yes, the OBJLoader only supports triangulated models. In blender you just press something like CTRL+T or so.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #17 on: 11. September 2007, 02:56:47 pm »

Marvin : I think I have already seen Ludo's problem somewhere.. Xith3D maybe has a problem with lighting, that should be investigated further.
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #18 on: 11. September 2007, 03:07:08 pm »

Tried the changed content I posted above? I changed the vertex order to be counterclockwise for both triangles. In the original .obj-file it the first was counterclockwise and the second clockwise. If opengl automatically generates normals, they would point in opposite directions if the vertex order is not the same for both triangles.
Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #19 on: 11. September 2007, 06:43:29 pm »

Hmm... lighting worked perfectly in the last months. I really believe, it's something about the model.

Marvin
Logged
Ludovic Marcé
Enjoying the stay
*
Offline Offline

Posts: 60


ludo123456@jabber.fr
View Profile
« Reply #20 on: 12. September 2007, 12:04:15 pm »

Tried the changed content I posted above? I changed the vertex order to be counterclockwise for both triangles. In the original .obj-file it the first was counterclockwise and the second clockwise. If opengl automatically generates normals, they would point in opposite directions if the vertex order is not the same for both triangles.
Yes, thanks, this was the trick.
Now, my converter creates the obj files like that:

MNTbis.obj (DEM)
Code:
v 0.0 0.0 10.0
v 5.0 0.0 20.0
v 40.0 5.0 20.0
f 1 2 3
v 0.0 0.0 10.0
v 30.0 10.0 20.0
v 40.0 5.0 20.0
f 6 5 4
v 0.0 0.0 10.0
v 30.0 10.0 20.0
v 25.0 15.0 20.0
f 7 8 9
...

It's better but still not perfect as you can see on the screenshots.
I've still few black triangles, I don't know why. Huh
It's probably the obj i create that is not good. Undecided
« Last Edit: 12. September 2007, 12:27:12 pm by Ludovic Marcé » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #21 on: 12. September 2007, 01:25:03 pm »

You could try to use the NormalsVisualizer on the model's shapes. Then you'll see, if the normals are as expected.

Marvin
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #22 on: 12. September 2007, 01:31:22 pm »

try to find an .obj-exporter that also exports normals.
Logged

'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #23 on: 12. September 2007, 03:51:33 pm »

>> try to find an .obj-exporter that also exports normals.

I think he creates the obj files on the fly, from another file format he have to loads from (data comes from the IGN, "Geographic National Institute" in France).
Logged
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic