PDA

View Full Version : Object Loader V2


kberg
2003.10.18, 08:00 PM
I've finished off a bunch of upgrades to the model loader class I released here about a year ago. Since it took you guys less then a week to punch holes in the previous version, I figured I would give it some time under public scrutiny before I bothered Johan with the new version.

So here it is http://www.sfu.ca/~kberg/Code/ObjLoader.tgz.

I would appreciate if anyone uses .obj files in their games try some of their models out, or trying the provided demo out on different video cards to make sure everything looks ok, or even looking over the code to make sure I didn't make any stupid mistakes or for any obvious optimisations.

I'm a bit iffy about the multipass lighting I use. I couldn't see any way to do the required effects using multitexturing. Also, the anti-aliased line stuff I used had problems on rage 128's, so there's a workaround for those cards built in.

Thanks for all the help...

kberg
2003.10.25, 03:20 AM
I caught a couple problems dealing with untextured objects, but aside from that I have been using this code without problem on a large variety of models (mixing quads , triangles, and texture types) over the last week. So if no-one posts any extra feature requests or bug reports by the end of this weekend I'll email my final version to Johan for posting in the source code section.

I'm still interested in finding out if multipass lighting is possible with fewer passes using multitexturing? More specifically I wonder if it's possible to have a texture unit only have diffuse and ambient lighting calcs applied to it, while another has only specular lighting applied to it, and possibly a third texture unit with no lighting applied to it. Perhaps someone such as OSC would know the answer to this? :p

OneSadCookie
2003.10.25, 07:06 AM
I'm afraid I don't really understand the question... lighting is a per-vertex operation which affects the per-vertex color, which is then interpolated across the fragment...

If you've got a Radeon 9500+ or a GeForce FX you can use a vertex program + a fragment program to do whatever you want, and on lesser hardware there are harder and more restrictive ways of accomplishing similar effects...

This is my favorite tutorial/introduction to per-pixel lighting: http://www.ronfrazier.net/apparition/index.html?appmain=research/index.html . It focuses on GeForce 2 generation hardware (since that's what was available when it was written), but the general principles apply to later generations.

Fragment shading is something that hasn't been standard between NVidia and ATi since the TNT2/Rage128/Radeon and until the Radeon 9500/GeForce FX generation of cards, so if you're targeting the middle range of cards, expect to write several different code paths :p