I’m not really sure what the standard way to do it is really since there are so many ways to do it. My demo is using a variation on the physical based refraction.
The source is availible for the demo if you want to take a look at how it works (shouldn’t be too hard to follow).
Originally posted by Humus: Damn, you win this time.
Heh, but you had a head start, I’ll be better prepared next round.
Yeah, but I had a 9700 for a few months before you, so it’s a little unfair to begin with. But then again, I did have to wait for the ARB_f_p extension and drivers too…
Oh well.
And actually, the only part of the demo that I already had done is the phong lighting, the refraction I did the same day I released the demo. But refractions are easy, I’m sure you could have figured that out.
I’m pretty sure it’s fillrate, since I have to render the scene (with phong lighting) 6 times for the cube map and that’s using CopyTexSubImage2D, so it isn’t exactly the fastest way to do it.
If I comment out the cube map generation code, the framerate jumps up to about 90FPS.
Initially, I felt that that’s still surprisingly slow. 20 gigabytes per second should fill more than that. You’re not really slurping through > 200 megabytes of data per frame? (20 gigabytes / 90 fps)
Ah, but your fragment program is pretty long. Thus, it might still be fill rate, but fragment ops rather than bytes touched.
Each fragment goes through 40 instructions (!). At 320 MHz, you can do 8 million fragments per pixel pipe. Multiply by 8 pixel pipes, divide by 0.48, and there’s your 90 fps right there!
Luckily, I believe the low end, and cards in general, will be able to scale fragment shader clock speed much faster than they’ll be able to scale memory throughput, so this approach will probably be commonplace any year now
I wonder if some of those other vector derivations could also be done in the vertex program and sent through texture interpolators as well. And I wonder if that would speed up the execution of this particular program… intriguing…
[This message has been edited by jwatte (edited 11-10-2002).]
Originally posted by NitroGL: Actually, you can just comment out the VAO code, and uncomment the standard vertex array code (disable the other VAO code though).
Its worst than I thought, I dont have ARB_fragment_program, only NV_fragment_program. Now I have compare and fix.