Hey all. I would like to use the HDR lib resource (found here). But when I run the demo in release mode, it leaks (or hoards) around 100MB a second. The first time I ran it I had to restart my machine. This behavior does not occur in debug mode, and in fact in runs and looks great in debug.
I did some poking around, but I can't seem to find the source of the problem. Anybody encounter this or have any ideas? Thanks![/url]
Bug in HDRlib?
-
- Greenskin
- Posts: 124
- Joined: Thu Feb 15, 2007 8:47 pm
-
- Greenskin
- Posts: 116
- Joined: Tue Feb 06, 2007 8:54 pm
- Location: Berlin, Germany
- x 25
I had the same problem, but I think I solved it. 
Has to be:
SetGlareType and SetStarType are both using a for-loop where the number of passes is needed. If they aren't initialized, it crashes.
PS: Is that true HDR oder fake HDR?

Code: Select all
m_HDRComp = new HDRCompositor(m_Window,m_Camera);
m_HDRComp->SetToneMapper(HDRCompositor::TONEMAPPER::TM_REINHARDSMOD);
m_HDRComp->SetGlareType(HDRCompositor::GLARETYPE::GT_BLUR);
m_HDRComp->SetStarType(HDRCompositor::STARTYPE::ST_CROSS);
m_HDRComp->SetAutoKeying(true);
m_HDRComp->SetKey(0.2);
m_HDRComp->SetLumAdapdation(true);
m_HDRComp->SetAdaptationScale(10);
m_HDRComp->SetStarPasses(2);
m_HDRComp->SetGlarePasses(2);
m_HDRComp->SetGlareStrength(0.5f);
m_HDRComp->SetStarStrength(0.5f);
m_HDRComp->Enable(true);
Code: Select all
m_HDRComp = new HDRCompositor(m_Window,m_Camera);
m_HDRComp->SetToneMapper(HDRCompositor::TONEMAPPER::TM_REINHARDSMOD);
m_HDRComp->SetStarPasses(2);
m_HDRComp->SetGlarePasses(2);
m_HDRComp->SetGlareType(HDRCompositor::GLARETYPE::GT_BLUR);
m_HDRComp->SetStarType(HDRCompositor::STARTYPE::ST_CROSS);
m_HDRComp->SetAutoKeying(true);
m_HDRComp->SetKey(0.2);
m_HDRComp->SetLumAdapdation(true);
m_HDRComp->SetAdaptationScale(10);
m_HDRComp->SetGlareStrength(0.5f);
m_HDRComp->SetStarStrength(0.5f);
m_HDRComp->Enable(true);
PS: Is that true HDR oder fake HDR?
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
-
- Halfling
- Posts: 81
- Joined: Sat Jan 29, 2005 5:47 pm
- Location: Paris, France.
Just a few errors i get when compiling the HDRDemo - Beach sample :
In HDRFrameListener.cpp
Should be (according to GCC) :
Idem in HDRApp.cpp :
should be replaced by
To avoid a warning (const float converted to int, number of passes being passed as a float), i also changed two prototypes in HDRCompositor.h :
---
Edit : oh, another little question : under Linux, i get a warning (no technique available for the compositor chain), and then the demo segfaults when the compositor instance is returned : i suppose there is a link. Is the instance invalid when the technique is not supported, and, if so, is there a way to handle it (disable the effect, but prevent the segfault) ?
In HDRFrameListener.cpp
Code: Select all
m_HDRComp->SetToneMapper(HDRCompositor::TONEMAPPER::TM_REINHARDSMOD);
m_HDRComp->SetStarPasses(2);
m_HDRComp->SetGlarePasses(2);
m_HDRComp->SetGlareType(HDRCompositor::GLARETYPE::GT_BLUR); m_HDRComp->SetStarType(HDRCompositor::STARTYPE::ST_CROSS);
Code: Select all
m_HDRComp->SetToneMapper(HDRCompositor::TM_REINHARDSMOD);
m_HDRComp->SetStarPasses(2);
m_HDRComp->SetGlarePasses(2);
m_HDRComp->SetGlareType(HDRCompositor::GT_BLUR);
m_HDRComp->SetStarType(HDRCompositor::ST_CROSS);
Code: Select all
for(int i = 0; i < HDRCompositor::TONEMAPPER::TM_COUNT; ++i)
Code: Select all
for(int i = 0; i < HDRCompositor::TM_COUNT; ++i)
Code: Select all
void SetGlarePasses(const int Passes)
void SetStarPasses(const int Passes)
Edit : oh, another little question : under Linux, i get a warning (no technique available for the compositor chain), and then the demo segfaults when the compositor instance is returned : i suppose there is a link. Is the instance invalid when the technique is not supported, and, if so, is there a way to handle it (disable the effect, but prevent the segfault) ?
-
- Gnoll
- Posts: 677
- Joined: Tue Sep 19, 2006 6:09 pm
- x 5
Hi,
i ask this here to avoid to open a new thread...
What kind of shaders should i use with this compositor?
I have a normal mapping shader that is like this:
every pass is vs11 and ps20, and it has a correct HDR output ranging from 0 to light_power set in Ogre::Light.
Unfortunately i get strange results with the compositor enabled (with demo settings)... black is overly black, and any lit surface is overly shiny. The rest goes from red to blue.
I think that the framebuffer is corrupted... what i should do to fix this?
Thanks, Tommaso
i ask this here to avoid to open a new thread...
What kind of shaders should i use with this compositor?
I have a normal mapping shader that is like this:
Code: Select all
//ambient pass
pass 1:
return ambient;
//light pass
pass 2:
scene_blend add
for each light
return light_color * light_intensity * light_power;
//texture pass
pass 3:
scene_blend modulate
return base_texture;
//specular pass
pass 4:
scene_blend add
for each light
return light_color * specular_intensity * light_power
Unfortunately i get strange results with the compositor enabled (with demo settings)... black is overly black, and any lit surface is overly shiny. The rest goes from red to blue.
I think that the framebuffer is corrupted... what i should do to fix this?
Thanks, Tommaso
-
- Gnoblar
- Posts: 10
- Joined: Mon Nov 13, 2006 2:31 am
Hi, this answer might be late and you hopefully already have solved you problem.
Fact is that everything rendered using a pixelshader version lesser than 2.0 generates these corruped framebuffer values you are talking about. I dont know exactly when but Ogre is sometimes doning some internal rendering e.g. when I used shadow volumes and some other sort of materials.
About the Bug: Thanks for reporting and helping each other. Next time someone could send me an email too, I added the address to the readme file.
I'm currently working to add Reinhards local tonemapping operator and I will upload the new demo very soon.
@True or fake HDR?
It is like Vectrex said, the Tonemapping is correct, but all the bloom/glare/star is fake, but it is like all the games do
. I also think of adding a better configurable star/glare type like in the DirectX SDK Sample.
In the paper of Krawczyk et al. (which implemented a nice local tonemapper) they use the scales generated for local mapping to build a glare which size and strength is depending on the pixels luminace. This sounds much less fake than the usual glare and it is something on my todo list for the library.
I also tested with a tonemapping plugin for HDRShop and compared the result with the one of the libray. With the new local tonemapper and an additional gamma correction, it produces quite the same result. (there is a short comment in "HDRFinalReinhLocal.psh").
When its done, the wiki entry could use an update too...
Greets, Lui
Edit: Currently there is some reoganization going on with the webspace where the demo is, so don't worry when the link isn't working right now.
Fact is that everything rendered using a pixelshader version lesser than 2.0 generates these corruped framebuffer values you are talking about. I dont know exactly when but Ogre is sometimes doning some internal rendering e.g. when I used shadow volumes and some other sort of materials.
About the Bug: Thanks for reporting and helping each other. Next time someone could send me an email too, I added the address to the readme file.
I'm currently working to add Reinhards local tonemapping operator and I will upload the new demo very soon.
@True or fake HDR?
It is like Vectrex said, the Tonemapping is correct, but all the bloom/glare/star is fake, but it is like all the games do

In the paper of Krawczyk et al. (which implemented a nice local tonemapper) they use the scales generated for local mapping to build a glare which size and strength is depending on the pixels luminace. This sounds much less fake than the usual glare and it is something on my todo list for the library.
I also tested with a tonemapping plugin for HDRShop and compared the result with the one of the libray. With the new local tonemapper and an additional gamma correction, it produces quite the same result. (there is a short comment in "HDRFinalReinhLocal.psh").
When its done, the wiki entry could use an update too...
Greets, Lui
Edit: Currently there is some reoganization going on with the webspace where the demo is, so don't worry when the link isn't working right now.
-
- Kobold
- Posts: 32
- Joined: Mon Nov 19, 2007 6:24 pm
- x 1
I have been looking at HDRLib and seems a great addon.
As the demo is distributed pre-compiled for windows I have tried with that platform. Once I have seen that does what I'm looking for I have tried to adapt on Linux.
But.. when Ogre warns about some shaders that he can't compile I have seen that is implemented using HLSL for DirectX.
It could be "easy" to port at Cg or GLSL on Linux?
Thanks!
As the demo is distributed pre-compiled for windows I have tried with that platform. Once I have seen that does what I'm looking for I have tried to adapt on Linux.
But.. when Ogre warns about some shaders that he can't compile I have seen that is implemented using HLSL for DirectX.
It could be "easy" to port at Cg or GLSL on Linux?
Thanks!