View Single Post
# 30 09-04-2006 , 08:53 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
I haven't read the entire thread, but, from my own research-

not that my raytracer is great (i havent posted this in the wip section b/c i think its insignificant) but I did write scripts for triangle raytracing, and, raytracing mostly is per pixel.

However, using a rather complex algorithm that I found on the web and adapted, I wrote triangle gourard shading for my raytracer. The results were dramaticly faster.

I didn't save any pics, but a triangle mesh w/ 150 triangles and standard raytracing (per-pixel shading) rendered just as fast as 7000 triangles gourard shaded. wow.

Well, to really test speeds, I did this: 30,000 triangle mesh (really hi-poly sphere user added image) normal raytraced = 6.5 minutes

And my triangle intersection method is VERY fast, as it uses baryocentric coordinates and no sqrt functions ( that take about 300x more than a + or -)(normal triangle intersection tests use 3 of those). Mine simply uses a bunch of plus or minus.

Now compare that to gourard shaded, which tests each triangle only once by using intersection caching(really simple really). Thats 30,000 triangles= 19 seconds.

And that's with no kind of spatial subdivision scheme- which generally improves rendering by thousands of times.

NOTE: I Didnt post thesse in my wip thread because i copied most of the code. The ones I did paste were entirely written by me.

So now, throw in an octree structure- takes about 1.5 seconds to calculate(for the 30,000 tris);

30,000 tris perpixel shading = 48 seconds(49.5 total)

30,000 tris gourard shading = 2.8 seconds(4.3 total)

So that's my opinion about per-pixel shading. but, I don't know how it works in games, that's just how my raytracer does it.


Live the life you love, love the life you live