Home Articles Tutorials Resources About
Code snippets   Last update: July 15 2008 by System

LogLuv floating point encoding in 32 bpp formats
The LogLuv encoding turns out to be quite useful when doing HDR rendering in XNA, because there are some downsides to the available native floating point formats, most notably on the 360. After some discussion we pieced together a nicely working HLSL implementation.

View this resource
Implicit circles using a pixel shader
This sample is inspired by an older discussion on how to draw a 2D circle in XNA. The obvious way would be to use some geometry, but I quite liked the idea of using an implicit formula, so here's a quick sample showing how this could be done. Giovanni Botta provided an improved version that facilitates putting the technique to work.

Download this resource
Manual linear texture filtering in HLSL
This snippet shows how to manually do simple linear interpolation over your texels in HLSL as an alternative to setting your sampler to linear filtering. This may be useful if your sampled texels need to be processed before they can be interpolated correctly, in which case you can't rely on the sampler.

View this resource
Code Snippet - Input Service provider
This small demo inspired by this thread and this blog post shows how to wrap your basic input handling into a class for use with Game.Services. It's a nice solution to 'XNA short term memory loss' without having _lastState variables everywhere and it might be a nice base to extend for your input needs.

Download this resource
Fractals on the GPU
This little sample was blatantly copied from Shawn Hargreaves blog. I just thought it'd be nice to have it available as a ready-to-run sample. It is controlled exclusively with the gamepad; left stick pans, a/b zooms, y toggles bloom, start toggles between Mandlebrot/Julia and the right stick sets the Julia seed.

Download this resource
ClearType for images
This little snippet shows how Cleartype rendering can be applied to images, as per this blog post. This rendering effectively tripples your horizontal resolution (on LCDs) at the cost of correct color details.

View this resource
XNA info is sponsored by vector4. All content is copyright © 2005-2014 by its respective authors | About XNA info | Terms of Use | RSS feed