[2.1] HDR sample

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 240
Joined: Wed Apr 23, 2014 3:49 pm
x 44

[2.1] HDR sample

Post by TaaTT4 »

Hi,

I have two questions about the HDR sample.

For what I know (and I have understood), after the bright pass the texture has to be blurred.
This is done, by ping-ponging the texture between the rtBlur0 and the rtBlur1, applying alternately an horizontal and a vertical blur pass.
But the last four render_quad passes always apply an horizontal blur.
Is it intended or is a cut and paste error?

Why the NUM_SAMPLES define is different between the horizontal blur shader and the vertical one?


Thanks,
Raffaele.
Senior game programmer at Vae Victis
Working on Racecraft

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1135
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 164

Re: [2.1] HDR sample

Post by xrgo »

its just the style, because matias likes asymetric bloom/lens flare jj ambras style lol
its a nice effect but if you need symetic/round bloom (like I did) you have to:
-removed those extra renderquads
-equal the NUM_SAMPLES for both shaders
-change this:

Code: Select all

fragment_program HDR/BoxBlurV_ps unified
{
	delegate HDR/BoxBlurV_ps_GLSL
	delegate HDR/BoxBlurV_ps_HLSL
	
	default_params
	{
		param_named_auto	invTex0Size				inverse_texture_size 0
	}
}
to this:

Code: Select all

fragment_program HDR/BoxBlurV_ps unified
{
	delegate HDR/BoxBlurV_ps_GLSL
	delegate HDR/BoxBlurV_ps_HLSL
	
	default_params
	{
		param_named_auto	invTex0Size				inverse_texture_size 1
	}
}
-and this:

Code: Select all

	texture rtBlur0	256 256 PF_A2R10G10B10	depth_pool 0
	texture rtBlur1	256 256 PF_A2R10G10B10	depth_pool 0
to this:

Code: Select all

	texture rtBlur0	target_width_scaled 0.25 target_height_scaled 0.25 PF_A2R10G10B10	depth_pool 0
	texture rtBlur1	target_width_scaled 0.25 target_height_scaled 0.25 PF_A2R10G10B10	depth_pool 0
(or whatever scale you want)

this way you'll have a perfect symetric bloom no matter the resolution... or simply cook NUM_SAMPLES so it looks like you want, but it will not behave correctly at some resolutions/ratios

User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 240
Joined: Wed Apr 23, 2014 3:49 pm
x 44

Re: [2.1] HDR sample

Post by TaaTT4 »

Code: Select all

fragment_program HDR/BoxBlurV_ps unified
{
   delegate HDR/BoxBlurV_ps_GLSL
   delegate HDR/BoxBlurV_ps_HLSL
   
   default_params
   {
      param_named_auto   invTex0Size            inverse_texture_size 1
   }
}
Why do you use 1 as texture unit index?
The material which use the HDR/BoxBlurV_ps shader does not have just a single texture unit?
Senior game programmer at Vae Victis
Working on Racecraft

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1135
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 164

Re: [2.1] HDR sample

Post by xrgo »

TaaTT4 wrote:

Code: Select all

fragment_program HDR/BoxBlurV_ps unified
{
   delegate HDR/BoxBlurV_ps_GLSL
   delegate HDR/BoxBlurV_ps_HLSL
   
   default_params
   {
      param_named_auto   invTex0Size            inverse_texture_size 1
   }
}
Why do you use 1 as texture unit index?
The material which use the HDR/BoxBlurV_ps shader does not have just a single texture unit?
Oh yes, you're right I did put a texture unit, although I think somehow it was working before, I just thought it was wrong and put one from the beginning, didn't test much

Post Reply