Image Quality

Published September 13, 2005
Advertisement
So, back on the HDRI stuff again...

Thanks to Ysaneya's comment to one of my previous entries, I realised that trying to "roll my own" filtering algorithm was a nice learning exercise, but not really useful. So I got rid of it and put a simple bilinear filtering function in:
//g_rcp_bloom_tex_w is a float constant indicating the reciprocal of the width//g_rcp_bloom_tex_h is a float constant indicating the reciprocal of the height// -----float xWeight = frac( t.x / g_rcp_bloom_tex_w ) - 0.5;float xDir = xWeight;xWeight = abs( xWeight );xDir /= xWeight;xDir *= g_rcp_bloom_tex_w;float yWeight = frac( t.y / g_rcp_bloom_tex_h ) - 0.5;float yDir = yWeight;yWeight = abs( yWeight );yDir /= yWeight;yDir *= g_rcp_bloom_tex_h;// sample the bloom texture for the 4 relevant pixelsfloat4 b = ((1.0f - xWeight) * (1.0f - yWeight))	* tex2D( tex2, t );		b +=       (xWeight * (1.0f - yWeight))		* tex2D( tex2, t + float2( xDir, 0.0f ) );b +=       (yWeight * (1.0f - xWeight))		* tex2D( tex2, t + float2( 0.0f, yDir ) );b +=       (xWeight * yWeight)			* tex2D( tex2, t + float2( xDir, yDir ) );

It's based on a couple of articles - one at (deceased [sad]) flipcode and one from wikipedia - that showed the correct weights to use. The rest of the implementation I cooked up on my own - so there could well be something better kicking around [grin]

I'm very happy with the results:
Previous Entry A quick tip...
Next Entry PIXfW
0 likes 2 comments

Comments

ildave1
@.@

Whoah, Talk about a stringy mess of confusion! >faints<
September 13, 2005 01:42 PM
jollyjeffers
[lol] Apologies for that..
September 13, 2005 01:49 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement