PDA

View Full Version : Some problems in our turtle!



Ehsan Kamrani
08-27-2006, 09:45 AM
Hi there
Our modeller has designed a turtle character with 3DMax. I have rendered it with OpenGL. However it has some problems.Let's start step by step...
Here's an screenshot of the turtle rendered with 3DMax:
http://zehneziba.ir/screenshot/LAKI/1.jpg

And here's the character rendered with our engine:

http://zehneziba.ir/screenshot/LAKI/ZehneZiba%202006-08-27%2020-04-02-03.jpg

As you see, the polygons of his face look bad.

1)why the image rendered with 3DMax is different by the rendered image in my program?

2)Should we add more polygons to our model? This model has about 1300 vertices.(Can we solve the problem without adding the new vertices? )
3)Can i improve the lighting calculations in my program?
4)take a look at his neck:

http://zehneziba.ir/screenshot/LAKI/ZehneZiba%202006-08-27%2017-53-01-37.jpg

Yes.Noone like to see such neck in a game.So how can i improve the shape of this neck?( Can i do anything with OpenGL to improve the quality of the neck? )

5)How many vertices can we use for this turtle to have a good looking character?
Regards
-Ehsan-

Komat
08-27-2006, 10:18 AM
It is possible that something happened to the vertex normals in the process of getting them into your program. They may have incorrect directions or they are smoothed incorrectly (or using different set of triangles for smoothing than the 3dmax uses).

plasmonster
08-27-2006, 10:19 AM
It looks like maybe you've got some normals out of whack. Have you tried recalculating your mesh normals?

More triangles can help make things smoother, sure, but you may not need them. I'd fix those normals first. The reason I say normals is because the shading looks wrong.

Edit:

Double post! What Komat said :)

Ehsan Kamrani
08-27-2006, 11:39 AM
Thank you.Actually when my colleague selected the "Unify Normals" instead of the "Flip Normals", the image rendered with 3DMax was the same as the scene rendered with my program...
I wrote another question in gamedev.net, since this topic refers to the 3DMax software :
http://www.gamedev.net/community/forums/topic.asp?topic_id=411644
-Ehsan-

Zengar
08-27-2006, 02:13 PM
3ds max usually uses special face smoothing mechanisms (where each face sharing the same smoothing bit appear smooth), while OpenGL uses per-vertex normals. I think this can be your problem. How do you calculate normals? Probably you should add more faces...

Ehsan Kamrani
08-28-2006, 03:44 AM
HiOne problem reffers to the normal vectors. Actually exporting the normal vectors to the 3DS file format was changing the direction of some normals( My code is correct ).
As you said , OpenGL lighting calculations are per vertex. So i guess that he should generate more polygons.
I don't calculate the normal vectors. I read them from the 3DS file.
-Ehsan-

08-28-2006, 04:15 AM
3ds files don't store normals.

Zengar
08-28-2006, 05:46 AM
I wrote a 3ds loader several years ago and I can remember dealing with smoothing groups and calculating the normals myself. The models I loaded looked good. I don't have the code anymore and can't remember the details though.

plasmonster
08-28-2006, 05:55 AM
That's the way I remember it as well. You need to (re)calculate the normals yourself, using the triangle vertices and the optional smoothing groups. The is no NORMAL chunk, or the like, as I recall. Though I hasten to point out that it's been a while.

Ehsan Kamrani
08-28-2006, 01:26 PM
Actually i load the ms3D models.However we need to create our models in 3Ds Max and import them to milkshape3D. So i need a common importer/exporter in both the softwares.Are you aware of a good file format that doesn't crash the normal data?
Does such format use the "unit" normal vectors?
-Ehsan-

dorbie
08-28-2006, 02:01 PM
It's either surface normals being incorrectly calculated or differently smoothed between rendering paths. The idea is that normals are shared and averaged at a vertex under some control or angle threshold. You need to adjust this or as you have understood, preserve normals throughout the export & rendering process.

Ehsan Kamrani
08-28-2006, 04:06 PM
Originally posted by <pfft>:
3ds files don't store normals. It's clear that 3DS file format does not suppro normal vectors. But i think that 3Ds Max Have written a function to add normal vectors to the 3DS file. When i open the 3DS file and select the edit normal modifier, i can see the normal vectors.
-Ehsan-

Komat
08-29-2006, 12:48 AM
Originally posted by Ehsan Kamrani:
Actually i load the ms3D models.However we need to create our models in 3Ds Max and import them to milkshape3D. So i need a common importer/exporter in both the softwares.Are you aware of a good file format that doesn't crash the normal data?
One format supported by both the 3DSMax (at least trough the plugin) and MilkShape3D should be the ".x" DirectX format. That format also contains vertex normals.

08-29-2006, 09:02 AM
Originally posted by Ehsan Kamrani:

Originally posted by <pfft>:
3ds files don't store normals. It's clear that 3DS file format does not suppro normal vectors. But i think that 3Ds Max Have written a function to add normal vectors to the 3DS file. When i open the 3DS file and select the edit normal modifier, i can see the normal vectors.
-Ehsan- You mean you import a 3ds file into milkshape and then modify normals?

08-29-2006, 09:18 AM
Originally posted by Ehsan Kamrani:
I don't calculate the normal vectors. I read them from the 3DS file.
-Ehsan- I'm really confused by your posts, Ehsan Kamrani.

Ehsan Kamrani
08-29-2006, 10:48 AM
[/QUOTE]You mean you import a 3ds file into milkshape and then modify normals?[/QUOTE]

Yes.However i don't compute/edit normals.In my implementation of 3DSMAX(version 7 ), 3DS file consist of the normal vectors.As i said before, i guess the 3dmax programmers have added a function to compute the normal vectors.
Note : i don't know why message board has some errors in my browser(Mozilla Firefox).
-Ehsan-

Komat
08-29-2006, 11:44 AM
Originally posted by Ehsan Kamrani:
But i think that 3Ds Max Have written a function to add normal vectors to the 3DS file. When i open the 3DS file and select the edit normal modifier, i can see the normal vectors.
The normal vectors you see are not stored within the 3DS file itself. When 3DS Max loads the file, it calculates the normals from vertex positions and additional informations stored inside the file. If another program uses different calculations (or interprets the data differently), it may get different normals.

Ehsan Kamrani
09-20-2006, 08:40 AM
As you know, OpenGL lighting is per polygon. It causes some problems in our game. Take a look at our turtle as an example:
http://zehneziba.ir/screenshot/turtle/turtle.jpg
You can see the boundries of the polygons when lighting is enabled. So how can i solve this problem? I use frm cal3D, so i'm sure that normal vectors are imported with no errors. Note that the length of each normal is equal 1.
-Ehsan-

songho
09-20-2006, 08:52 AM
Ehsan,
Take a look at the per-pixel lighting using GLSL.
Here is a good tutorial:
http://www.lighthouse3d.com/opengl/glsl/index.php?dirlightpix

You can see the difference between per-pixel and per-vertex lighting at the bottom of the page.

jide
09-20-2006, 09:16 AM
Do you mean the shape of the turtle (those bad hard line links) ? I would advise to make a turtle with more polygons and also ensuring that normals aren't all the same for a given polygon (so with using per vertex normals).

This might give best results.