How is setMetalness supposed to work?

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

How is setMetalness supposed to work?

Post by jwwalker »

My experience from the Filament rendering software is that designating a material as "metal" basically means that it does not reflect diffuse light, except for ambient light. But in Ogre, when I say

Code: Select all

pbsdatablock->setWorkflow( Ogre::HlmsPbsDatablock::MetallicWorkflow );
pbsdatablock->setMetalness( 1.0 );
I'm seeing only specular reflection, regardless of ambient light, so the metal looks too dark. What am I missing?
jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Re: How is setMetalness supposed to work?

Post by jwwalker »

My metal looks somewhat better if I set a medium-gray cube map as a PBSM_REFLECTION texture. But that's not ideal because it's not affected by the amount of light.
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Re: How is setMetalness supposed to work?

Post by old_man_auz »

Incase this is helpful:
  • Make sure that the `brdf` and `workflow` parameters in the PBS datablock are set to values that are valid for a `metallic` workflow.
  • The V2 mesh viewer here https://github.com/chchwy/ogre-v2-mesh-viewer lets you play with metalness values a little to adjust a look.
jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Re: How is setMetalness supposed to work?

Post by jwwalker »

I did say

Code: Select all

setWorkflow( Ogre::HlmsPbsDatablock::MetallicWorkflow );
, but I left brdf at the default setting. The documentation of the various BRDF settings don't mention anything about some of them being compatible or not with metal.
jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Re: How is setMetalness supposed to work?

Post by jwwalker »

By the way, the documentation on setWorkflow talks about textures, starting:
The texture types PBSM_SPECULAR & PBSM_METALLIC map to the same value.
When in metal workflow, the texture is used as a metallic texture, and is expected to be a monochrome texture.
It should be OK to use a metallic material that is not textured, right?
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: How is setMetalness supposed to work?

Post by dark_sylinc »

jwwalker wrote: Sat Nov 20, 2021 6:14 pm It should be OK to use a metallic material that is not textured, right?
Yes.

The documentation just says that if you're using a texture, whatever was bound to "PBSM_SPECULAR" becomes "PBSM_METALLIC" (since they're literally the same value in the enum) and if there is something bound, we expect it to be monochrome (unlike specular which can be either coloured or mono and makes sense in that workflow)
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Re: How is setMetalness supposed to work?

Post by old_man_auz »

jwwalker wrote: Sat Nov 20, 2021 6:08 pm I did say

Code: Select all

setWorkflow( Ogre::HlmsPbsDatablock::MetallicWorkflow );
, but I left brdf at the default setting. The documentation of the various BRDF settings don't mention anything about some of them being compatible or not with metal.
Sorry, It was late and I didn't read your post properly.