[2.1] HDR Sample
-
- Orc
- Posts: 406
- Joined: Sat Jun 23, 2007 5:16 pm
- x 118
[2.1] HDR Sample
Firstly, Great stuff. Also nice to see good old ambient back. Kudos!
So, I've just checked and I have this error when starting with GL3+ (DX11 works):
08:37:07: GLSL compile log: HDR/DownScale01_SumLumStart_ps_GLSL
0(32) : error C7549: OpenGL does not allow C style initializers
08:37:07: OGRE EXCEPTION(3:RenderingAPIException): Fragment Program HDR/DownScale01_SumLumStart_ps_GLSL failed to compile. See compile log above for details. in GLSLShader::compile at ..\..\..\RenderSystems\GL3Plus\src\GLSL\OgreGLSLShader.cpp (line 297)
Also found a tiny bug: you put F2,F2,F3 in Gui text, while keys are F2,F3,F4.
I would just go with F5,F6,F7 and leave the other keys (F2,F3,F4 for animation, show/hide models) just like in all other samples.
So, I've just checked and I have this error when starting with GL3+ (DX11 works):
08:37:07: GLSL compile log: HDR/DownScale01_SumLumStart_ps_GLSL
0(32) : error C7549: OpenGL does not allow C style initializers
08:37:07: OGRE EXCEPTION(3:RenderingAPIException): Fragment Program HDR/DownScale01_SumLumStart_ps_GLSL failed to compile. See compile log above for details. in GLSLShader::compile at ..\..\..\RenderSystems\GL3Plus\src\GLSL\OgreGLSLShader.cpp (line 297)
Also found a tiny bug: you put F2,F2,F3 in Gui text, while keys are F2,F3,F4.
I would just go with F5,F6,F7 and leave the other keys (F2,F3,F4 for animation, show/hide models) just like in all other samples.
Last edited by Crystal Hammer on Mon Jul 06, 2015 8:23 am, edited 2 times in total.
-
- Orc
- Posts: 406
- Joined: Sat Jun 23, 2007 5:16 pm
- x 118
Re: [2.1] HDR Sample
Hmm. I also changed constants in blur, to be not that rectangular (X stretched) but square, using this
in Samples\Media\2.0\scripts\materials\HDR\HLSL\BoxBlurH_ps.hlsl
and in Samples\Media\2.0\scripts\materials\HDR\HLSL\BoxBlurV_ps.hlsl
Not sure why it was so. I got Fps from 256 to 276 with it. And bloom now looks uniformly scaled (same in X,Y).
in Samples\Media\2.0\scripts\materials\HDR\HLSL\BoxBlurH_ps.hlsl
Code: Select all
#define NUM_SAMPLES 17
Code: Select all
#define NUM_SAMPLES 33
-
- Orc
- Posts: 406
- Joined: Sat Jun 23, 2007 5:16 pm
- x 118
Re: [2.1] HDR Sample
BTW. I also would like to ask something.
I noticed that the reflection on spheres (that from SaintPetersBasilica.dds) has no mip-maps used.
I mean I thought it should vary with roughness. I.e. use reflection from lower mip-maps when roughness is higher, right? Or is it technically difficult?
I noticed that the reflection on spheres (that from SaintPetersBasilica.dds) has no mip-maps used.
I mean I thought it should vary with roughness. I.e. use reflection from lower mip-maps when roughness is higher, right? Or is it technically difficult?
-
- OGRE Team Member
- Posts: 5492
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1364
Re: [2.1] HDR Sample
ThanksCrystal Hammer wrote:Firstly, Great stuff. Also nice to see good old ambient back. Kudos!
Blarhg!! @#!! <Yells at Khronos>.Crystal Hammer wrote: 08:37:07: GLSL compile log: HDR/DownScale01_SumLumStart_ps_GLSL
0(32) : error C7549: OpenGL does not allow C style initializers
08:37:07: OGRE EXCEPTION(3:RenderingAPIException): Fragment Program HDR/DownScale01_SumLumStart_ps_GLSL failed to compile. See compile log above for details. in GLSLShader::compile at ..\..\..\RenderSystems\GL3Plus\src\GLSL\OgreGLSLShader.cpp (line 297)
Fixed. Thanks for reporting it. (Try again just to confirm, I don't really have an NV card at hand)
Done.Crystal Hammer wrote:Also found a tiny bug: you put F2,F2,F3 in Gui text, while keys are F2,F3,F4.
I would just go with F5,F6,F7 and leave the other keys (F2,F3,F4 for animation, show/hide models) just like in all other samples.
This is on purpose. It's called anamorphic lens / anamorphic lens flare. Lots of people love it, including myself.Crystal Hammer wrote:I also changed constants in blur, to be not that rectangular (X stretched) but square, using this
in Samples\Media\2.0\scripts\materials\HDR\HLSL\BoxBlurH_ps.hlsland in Samples\Media\2.0\scripts\materials\HDR\HLSL\BoxBlurV_ps.hlslCode: Select all
#define NUM_SAMPLES 17
Not sure why it was so. I got Fps from 256 to 276 with it. And bloom now looks uniformly scaled (same in X,Y).Code: Select all
#define NUM_SAMPLES 33
If you don't like it, changing NUM_SAMPLES in both BoxBlurH_ps & BoxBlurV_ps to match the same value will make it uniform. Which is what you did

Of course less samples = higher performance.
Mmm... I do not witness that. In my machine (AMD Radeon HD 7770 & Intel HD 4400) the sphere's reflection correctly uses the mipmapping based on roughness. On both GL3+ & D3D11.BTW. I also would like to ask something.
I noticed that the reflection on spheres (that from SaintPetersBasilica.dds) has no mip-maps used.
I mean I thought it should vary with roughness. I.e. use reflection from lower mip-maps when roughness is higher, right? Or is it technically difficult?
If it doesn't on your machine, could you upload some pictures showing the problem? (and some description about your system: OS, GPU, Ogre log, etc)
Thanks.
-
- Gnoblar
- Posts: 2
- Joined: Tue Jul 07, 2015 5:37 am
Re: [2.1] HDR Sample
I found these issues exist for other sample shaders (2.0/PostProcessing) as well. Including swizzle access for scalars.
After looking at: https://www.opengl.org/wiki/Data_Type_(GLSL)
to determine I had a new enough version.
See also:
https://www.opengl.org/wiki/Data_Type_( ... izer_lists
After looking at the glsl code I discovered that the sample shaders require version 330 instead of 420+.
DownScale01_SumLumStart_ps.glsl
Instead change line 1 to be:
and you can use the newer style syntax.
Hope this helps.
After looking at: https://www.opengl.org/wiki/Data_Type_(GLSL)
I ran:In OpenGL 4.2 or shading_language_420pack_extref, scalars can be swizzled as well.
Code: Select all
$ glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL core profile version string: 4.3.0 NVIDIA 331.38
OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL version string: 4.4.0 NVIDIA 331.38
OpenGL shading language version string: 4.40 NVIDIA via Cg compiler
See also:
https://www.opengl.org/wiki/Data_Type_( ... izer_lists
After looking at the glsl code I discovered that the sample shaders require version 330 instead of 420+.
DownScale01_SumLumStart_ps.glsl
Code: Select all
#version 330
out float fragColour;
in block
{
...
Code: Select all
#version 420
out float fragColour;
in block
{
...
Hope this helps.
-
- Orc
- Posts: 406
- Joined: Sat Jun 23, 2007 5:16 pm
- x 118
Re: [2.1] HDR Sample
OK I updated and then got this shader issue:
11:01:11: GLSL compile log: HDR/FinalToneMapping_ps_GLSL
0(48) : error C7505: OpenGL does not allow swizzles on scalar expressions
11:01:11: OGRE EXCEPTION(3:RenderingAPIException): Fragment Program HDR/FinalToneMapping_ps_GLSL failed to compile. See compile log above for details. in GLSLShader::compile at ..\..\..\RenderSystems\GL3Plus\src\GLSL\OgreGLSLShader.cpp (line 297)
I fixed it by replacing
to
In each file (line):
FinalToneMapping_ps.glsl (48)
BrightPass_Start_ps.glsl (26)
DownScale03_SumLumEnd_ps.glsl (33)
in Samples\Media\2.0\scripts\materials\HDR\GLSL\
Apropo reflection using mipmapping: OK false alarm, it works. I was just using wrong roughness range to 0.5 and didn't notice it.
I like the new presets in HDR sample.
11:01:11: GLSL compile log: HDR/FinalToneMapping_ps_GLSL
0(48) : error C7505: OpenGL does not allow swizzles on scalar expressions
11:01:11: OGRE EXCEPTION(3:RenderingAPIException): Fragment Program HDR/FinalToneMapping_ps_GLSL failed to compile. See compile log above for details. in GLSLShader::compile at ..\..\..\RenderSystems\GL3Plus\src\GLSL\OgreGLSLShader.cpp (line 297)
I fixed it by replacing
Code: Select all
float( 0.0 ).xx
Code: Select all
vec2( 0.0, 0.0 )
FinalToneMapping_ps.glsl (48)
BrightPass_Start_ps.glsl (26)
DownScale03_SumLumEnd_ps.glsl (33)
in Samples\Media\2.0\scripts\materials\HDR\GLSL\
Apropo reflection using mipmapping: OK false alarm, it works. I was just using wrong roughness range to 0.5 and didn't notice it.
I like the new presets in HDR sample.
-
- OGRE Team Member
- Posts: 5492
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1364
Re: [2.1] HDR Sample
Thanks for all these reports! I hope I've fixed them all in the last commit.
Certainly OpenGL only became good in version 4.3.
Since we support GL3 hardware (DX10 level cards) I opted for maintaining #version 330 and fixing the invalid syntax.
The Hlms does already require GL_ARB_shading_language_420pack support though (which is a driver thing, not a HW thing) but I thought it would only clutter the files when fixing the invalid syntax isn't hard.
Let me know if now it works for you!
Cheers & Thanks!
Matias
Certainly OpenGL only became good in version 4.3.
Since we support GL3 hardware (DX10 level cards) I opted for maintaining #version 330 and fixing the invalid syntax.
The Hlms does already require GL_ARB_shading_language_420pack support though (which is a driver thing, not a HW thing) but I thought it would only clutter the files when fixing the invalid syntax isn't hard.
Let me know if now it works for you!
Cheers & Thanks!
Matias
-
- Gnoblar
- Posts: 2
- Joined: Tue Jul 07, 2015 5:37 am
Re: [2.1] HDR Sample
I agree that one should support as old a version as possible when you can.dark_sylinc wrote:Since we support GL3 hardware (DX10 level cards) I opted for maintaining #version 330 and fixing the invalid syntax.
The Hlms does already require GL_ARB_shading_language_420pack support though (which is a driver thing, not a HW thing) but I thought it would only clutter the files when fixing the invalid syntax isn't hard.
However I posted my above solution as a "quick-and-dirty" workaround for those who want to get the Samples shipped with Ogre up and running quickly with minimal changes should they have similar issues.
-
- OGRE Expert User
- Posts: 1227
- Joined: Thu Dec 11, 2008 7:56 pm
- Location: Bristol, UK
- x 157
Re: [2.1] HDR Sample
Loving the new HDR sample, especially the notes about reference light power and exposure values in the code.
Great job
Great job

-
- Orc
- Posts: 406
- Joined: Sat Jun 23, 2007 5:16 pm
- x 118
Re: [2.1] HDR Sample
It works.
But I confirm that the Samples: Postprocessing and ShadowMapDebugging crash from the same shader syntax errors.
Using GL3+ on Nvidia GeForce GTX 560 Ti.
But I confirm that the Samples: Postprocessing and ShadowMapDebugging crash from the same shader syntax errors.
Using GL3+ on Nvidia GeForce GTX 560 Ti.
-
- OGRE Team Member
- Posts: 5492
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1364
Re: [2.1] HDR Sample
Whoa! Could you post the Ogre.log? Thanks.But I confirm that the Samples: Postprocessing and ShadowMapDebugging crash from the same shader syntax errors.
Using GL3+ on Nvidia GeForce GTX 560 Ti.
-
- Orc
- Posts: 406
- Joined: Sat Jun 23, 2007 5:16 pm
- x 118
Re: [2.1] HDR Sample
Well PostProcessing starts but throws exception when you enable any effect, with shader error.
ShadowMapDebugging crashes after showing scene, nothing in log I'll try to debug.
Here are logs. (I also always wanted to see other people's Ogre.log
)
ShadowMapDebugging crashes after showing scene, nothing in log I'll try to debug.
Here are logs. (I also always wanted to see other people's Ogre.log

You do not have the required permissions to view the files attached to this post.
Last edited by Crystal Hammer on Wed Jul 08, 2015 7:26 pm, edited 1 time in total.
-
- Orc
- Posts: 406
- Joined: Sat Jun 23, 2007 5:16 pm
- x 118
Re: [2.1] HDR Sample
Hmm. Debugging..
It is this assert here (for ShadowDebug sample):
in OgreHmlsPbs.cpp (line 969, Ogre::HlmsPbs::preparePassHash).
It happens at application start (can be ignored but 2nd time it crashes if ignored).
Actual crash happens later in void GL3PlusRenderSystem::_render (access violation reading location 00000000)
where for me all looks fine (cmd isn't null).
It is this assert here (for ShadowDebug sample):
Code: Select all
assert( (size_t)(passBufferPtr - startupPtr) * 4u == mapSize );
It happens at application start (can be ignored but 2nd time it crashes if ignored).
Actual crash happens later in void GL3PlusRenderSystem::_render (access violation reading location 00000000)
where for me all looks fine (cmd isn't null).
Last edited by Crystal Hammer on Wed Jul 08, 2015 7:32 pm, edited 1 time in total.
-
- OGRE Team Member
- Posts: 5492
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1364
Re: [2.1] HDR Sample
Thanks.
The assert was discovered by me literally 10 minutes ago. It's been fixed.
I also fixed the postprocessing bugs (hopefully all of them!)
Let me know if it works now
The assert was discovered by me literally 10 minutes ago. It's been fixed.
I also fixed the postprocessing bugs (hopefully all of them!)
Let me know if it works now

-
- Orc
- Posts: 406
- Joined: Sat Jun 23, 2007 5:16 pm
- x 118
Re: [2.1] HDR Sample
Nope, still crashes, but now doesn't show any asserts (kind of more rude now
).
here are the values in that place of crash:
IDK if that helps, let me know if I should try anything more.

here are the values in that place of crash:
Code: Select all
OCGE( glDrawArraysInstancedBaseInstance(
mCurrentPolygonMode 5
cmd->firstVertexIndex 0
cmd->primCount 4
cmd->instanceCount 1
cmd->baseInstance 0
and commandType 29