Archive for the ‘Game techniques’ Category

Energy Conservation

Saturday, July 25th, 2009

Rory Driscoll had a good post in his blog a few months ago reminding everyone about energy conservation in lighting models.  Energy conservation simply means that the amount of reflected energy from a point is equal to the amount of energy incident to that point.  This is particularly noticeable in specular reflection models where the overall brightness of the specular term changes with the specular exponent.

Anyway, there were a few good replies to his post with derivations of the normalization terms required to conserve energy provided by Fabian “ryg” Giesen of Farbrausch. The lighting models used by most games won’t account for energy conservation across diffuse and specular terms but adding a normalization term is a simple step to take.

How Did I Forget About Humus?

Sunday, March 1st, 2009

Somehow I haven’t checked Humus’ website for about six months. Not sure how that happened, as that guy always has great little demos and tricks to share. Of particular interest to me is his trick for detecting where to perform multisampled deferred shading in his Deferred Shading 2 app. By passing SV_Position to the pixel shader with centroid interpolation, you can detect if you are at an edge by examining if the centroid sampled position has moved from the pixel center. Awesome! Saves you an edge detection pass.

Also of particular interest to me are Shader Programming Tips #1, 2, and 3. It’s great to see someone talking about GPU Shader Analyzer. The program is super-handy and I use it almost every day. I can’t imagine optimizing without it.

His little experiment with Alpha to Coverage here is pretty cool too. I’ve always thought A2C was lousy. I never thought that maybe that was partially because the HW implementation was not so good.

Thanks Humus for adding an RSS feed so that this will never happen again!

Horizon Split Ambient Occlusion

Wednesday, February 27th, 2008

I have so much I want to write about what I saw at I3D and GDC that sitting down and doing it seems daunting. I will try and post my thoughts over the next few days.

One interesting poster at I3D (and also a short talk at GDC) was an extension to SSAO. The idea was to calculate a piece-wise linear approximation of the horizon ala horizon mapping. This is achieved by sampling the depth values along m steps ( they used 8 ) in n equally spaced directions (8 again) in the tangent frame. At each depth sample, you update the horizon value if the current depth sample is higher than the current estimation of the horizon in that direction. Sampling in this fashion reduces over-occlusion. This is actually very similar to the approximation to AO that Dachsbacher and Tatarchuk described in their poster at I3D last year, “Prism Parallax Occlusion Mapping with Accurate Silhouette Generation“. All of the authors from the poster are NVIDIA guys and they announced that they will release a whitepaper describing their method.

2007: The year SSAO broke

Sunday, February 10th, 2008

kindernoiser

(image from RGBA demo kindernoiser)

One of my very first posts on this blog discussed the image space ambient occlusion paper by Shanmugam et al. That post has more hits than any other entry I’ve made here. So I thought I would take a few minutes and survey the state of the art in screen space ambient occlusion.

CryTek gave a presentation at SIGGRAPH 2007 in the Real-time Rendering course. They didn’t reveal any exact implementation details, but did reveal that they are only using the depth buffer from their z pre-pass (unlike the Shanmugam paper which uses depth and normals). They additionally noted that they use a per-pixel rotated disc of sample offsets to reduce sampling artifacts. This technique is common for reducing sampling artifacts in shadow mapping.

Iñigo Quilez ( of RGBA demoscene group, yay ) has created a website dedicated to his use of SSAO in the RGBA demo kindernoiser. One unique contribution is that he suggests doing a post-SSAO blur to lessen sampling artifacts. He has given the most detail by into the implementation of his technique, by far. A thread which follows some of the early results he was getting is @ gamedev. He also provides a analytic solution for the ambient occlusion due to a sphere here.

Megan Fox developed a technique which she refers to as “Crease shading“. It differs very little from the original Shanmugam technique. However, she provides an excellent breakdown of the technique and some comparison screenshots.

A tweak that I implemented for SSAO is to perform the ambient occlusion computation on a lower resolution texture and then upsample using an boundary respecting filter. I suggested on this blog (here) that the bilateral upsampling technique works well. I have received email from a few people that have tried it and are getting pretty good results.

So.. a whole lot of people were very interested in SSAO. Rightly so. Approximating an expensive technique like dynamic ambient occlusion (which itself is an approximation!) in a geometry-independent manner is a valuable tool. Of course, it has some serious drawbacks such as not being able to account for occlusion from back facing polygons and causing over occlusion, to name a few. If anybody knows of any other implementations/discussions of SSAO anywhere on the web, please post them here.

Presentations from Gamefest 2007

Sunday, October 14th, 2007

Slides and audio from Microsoft’s Gamefest 2007. The presentations cover a gamut of topics.. from art, audio, graphics and researchy-type-stuff from MSR. Check it out here.

NPR style of Team Fortress 2

Wednesday, September 19th, 2007

Heavy weapons guy

While the gaming world waits patiently for the release of Valve’s Team Fortress 2, Jason Mitchell et al. have been releasing a deluge of material on the rendering style of the game. While there is nothing especially novel about the techniques, I think the paper is an interesting exercise in authoring a lighting model to achieve a desired look. It helps that the trailer videos are fun to watch.

Illustrative Rendering in Team Fortress 2, Mitchell et al. NPAR 2007.

Rendering techniques featurette with commentary

Just Blur and Add Noise

Wednesday, August 29th, 2007

All of the hoopla regarding the game LittleBigPlanet has reminded me of the excellent talk that Alex Evans, co-founder of game creator Media Molecule, gave last year at the Advanced Real-time Rendering for 3D Games course at SIGGRAPH 2006. There are good presentation slides in PDF form at the ATI Developer site: here. If you look at the slide pictures you can see early renders of LittleBigPlanet characters, with unfortunate spheres places on their heads so as not to spoil the game (this was about nine months before the game was announced).

Anyway, he discusses a few techniques that he tried in achieving global illumination-like effects in a “small world” type of environment, all of which were implemented on a Radeon mobility 9800; nothing is too high tech.

screenshots from alex’s pres

Tom Forsyth simplifies things for you

Saturday, May 5th, 2007

Tom F, author of many great GDC presentations and online articles, posted a great little article and demo a month or so ago.  Tom has taken three oft-used “hacky” lighting models ( Wrap lighting, Bi-directional lighting, and hemispherical lighting ) and generalized them into one lighting model. This is a great article for anyone unfamiliar with some of the non-lambertian lighting models that game developers frequently use,  and a cool hack to get a little variation out of one lighting model.

Danger Planet by Fantasy Lab

Wednesday, May 2nd, 2007

Danger Planet

Fantasy Lab, the company that released that Rhinork global illumination demo last summer, has released a screenshot from the first game utilizing their Fantasy Engine, Danger Planet. The company president is Mike Bunnell, the guy who wrote the GPU Gems 2 article on modeling light transfer and occlusion based on disc-to-disc form factors. The technique they are using for indirect light is no doubt based on the method in GPU Gems, but likely with many improvements. One image is sort of a disappointment.I’m dying to see a video, preferably with some ray gun blast lighting!

Fantasy Lab

Real-time Ambient Maps

Monday, March 19th, 2007

I visited the CryTek booth at GDC 2007 and watched their CryTek Engine tech demo trailer for about the 10th time. They have a lot of impressive looking things going on there, but one thing that I hadn’t really thought about until recently was their “Real-time Ambient Maps” which are demonstrated in this video: http://www.youtube.com/watch?v=VFtATu5gt3k

I don’t think a lot of people realize at first what exactly this feature is, besides the fact that the video looks good. While the point light soft shadows are nice, you need to look past them. The “ambient” part should be a tip-off. When doing surface lighting, the ambient term is an approximation to global illumination.. the amount of non-direct lighting incident on the surface. Ambient occlusion refers to the determination of the fraction of the hemisphere above a surface position that is occluded. Simply modulating an ambient lighting amount by the ambient occlusion factor adds a very effective approximation to global illumination. So therefore to get a decent approximation that accounts for multiple-bounce lighting, you have to get an approximation of the amount of light bouncing around the room.

Of course, I have no idea exactly what they are doing and the rest of this is speculation. But I would guess that in order to get an approximation of the ambient lighting term, they are rendering cube maps, in artist-defined positions, of the nearby surfaces shaded with direct lighting. Each texel in that cube map can be treated like a little light source. To get the amount of lighting incident on that cube map position, you can average all of the texel values in the cube map. Of course, each texel should be weighted by its distance from the cube map center to account for attenuation. The resulting value is a quick and dirty approximation of the ambient lighting term in the room! Assuming that these scenes are spatially subdivided by some structure such as a BSP tree, portals, etc. the cube map rendering would be accelerated by only rendering lit surfaces in nearby nodes.

Direct vs. Ambient

Note that this is only an ambient term and has no directional properties. It’s also possible to convert that cube map into a spherical harmonic representation of irradiance which could in turn be used to light nearby surfaces. I found this poster, which describes doing something similar.

Anyway, just thought I’d post something about this because I’ve seen several posts on forums wondering what’s going on here. I’d love to hear anyone else’s thoughts.