Author Topic: Displacement blending logic  (Read 1343 times)

2022-12-16, 13:56:28

JPeters

  • Active Users
  • **
  • Posts: 91
    • View Profile
For the life of me I can't figure out the logic in displacement blending in Corona (developer experimental tab).

One would expect that if two shaders on an object have displacement, that both displacement maps are blended over eachother to combine them into one, but this does not seem to be the case.
I've attached a small cutout from a render of mine, unfortunately due to NDA I can't provide a bigger slice.

The fabric on the left side has subtle displacement, a kind of mesh pattern and the logo on the right (white area) is purely displacement and a white color.

In this render I would expect the mesh displacement pattern to be visible on the white color as well but it's not present.
When I place the displaced logo shader under the fabric shader, the logo displacement is not visible.

It doesn't look like it's blending anything, what am I missing? C2023, Corona 9 

As a bonus, I've got a transform in the layer shader of the pattern inside the logo to match the size, but the transform seems to be completely ignored also.

2023-01-04, 09:37:13
Reply #1

JPeters

  • Active Users
  • **
  • Posts: 91
    • View Profile
Devs? Anyone?

Cheers,

2023-01-04, 10:03:56
Reply #2

Beanzvision

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 3881
  • Bengamin
    • View Profile
    • Cormats
''First only'' and ''Last only'' options are only there for backward compatibility (because it used to work as one of those in some old version), the default Blend option works similarly as e.g. stacking of diffuse channel (only with exception that materials with disabled displacement are ignored). The Blend option in the development/experimental tab only affects the behavior when using material layering via multiple texture tags.
Bengamin Jerrems:
Portfolio l Click me!

2023-01-04, 10:27:30
Reply #3

JPeters

  • Active Users
  • **
  • Posts: 91
    • View Profile
Hi Beanzvision,

Thanks for checking in, but my question is specifically why the blending *doesn't* seem to work.

In my attached picture, the subtle the displacement on the fabric texture is not blended at all into the displacement of the white area.
When I put the displacement of the white area *under* the fabric texture, the entire displacement of the logo disappears/is ignored.

With displacement blending I would expect the engine to blend the displacements as they are, that is to say say you have two materials:
- Mat1 with displacement of -0.1 / 0.1
- Mat 2 with displacement of -0.4 / 0.1

Blended displacement should then become -0.4 / 0.1 with both Mat1 and Mat2 displayed at their former strength.
However now there is always at least 1 displacement that seems to be toned down intensely or simply vanish.

Please note that in my example in the first post, these materials are layered via multiple texture tags. The fabric pattern is UVW projection based and the logo is a flat projection on a poly selection.
I want the displaced logo to remain the same "strength" and the displaced fabric as well when I stack materials. I don't want/expect the final displacement result to be 50% of each.

As it's impossible to combine both materials into 1 due to their different projection methods I'm stuck with having to layer them in multiple texture tags but then the displacement always seems to be a softer hybrid of both of their displacements rather then both being at their full original strength.

Or perhaps next to the "blend" option there should also be a "combine" option that makes sure that multiple displacement maps (when using multiple texture tags) do not lose any of their individual strength?

Cheers,
« Last Edit: 2023-01-04, 10:45:39 by JPeters »

2023-01-04, 11:01:56
Reply #4

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 9065
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Make sure that both displacement textures has roughly the same luminance strength, i.e. when you apply average filter in photoshop, they both should be equally bright, otherwise you may not get result that you're expecting. For example if texture A has luminance well above 0,5 and texture B well bellow 0,5 then blending them at 50%, texture A would still contribute the most values and you may think that there's no blending happening at all.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-01-05, 08:30:31
Reply #5

bnji

  • Corona Team
  • Active Users
  • ****
  • Posts: 276
  • Benjamin
    • View Profile
    • Corona Renderer
Hi JPeters,
You may want to try using a Corona Decal (enabling the Displacement channel in its material) instead of using multiple texture tags.
Alternatively, can you share that part of your scene project so we can investigate and better understand your setup?
Looking forward to hearing from you.
Benjamin Rosas | chaos-corona.com
3D Support Specialist - Corona | contact us

2023-01-05, 09:18:07
Reply #6

JPeters

  • Active Users
  • **
  • Posts: 91
    • View Profile
Hi guys,

Both are good suggestions and I will give them both a shot.

As for the Corona Decal, up until now I didn't have a convincing use case for it as the only thing I wanted from it wasn't working: When I apply a decal, I want to be able to draw a correct/accurate mask from it using "Material ID" but that didn't seem to work when I tried it. This also doesn't work for "flat" projection textures as the mask of the material ID will simply be all black.