Jump to content
  • entries
  • comments
  • views

Improved Visuals, Physics, and Camera [Screenshot Heavy]

Sign in to follow this  


I've made a lot of progress since my last post, mainly in the renderer. I added High Dynamic Range Lighting, Cascade Shadow Mapping, FXAA, and the Cook-Torrance BRDF with roughness maps. The previous screenshots were an eye-sore, so it's a relief to have something that looks a little more modern. I'm still dinking around with the hacked-up level though. My hope is to write a plugin for Maya, which would allow me to use Maya as my level editor and export geometry/textures/metadata to a custom format. That way, I could designate custom Maya nodes for things like triggers, and use layering for exporting collision geometry. I haven't quite surveyed how difficult this will be, but I've written Maya plugins before and they're not too difficult. I had to add a post processing framework on top of my deferred renderer that manages render target allocation and provides standard texture samplers and constants. I shied away from a nice compartmentalized process chain, and went more for a set of functions within the post processing object itself. That probably isn't the best way to do it, but it has the benefit of allowing shared/merged shader code where it makes sense. Here's a short list explaining each of the visual improvements I added:

  • The shadows are done by rendering a depth pass into an atlas of cascades. The light matrix for each is computed and stored in a constant buffer. Later, during the lighting pass of the deferred renderer, the shadow map is referenced. The implementation runs a PCF kernel over the shadow evaluation for each fragment, for both of the cascades that it straddles. The results are then linearly interpolated to give a nice smooth border between cascades. Refer to MJP's blog for more info on the algorithm.
  • For HDR, I tried a bunch of different tone mapping filters and couldn't get it to look right. When I switched to the Uncharted 2 method, however, it just clicked. I really like how it preserves contrast and avoids the ugly middle gray tone.
  • FXAA was easy to drop in. I can see how it's a hack though. I'm still noticing tons of temporal aliasing (obviously, since the algorithm is purely spacial), as well as some aliasing within textures. Given what it has to work with, though, I think it does a decent job. I'm really interested in seeing how TXAA looks/performs.
  • My goodness, if you have never used a physically based BRDF like Cook-Torrance, and are still in the dark ages of Blinn-Phong for everything, please give it a try. There is such a difference. Cook-Torrance is a microfacet based BRDF that uses analytical approximations based on probability to compute self-occlusion within a surface, as well as proper Fresnel reflection. There are other physically based models that I'm sure are great too--I'm still learning about them--but Cook-Torrance is impressive.
  • I also dropped in a procedural sky that I found off of one of MJP's samples. The annoying thing about having a pure black background with HDR is that is interprets it as absolute deep space black, causing overexposure of everything in the frame.

    In terms of the tank, I'm still having to work with a hacked up distance joint chain to keep the wheels in sync with each other. Basically, for every neighboring wheel on a given side, I link them at the 0 degree and 90 degree mark, like so:


    That way, there's always a (near) tangential torque applied to the wheel, avoiding lockups or instability. I found out today that you can jack up the iteration count for the solver on a constraint-by-constraint basis. Since the distance constraints are pretty cheap, I set a high value and didn't notice a performance hit. This tightened up the simulation quite a bit, which is a relief. I did the same thing for the tank barrel, since the forces rotating it to face the camera were causing it to jumble around loosely. Not exactly tank-like behavior if you ask me.

    I also implemented an over-the-shoulder third person camera. You can orbit around the tank, within reasonably constrained angles, and the turret/barrel will follow you. I got to do lots of fun 3D math calculating the angles for the turret and barrel within their respective local frames. Currently the camera doesn't do any ray casting to detect/collide with objects, but that's on the radar. That's going to be a bit of a tough issue, since camera collision can be a nightmare for the player, especially if it's contorting itself into corners of the level rather than just fading out objects. I'll have to look into how other commercial games are handling it.

    I'm finally understanding how to use matrices to transform between spaces, and perform projections via the dot product. I bought a book the other day on how commercial physics engines work, and I'm slated to take Calc III and Differential Equations this coming school year. I'm actually excited to learn all this stuff! It's been frustrating looking into the bowels of Bullet Physics and not having a clue how the solvers work. Hopefully by the end of the year I'll understand it much better.

    I believe the next task I will conquer is getting the tank to fire something! I'll probably release another demo sometime around then. Until then, lots of screenshots!
Sign in to follow this  


Recommended Comments

Nice shoots.
May I ask you where did you find the information about how to render using a physically based BRDF approach (Cook-Torrance is what I'm looking for).
I know there are a tons of info around, but judging from your picture I think you've found the right one.

Share this comment

Link to comment
I referenced Realtime Rendering 3rd Edition for the theory. I found a great code reference to be this post: http://www.gamedev.net/topic/444098-hlsl-cook-torrance-lighting/

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!