Can HDR settings be per window or workspace? Topic is solved

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


jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Can HDR settings be per window or workspace?

Post by jwwalker »

I'm looking at whether I can use something like Sample_Hdr in my own project. I guess the first thing I'm not sure about is whether HDR can be adopted as is, or whether it should be considered demo level code that might need a lot of adaptation to use in a real-world project.

More specifically, I see that HdrUtils::setExposure doesn't contain any parameters to specify a Window or CompositorWorkspace or whatever, it seems to be making settings globally. What if I want to use different exposures in different windows?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5436
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1343

Re: Can HDR settings be per window or workspace?

Post by dark_sylinc »

Hi!

The easiest painless experience would be to adjust the exposure values on a CompositorWorkspaceListener::passPreExecute.

Downcast CompositorPass to CompositorPassQuad and call CompositorPassQuad::getPass(); then the rest of the code should be the same to set the VS/PS params.

You can use CompositorPassDef::mIdentifier to identify passes specifically. Ign-rendering has some reference code (so does ParallaxCorrectedCubemap::passPreExecute, ParallaxCorrectedCubemapAuto::passPreExecute and OpenVRCompositorListener::passPreExecute)

Cheers
jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Re: Can HDR settings be per window or workspace?

Post by jwwalker »

Thanks, I'll try that.

One other thing about HDR: The file Resolve_4xFP32_HDR_Box_ps_Metal fails to compile, because it defines a function named max3 that conflicts with a built-in function. But Sample_HDR seems to work anyway, and I can't see a difference if I fix the error.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5436
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1343

Re: Can HDR settings be per window or workspace?

Post by dark_sylinc »

jwwalker wrote: Thu Feb 03, 2022 7:19 pm Thanks, I'll try that.

One other thing about HDR: The file Resolve_4xFP32_HDR_Box_ps_Metal fails to compile, because it defines a function named max3 that conflicts with a built-in function. But Sample_HDR seems to work anyway, and I can't see a difference if I fix the error.
This is probably Metal updates.
In older versions it wasn't defined but in newer ones it is. What I don't get though, is why it works anyway.
jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Re: Can HDR settings be per window or workspace?

Post by jwwalker »

dark_sylinc wrote: Thu Feb 03, 2022 2:16 am You can use CompositorPassDef::mIdentifier to identify passes specifically. Ign-rendering has some reference code (so does ParallaxCorrectedCubemap::passPreExecute, ParallaxCorrectedCubemapAuto::passPreExecute and OpenVRCompositorListener::passPreExecute)
I'm not real clear on what you're suggesting there. In ParallaxCorrectedCubemap and ParallaxCorrectedCubemapAuto, the passes are created and mIdentifier is set as well as read. In my HDR case, passes have already been created with mIdentifier being zero for all of them.

What I can do is use getConstantDefinitionIterator to find out which pass has a constant named "exposure".
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5436
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1343

Re: Can HDR settings be per window or workspace?

Post by dark_sylinc »

jwwalker wrote: Thu Feb 03, 2022 11:07 pm I'm not real clear on what you're suggesting there. In ParallaxCorrectedCubemap and ParallaxCorrectedCubemapAuto, the passes are created and mIdentifier is set as well as read. In my HDR case, passes have already been created with mIdentifier being zero for all of them.
The HDR compositor script is part of our samples. As such you can edit them and adjust them to your needs when adapting it to your project.

In this case adding the necessary identifiers to the passes you need.

"identifier 1234" is the syntax in compositor scripts

Cheers
jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Re: Can HDR settings be per window or workspace?

Post by jwwalker »

Thanks for all your help!

One other thing I don't quite understand about HDR is the purpose of the "auto-exposure" settings, and how they interact with the exposure setting. But I suppose that at worst I can set a small minimum and large maximum and then ignore them.