Hi,
I don’t manage to read colors’meshes in my .3ds files. I read in the 0xa010 then in 0x0011 but when i display the red, green and blue values by doing a cast to an integer i have for example a white color instead of a brown one (for the color of skin of a character)under 3d studio max.
Can you help me ?
case 0x0011: unsigned char red, green, blue ;
file.read((char*)&red, sizeof (unsigned char));
file.read((char*)&green, sizeof (unsigned char));
file.read((char*)&blue, sizeof (unsigned char));
cout<<dec<<"rouge "<<(int)red<<" vert "<<(int)green<<" bleu "
<<(int)blue<<endl ;
break ;
It seems like use correct way to load color values from 3ds file. I’ve load colors using 0x0011 chunks in very similar way and can’t say that result is incorrect. By the way, what the output operator show in your case? All 255? Maybe you have an error of convertion those values later to floating points without division by 255?
Hmm, there’s a mistake I myself run into sometimes. When doing the division remember to put 255.0 so as to convert the number to double (or 255.0f for float). Without it the program executes integer division which would give 0 or 1. Is there a chance you could post the code for the .3d loader here? I’d like to take a look at it.