md2 lighting screwy

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
trotta
Posts: 5
Joined: Tue Jun 28, 2005 6:24 pm

md2 lighting screwy

Post by trotta »

I've been trying to get my md2 model to look decent in Irrlicht 0.10 for the last few days. The problem seems to be either with the lighting, or with the models polygon tangents. A straight import into Irrlicht results in the facets of the model popping in and out of shadow, but, it's only about 70% accurate. When the model is rebuilt with tangents, it looks fine, however, there doesn't seem to be a way of reverting from flat shaded to smooth shaded(and I can't animate the model). Is there a way to alter the code pertaining to the gouraud shading routine, or the md2 handling that would result in something closer to the smooth shade look of 3ds max? as it stands, my model is completely unusable and confusing to the eye.
Guest

Post by Guest »

It sounds like you're getting no vertex normals, or the vertex normals are not normalised.

What modeling package are you using? You speak of 3DS Max, but does that even write MD2s directly?

From what I understand, 3DS format (I'm not talking about MAX format) does not include vertex normals, so if you use that as an intermediary file format, that's probably why you're not getting smooth shading.
trotta
Posts: 5
Joined: Tue Jun 28, 2005 6:24 pm

Post by trotta »

ok, I'm exporting my md2 file from 3ds max using a maxscript written by adam barton. I'm pretty sure the script works fine, because in a couple of other md2 viewers the model is fine(these viewers rely on the normals generated with the md2 file). Changing the md2 code of Irrlicht had some promising results. calling the generateNormals() function in the md2 code (which had just been commented out) resulted in nice flat shading, do you know if there is any way of enabling smooth shading? I'm thinking the original problem could be to do with the vertex normal table in the md2 code could be the problem, or (hopefully not) it could be something to do with the normals being generated by the max md2 exporter. What I was thinking of trying, was to find a more extensive normal table(as the model I'm working on is a lot higher detail than the original quake2 models) or trying to work out a way to get the generated normals smooth shaded. Any suggestions for other options? The X format doesn't have any probs but I need morphing animation not skeletal:(
Post Reply