[2.1] HDR Sample

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


User avatar
Crystal Hammer
Orc
Posts: 406
Joined: Sat Jun 23, 2007 5:16 pm
x 118

[2.1] HDR Sample

Post by Crystal Hammer »

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.
Last edited by Crystal Hammer on Mon Jul 06, 2015 8:23 am, edited 2 times in total.
User avatar
Crystal Hammer
Orc
Posts: 406
Joined: Sat Jun 23, 2007 5:16 pm
x 118

Re: [2.1] HDR Sample

Post by Crystal Hammer »

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

Code: Select all

#define NUM_SAMPLES 17
and in Samples\Media\2.0\scripts\materials\HDR\HLSL\BoxBlurV_ps.hlsl

Code: Select all

#define NUM_SAMPLES 33
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).
User avatar
Crystal Hammer
Orc
Posts: 406
Joined: Sat Jun 23, 2007 5:16 pm
x 118

Re: [2.1] HDR Sample

Post by Crystal Hammer »

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?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5492
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1364

Re: [2.1] HDR Sample

Post by dark_sylinc »

Crystal Hammer wrote:Firstly, Great stuff. Also nice to see good old ambient back. Kudos!
Thanks
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)
Blarhg!! @#!! <Yells at Khronos>.
Fixed. Thanks for reporting it. (Try again just to confirm, I don't really have an NV card at hand)
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.
Done.
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.hlsl

Code: Select all

#define NUM_SAMPLES 17
and in Samples\Media\2.0\scripts\materials\HDR\HLSL\BoxBlurV_ps.hlsl

Code: Select all

#define NUM_SAMPLES 33
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).
This is on purpose. It's called anamorphic lens / anamorphic lens flare. Lots of people love it, including myself.
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.
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?
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.
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.
User avatar
gnemonix
Gnoblar
Posts: 2
Joined: Tue Jul 07, 2015 5:37 am

Re: [2.1] HDR Sample

Post by gnemonix »

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)
In OpenGL 4.2 or shading_language_420pack_extref, scalars can be swizzled as well.
I ran:

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
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

Code: Select all

#version 330

out float fragColour;

in block
{
...
Instead change line 1 to be:

Code: Select all

#version 420

out float fragColour;

in block
{
...
and you can use the newer style syntax.

Hope this helps.
User avatar
Crystal Hammer
Orc
Posts: 406
Joined: Sat Jun 23, 2007 5:16 pm
x 118

Re: [2.1] HDR Sample

Post by Crystal Hammer »

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

Code: Select all

float( 0.0 ).xx
to

Code: Select all

vec2( 0.0, 0.0 )
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.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5492
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1364

Re: [2.1] HDR Sample

Post by dark_sylinc »

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
User avatar
gnemonix
Gnoblar
Posts: 2
Joined: Tue Jul 07, 2015 5:37 am

Re: [2.1] HDR Sample

Post by gnemonix »

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.
I agree that one should support as old a version as possible when you can.

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.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: [2.1] HDR Sample

Post by al2950 »

Loving the new HDR sample, especially the notes about reference light power and exposure values in the code.

Great job :D
User avatar
Crystal Hammer
Orc
Posts: 406
Joined: Sat Jun 23, 2007 5:16 pm
x 118

Re: [2.1] HDR Sample

Post by Crystal Hammer »

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.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5492
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1364

Re: [2.1] HDR Sample

Post by dark_sylinc »

But I confirm that the Samples: Postprocessing and ShadowMapDebugging crash from the same shader syntax errors.
Using GL3+ on Nvidia GeForce GTX 560 Ti.
Whoa! Could you post the Ogre.log? Thanks.
User avatar
Crystal Hammer
Orc
Posts: 406
Joined: Sat Jun 23, 2007 5:16 pm
x 118

Re: [2.1] HDR Sample

Post by Crystal Hammer »

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 :) )
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.
User avatar
Crystal Hammer
Orc
Posts: 406
Joined: Sat Jun 23, 2007 5:16 pm
x 118

Re: [2.1] HDR Sample

Post by Crystal Hammer »

Hmm. Debugging..
It is this assert here (for ShadowDebug sample):

Code: Select all

        assert( (size_t)(passBufferPtr - startupPtr) * 4u == mapSize );
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).
Last edited by Crystal Hammer on Wed Jul 08, 2015 7:32 pm, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5492
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1364

Re: [2.1] HDR Sample

Post by dark_sylinc »

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 :)
User avatar
Crystal Hammer
Orc
Posts: 406
Joined: Sat Jun 23, 2007 5:16 pm
x 118

Re: [2.1] HDR Sample

Post by Crystal Hammer »

Nope, still crashes, but now doesn't show any asserts (kind of more rude now :) ).
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
IDK if that helps, let me know if I should try anything more.