Archived

This topic is now archived and is closed to further replies.

flaXen

Need a textured + shaded tri filler

Recommended Posts

Hello, Does anyone have a tri filler that supports U/V texture mapping AND gouraud shading written in C/C++? I don''t need perspective correct texture mapping or anything fancy. I''m making a model viewer for my game engine that runs under Windows, so 24bit color would be used, not 8bit indexed w/ lightmap. Any help would be VERY helpful! Thanks! -- Dan

Share this post


Link to post
Share on other sites
you probably do need perspective correction else it''ll look rubbish and the textures''ll move around on the triangles as the model is rotated!
There''s a big pile of sites around, but it''s surprisingly difficult to find stuf on trinagle shaders cos so few people bother anymore (unlike me!)
If I assume you can do I triangle filler basically then here''s how to extend it to gourad and textures:
Each vertex has x,y,z coords, also r,g,b colour info and u,v texture coords.
Before you found how much z changes as you cahnge the x & y values across the triangle. Now you do the same for r,g,b,u,v. Instead of writing the z value at each pixel to a zbuffer, you also get the colour info from the interpolated r,g,b values and the texture coordinate from the interpolated u & v values.

If you don''t understand tri-fillers at all let me know and I''ll try and write a very basic one for you.

Share this post


Link to post
Share on other sites