Sign in to follow this  
Dragon_Strike

3ds smoothing groups + vertexcolor

Recommended Posts

how would one retrieve smoothing groups information from a 3ds file? how does smoothing groups work? are all the vertex normals in a smoothing group the average of the neighbor face normals.. and where 2 different smoothing groups meet the average vertex normals are separated...? [Edited by - Dragon_Strike on May 27, 2007 9:16:54 AM]

Share this post


Link to post
Share on other sites
mesh->faces[y].getSmGroup();

Yes, that's exactly how they work. Vertices on an edge that straddles faces with different groups don't average together.

Share this post


Link to post
Share on other sites
Quote:
Original post by RubiconMobile
mesh->faces[y].getSmGroup();


thx for the answer.. but i dont know where u got that function... what id like to know is the hex code for the smoothing groups and some hints on how to load the data...

Share this post


Link to post
Share on other sites
after alot of guessing i think ive finally figured it out.. does this look correct?


#define SMOOTHING_GROUP_LIST 0x4150

case SMOOTHING_GROUP_LIST:
F_SMOOTHING_GROUP_LIST();
break;


void Model_3DS::F_SMOOTHING_GROUP_LIST()
{

int amount = m_Object_3DS.back().faces_amount;

m_Object_3DS.back().FaceSmooth = new long int[amount];

for (int i = 0; i < amount; i++)
{
fread (&m_Object_3DS.back().FaceSmooth[i], sizeof (long int), 1, file);
}

}




but im a bit unsure of what to do next... doin something like thsi seems a bit much... also it only works for edge cases taht are caused tu to texturing and alike...

for each face
for each face
if smoothgroups is equal
for each vertex
if vertex pos is equal
avarage normals

Share this post


Link to post
Share on other sites
I can't help you much, and it doesn't look like anyone else really can.

Are you free to choose your 3D mesh format? If so, there are far better choices than 3DS. If not, then there must be some available 3DS loaders for your 3D API. Tell us what you're developing in.

Admiral

Share this post


Link to post
Share on other sites
Quote:
Original post by TheAdmiral
I can't help you much, and it doesn't look like anyone else really can.

Are you free to choose your 3D mesh format? If so, there are far better choices than 3DS. If not, then there must be some available 3DS loaders for your 3D API. Tell us what you're developing in.

Admiral


yes i am free to choose my format...

what formats do u recommend?

there is lib3ds but i havent managed to get it working...

what i need is a proper model loader that has most function and variables but doesnt need any animation functions...

Share this post


Link to post
Share on other sites
If you're using 3DSMax you could always write your own custom exporter for max that saves out the data you need.

I agree with theadmiral on the 3ds format. I wrote a parser a few years ago and it was such a pain. Just not a great format for games.

Share this post


Link to post
Share on other sites
Hello,

you've got three options: 1) write an exporter in MaxScript (can't help you with this ;<) )
2) write an exporter with the MAXSDK
3) write an exporter with the IGame interface

The last option is the way I did it and the easiest IMHO if you're already proficient with C++. It's a high-level interface to use the MAXSDK, aimed squarely at you: the game-programmer. Some may say it's a bit clumsy to use and yes it has it's share of bugs when you do really advanced things, but in the end it's just a matter of taste and it sure is a lot easier to pick up than the MAXSDK!
I've heard MaxScript now supports writing binary files too, so you might as well check it out if you're prepared to learn a new language...

Hope I've been able to help,
Jeroen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this