Hey!

Welcome to Blip, home of the best original web series! When you’re done watching this episode, checkout some of our top shows or learn more about us!

×

lulzfish

Lamborghini 1: GLSL has no disguise

Other Sharing Options

×
Embed
The embed code has been copied to your clipboard
Share
About this episode
I didn't realize it's been forever since my last video. A whole bunch of things have changed with the Lamborghini demo, and hopefully the "Paragraph...
I didn't realize it's been forever since my last video. A whole bunch of things have changed with the Lamborghini demo, and hopefully the "Paragraph" description in blip.tv can keep up with them: (Roughly in reverse order, so newest first)Added spotlights to my uber-shader. The spotlight is uploaded as a 4x4 matrix that transforms world space into "lighting space". It turns out it's really easy to find the inverse of the usual OpenGL 4x4 matrix, so I did that directly on the CPU and upload the result as a fragment uniform. The spotlight also has colored lighting, which is new for this shader but not generally a big deal.I added some background buildings that are poorly texture-mapped (This is all Blender's fault)I spent like most of a night creating a fog model that worked in postprocessing, then I realized it broke the point sprites, so I did it in the normal rendering step, then I realized it looked stupid, so I only use it to generate the sky.I added some dithering to break up the color banding on the sky. Sadly, the video compression added the banding back in. In real life, you can't really see any banding in the sky.Haven't got shadows in this one, so there's a couple of specular highlights just hanging around in places where they should not appear.Made the car blue because I thought it looked betterBroke the car up into further component parts and discarded a couple such as headlight glass (Obscured by glare or very transparent anyway) and the spoiler (Looked odd, may put it back later)In order to break up some banding caused by the post-process gamma correction, I moved up to a floating-point framebuffer. After some "negative color" artifacts were fixed, this worked out really well, and it means I can consider HDR.Added post-processing for gamma correction among other things.As I said, I'm considering some kind of HDR. Once I have a proper racetrack going, this will become more interesting. I'll probably just have some static exposure volumes, so when you're in a tunnel the exposure will be cranked up and everything outside will be washed out.I also considered deferred shading. It sounds really cool to have like 200 lights in a scene, but I don't think it's worth the effort. My Geforce 7900 GS can have 2048 fragment uniforms, and this whole scene takes about 3.5 milliseconds to render, so I should have enough space for 128 spotlights (Let's call it 100 since I'll have other uniforms) and enough time for "enough" of them. Probably 2 or 4 per car, if I have 8 cars on the field this is not really a problem for forward lighting.I'm thinking about physics. Newton Game Dynamics was recently opened under the zlib license, and I compiled it. If I can make sense of the API, I will probably give it a shot, since it might be better than Bullet. Only testing can tell.I haven't thought too much about particles yet. Soft particles would be cool to do, but I don't really have a use for them yet.I think I upgraded from client-side VAs to VBOs since the last video. You can't see it, but it's more forward-compatible. And after that, I switched from loading a single vertex at a time to loading a whole mesh, to reduce glSubBufferData calls. Only important when the models are first loaded, but it was bothering me.I think that's everything. I forgot to do it during the video, but I can press "G" to disable the post-processing. Without gamma correction, the scene looks ridiculously dark, and the headlights do almost nothing. However, with gamma correction, I can use proper pow (x, -2) attenuation as intended by physics, and it still looks pretty good and the light still "carries" for some distance. So color correction is working all right for me. Less
02:26
Discover the best in original web series.© 2012 Blip Networks, Inc. All Rights Reserved.