Leave a comment

>HDR

>HDR rendering means you do all your pixel/lighting calculations in a higher precision than that which is used for display, in a more “open-ended” color space. For example, you might use a 16bit per channel floating point surface. Normally, the output for each color channel is clipped to (0, 1). So if your lighting calculations meant that a pixel was brighter than full brightness, that information was lost. A floating point surface will allow for values greater than 1 (just using an 8 bit per channel FP surface won’t technically give you any greater precision than your standard RGB, but makes calculations easier since you can just let values go above 1).

Unfortunately, none of the floating point surface formats on the Xbox support alpha blending. So that was pretty much a deal-breaker.

I could use a regular 32 bit ARGB render target, and just divide all my output pixel values by some factor. And then draw that render target to the back buffer and multiply by that factor again. But then I am losing precision. I played around with this before, and it wasn’t too bad – but I dropped it because I perceived it to be a problem.

D3D supports a R10G10B10A2 format… 10 bits per color, and 2 alpha channel. This would suit my purposes, but the 2 bit alpha channel always worried me. Although, conceptually I didn’t understand why the alpha channel of the render target mattered at all. So I coded this up again and was pleased to see it work fine.

On the PC.

On the Xbox, all my translucent objects were reduced to 4 levels of alpha. Why? They are only being drawn on top of the 2-bit alpha render target. Some searching on the XNA forum again showed that the Xbox converts the output of the pixel shader to the format of the render target before applying it to the render target. Foiled again!

Further research showed that this was only a problem for “translucent” alpha blending: where the final result included the original destination pixel in its calculation. Most of my non-particle alpha objects were like this (e.g. the shield, the planet atmosphere, the spotlight cones). Most of the particles used additive alpha blending. This wasn’t an issue for additive alpha blending.

I found that I could mostly emulate the effect I want solely using additive alpha blending. A few things look a little worse, but I hope the gain I get from “true” HDR will be worth it.

What does it give me? Well, I don’t need the contrast range necessary for realistically rendering indoor/outdoor scenes, and adjusting “exposure” (since the game takes place in space). What I do get is bloom: washing out the brightest parts of the scene with a glow.

The effect is often over-used in games, but I think it will help make things look more “professional”.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Just another WordPress site

Just another WordPress.com site

The Space Quest Historian

Adventure game blogs, Let's Plays, live streams, and more

Harebrained Schemes

Developer's blog for IceFall Games

kosmonaut's blog

3d GFX and more

Halogenica

Turn up the rez!

bitsquid: development blog

Developer's blog for IceFall Games

Game Development by Sean

Developer's blog for IceFall Games

Lost Garden

Developer's blog for IceFall Games

Memories

Developer's blog for IceFall Games

Casey's Blog

Developer's blog for IceFall Games

Blog

Developer's blog for IceFall Games

Rendering Evolution

Developer's blog for IceFall Games

Simon schreibt.

Developer's blog for IceFall Games

Dev & Techno-phage

Do Computers Dream of Electric Developper?

- Woolfe -

Developer's blog for IceFall Games

Fabio Ferrara

Game Developer

Clone of Duty: Stonehenge

First Person Shooter coming soon to the XBOX 360

Low Tide Productions

Games and other artsy stuff...

BadCorporateLogo

Just another WordPress.com site

Sipty's Writing

Take a look inside the mind of a game developer.

%d bloggers like this: