Bug in HDRlib?

Problems building or running the engine, queries about how to use features etc.
Supreme Commander Thor
Gnoblar
Posts: 2
Joined: Thu Nov 10, 2005 6:22 am

Bug in HDRlib?

Post by Supreme Commander Thor »

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]
User avatar
Nargil
Greenskin
Posts: 124
Joined: Thu Feb 15, 2007 8:47 pm

Post by Nargil »

I've got the same problem here. Topic up :P
Caphalor
Greenskin
Posts: 116
Joined: Tue Feb 06, 2007 8:54 pm
Location: Berlin, Germany
x 25

Post by Caphalor »

I had the same problem, but I think I solved it. :)

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);
Has to be:

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);
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?
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1

Post by Vectrex »

It's true hdr with a fake post process bloom to simulate bleeding.
The original auther should fix this because if it wasn't for this post I'd never have used it, it's really nice. I put a not on the wiki about the bug
Ceacy
Halfling
Posts: 81
Joined: Sat Jan 29, 2005 5:47 pm
Location: Paris, France.

Post by Ceacy »

Just a few errors i get when compiling the HDRDemo - Beach sample :
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);
Should be (according to GCC) :

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);
Idem in HDRApp.cpp :

Code: Select all

for(int i = 0; i < HDRCompositor::TONEMAPPER::TM_COUNT; ++i)
should be replaced by

Code: Select all

for(int i = 0; i < HDRCompositor::TM_COUNT; ++i)
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 :

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) ?
User avatar
_tommo_
Gnoll
Posts: 677
Joined: Tue Sep 19, 2006 6:09 pm
x 5

Post by _tommo_ »

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:

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

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
Lui
Gnoblar
Posts: 10
Joined: Mon Nov 13, 2006 2:31 am

Post by Lui »

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.
Paladi
Kobold
Posts: 32
Joined: Mon Nov 19, 2007 6:24 pm
x 1

Post by Paladi »

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!