Skip to main content
Participant
February 7, 2022
Question

Custom shader sRGB conversion and Normal+Height+Mesh map from shader

  • February 7, 2022
  • 1 reply
  • 666 views

1. Cusotm linear to sRGB conversion

In the documentation it states that:

 

You can override the automatic linear -> sRGB conversion in the viewport by putting this line in your custom shader:

#define DISABLE_FRAMEBUFFER_SRGB_CONVERSION

 

But using this flag inside my shader doesn't seem to work. Is this flag still supposed to work?

 

2. How is the Normal+Height+Mesh computed?

I know that I need to use the normalBlendOriented function to blend 2 normal maps and also normalFromHeight to get the height normal map.

 

I managed to get to a pretty close implementation but there is a problem if the normal channel is just partially defined (so checking is_set is not enough). I kind of solved this issue using mix and the length of the channel_normal to lerp between (texture_normal+height_normal) and channel_normal.

 

If there is the exact implementation somewhere it would be very helpful.

 

This topic has been closed for replies.

1 reply

Léna Piquet Froyok
Adobe Employee
Adobe Employee
February 8, 2022

1.

I can see it doesn't work on my side as well. With the introduction of the color management, it is possible that the define is not valid anymore. I will check if it's intentional or not and see that we update the documentation accorindgly ro raise a bug report from it.

If you plan on using a custom tonemapper, maybe OCIO would be better suited ?

 

2.

You can use the alpha of the channel to blend it against a default value and then blend that result with the other normal maps. You can chekc our shader documentation, our helper functions do that for each channel.

Participant
February 16, 2022

1. I don't know about the OCIO, but the idea was to have the custom tonemapper embedded in my main shader, and that flag would have been a neat solution.

 

2. Thanks for the info. I'm going to look at the documentation and try this out.

Léna Piquet Froyok
Adobe Employee
Adobe Employee
February 17, 2022

I confirm the shader define not working is a bug, I have logged the issue internally.