• entries
422
1540
• views
491000

# Image Quality

237 views

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:

@.@

Whoah, Talk about a stringy mess of confusion! >faints<

[lol] Apologies for that..

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.