Hello.
I am trying to use detail map as a car lvery/decal with a color behind it. The detail texture has transparent parts through which the color should be seen. I use diffuse as the background color, but the result I get is wrong.
So I looked through the Pbs shaders and found out that material's diffuse color acts as a multiplier, which also differs from behavior of a diffuse texture. My logic is that diffuse color should act as a 'fallback' when a texture is not present, and not as 'master volume' for diffuse.
I have tried to put the detail texture into diffuse at first, but the result was wrong too. I saw Matias mention that detail maps can be used as decals, but unfortunately it seems they can't.
So my question is: why does resulting diffuse color need to be multiplied by material's diffuse value? I am in no way an expert in light theory or PBR/PBS, so I apologise for being so lazy and not researching this stuff myself.
PS. I understand that I can blend my texture with the color manually and supply that as a diffuse texture, but do I really need to do that?
[2.1] Pbs detail map as decal
- GlowingPotato
- Goblin
- Posts: 211
- Joined: Wed May 08, 2013 2:58 pm
- x 10
Re: [2.1] Pbs detail map as decal
I was looking into a solution for this, we need a lot of decals for our game.
So, solution is to modify the PBS shader a little bit.
This color multiplication only happens when using transparent textures (ALPHA).
So, if you gonna do this, my advice is to also modify the shaders so you can pass a roughness textures for decals. Right now you can only pass a color map and normal map for decals.
I made a topic a while ago about this -> http://www.ogre3d.org/forums/viewtopic.php?f=25&t=88740
You can also use spookyBoo's HLMS editor to help.
So, solution is to modify the PBS shader a little bit.
This color multiplication only happens when using transparent textures (ALPHA).
So, if you gonna do this, my advice is to also modify the shaders so you can pass a roughness textures for decals. Right now you can only pass a color map and normal map for decals.
I made a topic a while ago about this -> http://www.ogre3d.org/forums/viewtopic.php?f=25&t=88740
You can also use spookyBoo's HLMS editor to help.
-
- Gnoblar
- Posts: 3
- Joined: Sun Aug 28, 2016 5:56 am
Re: [2.1] Pbs detail map as decal
Thank you for replying, GlowingPotato!
From what I have gathered, I see applications for having global diffuse multiplier (current behavior), for example: skin tones, but I also think there should be a "paint" color for the background. Would it be reasonable/useful to add another parameter to pbs materials for that? So that we can have the best of both worlds. If needed, I can submit a PR for that when details are clarified.
Yeah, I thought about doing this, but now that Ogre finally has some pretty graphics to offer I kinda wanted to stick to default ones. As long as possible.GlowingPotato wrote:So, solution is to modify the PBS shader a little bit.
Having looked at the PixelShader_ps.hlsl code I believe this is not true. The multiplication is applied to the diffuse with all the textures when there is a diffuse or detail texture present.GlowingPotato wrote:This color multiplication only happens when using transparent textures (ALPHA).
Do you mean having something like detail_roughness0..3? I haven't thought about that, but that would probably require changes in c++ code.GlowingPotato wrote:So, if you gonna do this, my advice is to also modify the shaders so you can pass a roughness textures for decals. Right now you can only pass a color map and normal map for decals.
From what I have gathered, I see applications for having global diffuse multiplier (current behavior), for example: skin tones, but I also think there should be a "paint" color for the background. Would it be reasonable/useful to add another parameter to pbs materials for that? So that we can have the best of both worlds. If needed, I can submit a PR for that when details are clarified.
- GlowingPotato
- Goblin
- Posts: 211
- Joined: Wed May 08, 2013 2:58 pm
- x 10
Re: [2.1] Pbs detail map as decal
You are correct, my bad.GlowingPotato wrote:Having looked at the PixelShader_ps.hlsl code I believe this is not true. The multiplication is applied to the diffuse with all the textures when there is a diffuse or detail texture present.
Yes, that's right. If you check the link I posted, the idea was to create a glass bottle and have a label on it. without a roughness map, the label would have the same roughness of the bottle, a little weird.GlowingPotato wrote:Do you mean having something like detail_roughness0..3? I haven't thought about that, but that would probably require changes in c++ code.
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [2.1] Pbs detail map as decal
Wow scorg! I've seen your PR.
I'm impressed by your level of understanding of the PBS Hlms implementation.
It's going to take me a little time to merge as I need to review it. There are a few things I may end up modifying. It seems PixelShader.glsl introduces a small regression with two_sided_lighting; and some code you've commented out could just be removed. I also would have to integrate it to the Metal shaders (fortunately they're very similar to HLSL, I'm looking forward in the future to see a way to share code between the too to reduce the level of unnecessary duplication)
I'm impressed by your level of understanding of the PBS Hlms implementation.
It's going to take me a little time to merge as I need to review it. There are a few things I may end up modifying. It seems PixelShader.glsl introduces a small regression with two_sided_lighting; and some code you've commented out could just be removed. I also would have to integrate it to the Metal shaders (fortunately they're very similar to HLSL, I'm looking forward in the future to see a way to share code between the too to reduce the level of unnecessary duplication)
-
- Gnoblar
- Posts: 4
- Joined: Thu Apr 14, 2016 4:11 am
Re: [2.1] Pbs detail map as decal
Good job.