Author Topic: LWF - Once more with love  (Read 5054 times)

2018-10-13, 15:53:48

Ben

  • Active Users
  • **
  • Posts: 11
    • View Profile
Hello everybody, I finally decided to join you folks in this amazing forum. Through all these posts, studies, explanations etc. I learned a lot during the past year and first of all I wanted to thank the corona team and everybody else on the forums for their work. Never had that much fun with rendering like I am having with corona (and I am glad that it is still freely accessible for cinema, as I am counting myself to the more hobbyist group of users).

But enough of the flattery. The hard part is that my first question is concerning the good old subject of LWF and color management. Yes, again, another fool trying to understand this whole subject with limited success. I really tried and read a lot, but still some questions remain. I think I understood the basics behind everything, that corona is computing in linear space, but that we need the gamma correction to visualize the colors on screen etc., but there are so many articles and statements about how to use the LWF correctly, reaching back over years, mainly concerning 3ds (which seems to work differently than cinema in setup) that I have to get rid of some confusion resulting from all this mixed up information.

So, what I did was creating two monochrome photoshop images. The first one is a simple square in mid-grey, with a linear RGB value of 0,5 in 32 bit with a 1.0-gamma-profile, saving it as openEXR. From my understanding this should be a perfect mid-grey linear bitmap.

For the second image I converted the first one to sRGB, visually resulting in the same mid-grey square with an RGB value of 188/188/188 and a brightness of 74%, saved as 16 bit in tif-format.

Both were saved with their color profile embedded.

I then created a small test scene in cinema, where I would render a square with these two bitmaps using only the diffuse channel. I used the corona bitmap loader and left the input on „embedded“.

The resulting two images (saved as 32 bit openEXR) were then again opened in photoshop to color pick the resulting pixels. Altogether everything went as expected, the 32bit EXR is identical to the starting image. The second EXR (of course now also 32bit) is slightly off having linear RGB values of 0,5083 respectively sRGB value of 130/130/130 and a brightness of 51%.

Now my questions:

Do these steps describe a correct linear workflow? Since this is my understanding of LWF I just want to make sure …
The slight deviation comes from an interpolation between the 256 from sRGB and the wider spectrum in linear RGB, correct?
Now that both ways appear to have a more or less identical result, do I have to bother with LWF at all? Is this outdated since all sRGB-images are corrected internally to gamma 1.0 by corona?

I guess my problem is (assuming that I understood what LWF means in general) that I don’t know how this effects my images, as the results look the same, at least in this small experiment.

I read about Bertrand Benoit using 180 RGB for his white wall paint in his „classical“ images. In his secret little hideout Dubcat explained this September that Bertrand meant 180 linear RGB with a reflectance (brightness?) of 70.6% because 180 sRGB would have a reflectance of only 46.5% and therefore would be too dark. This I simply don't understand: When I create a square in Photoshop in color space sRGB and fill it with 180 grey, the brightness value is 70.6%, if I do this in linear RGB the values are the same, but of course the color changes. This confused me a lot and brought me to my longterm goal, to finally understand LWF.

Sorry for the long post, I know this has been discussed to the limit, but to be honest I am frustrated about my own confusion and I feel this has to be understood before continuing with things like PBR. Thank you in advance.
Cinema 4D Studio R17
Corona Renderer 6 rc 2

2018-10-25, 19:34:28
Reply #1

Ales

  • Corona Team
  • Active Users
  • ****
  • Posts: 185
    • View Profile
Hi Ben,
as you wrote, color space of input images shouldn't really matter as long as you setup your bitmap shader correctly - either you leave color space as embedded (if your image was saved with correct info) or manually select correct one. As of those slight deviations, those can be caused by number of factors, but most probably either by rounding errors or by different algorithms each application use for color conversions.

Where it does matter are places where you set colors and values directly in C4D. By default C4D is configured to use sRGB for input colors, so for example when you set value of 180 to diffuse, it will interpret that as sRGB and Corona will internally convert it to linear colorspace (which is equivalent to value 118.5, so amount of reflected diffuse light would be 46.5%, which would still however be percieved as roughly 70% by human eye). Note that you can change what C4D use as input color space in project settings (more info here).

One more thing to note is that channels in Corona materials that do not take color directly (e.g. glossiness or IOR) are always interpreted as linear, i.e. value of 0.5 in glossiness will be interpreted as 0.5 without any gamma correction. This also extends to shaders you use for these slots, e.g. if you set color shader into Corona material's glossiness with brighness 50%, it will be interpreted as 0.5 regardless of your input color space setting.

Hope this helps.

2018-11-01, 23:14:34
Reply #2

lollolo

  • Active Users
  • **
  • Posts: 223
    • View Profile
I'm also trying to understand LFW. So I read a a few things about it but I have still not a clear idea what it really means.

https://coronarenderer.freshdesk.com/support/solutions/articles/12000020988-understanding-srgb-gamma-color-values
https://help.c4d.corona-renderer.com/support/solutions/articles/12000010221

These two articles helped me a lot but I didn't understand it completely so I did a quick test.
I created in Affinity Photo a black - white gradient which I used as a texture inside of the displacement channel.
The gray plane is to check the result
The green one is with displacement and activated option "linear" as color space profile (inside of the bitmap-shader)
The red one is also with displacement and on "embedded". (same result with sRGB)

As you can see, I got only with the linear profile a correct result. Do I have to change the settings for all black/white textures (gloss, bump, displacement) to linear? Or only in my case here? Or how can I see which option is right?
Thanks for your help!

2018-11-02, 11:09:53
Reply #3

houska

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 1512
  • Cestmir Houska
    • View Profile
As you can see, I got only with the linear profile a correct result.
When you create a black and white gradient, the raw values are linearly interpolated between 0 and 255. Now there are two ways how to interpret these values - as linear (you can also imagine this as "raw" or "physical" values) or as sRGB (which you can imagine as "color" or "perceptual" values). If you tell C4D that it should use the raw values as displacement, everything works fine, as you experienced. If you however interpret the gradient as a color gradient in sRGB, the conversion to linear or "raw" values will make it curved, which is not what you want. Basically, the sRGB color profile tells C4D "hey, the values in this image were created with human color perception in mind, so even though the gradient is linear, you need to apply some correction in order to get the correct physical values". However, this correction makes sense only for colors. For simple value channels (like displacement) the values from the image should be taken uncorrected.

Do I have to change the settings for all black/white textures (gloss, bump, displacement) to linear? Or only in my case here? Or how can I see which option is right?
Yes, basically all value channels should take the "raw" linear data, so you should change the settings to linear.

2018-11-02, 11:11:03
Reply #4

houska

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 1512
  • Cestmir Houska
    • View Profile
And, by the way, LWF has little to do with this. LWF only means that C4D uses the linear "raw" values internally, which is what Corona needs to work properly and to be physically correct.

2018-11-02, 13:30:34
Reply #5

lollolo

  • Active Users
  • **
  • Posts: 223
    • View Profile
Ahh, thank you!

2019-02-11, 06:33:46
Reply #6

bgolds99

  • Active Users
  • **
  • Posts: 21
    • View Profile
Just following up on this guys....

I've been running some tests recently and the ONLY way that i can get C4d & corona to behave the same as Max & Corona is to use the linear input color profile. I've used this setup for my last couple of projects, and I'm finding I'm getting more natural looking results, and the renders are quite a bit faster. The only downfall I can see to this is that any selected colours need a 0.4545 gamma adjustment, and selecting black colours can be tedious as they are squashed between 0-5.

Am i missing something?

Cheers,
Brad

2023-09-12, 11:37:30
Reply #7

mlon

  • Active Users
  • **
  • Posts: 36
    • View Profile
Sorry to dig up an old thread but i am having the same difficulties and tedious workflow trying
to set some textures to linear and others not (srgb).  Not touching solid colors (srgb).
I am finding corona assets also set to the wrong profiles at random.
Sometimes they are set embedded at linear and again others in srgb or just srgb but render too dark.

Also when I change to profiles to linear the material previews are too brightly displayed.

Is there a better solution to this i am missing?
Or are there scripts that checks profiles and if wrong set them to linear or vice versa for use in Corona?

This way as it is now it is really difficult to get MAX like renders in Corona and takes up allot of time.
Some help would be appreciated.

mlon
« Last Edit: 2023-09-12, 14:18:37 by mlon »

2023-09-13, 13:32:01
Reply #8

burnin

  • Active Users
  • **
  • Posts: 1535
    • View Profile
Here's bit older tut on "Linear Workflow for Gamma Correct Lighting in Cinema 4D". (still relevant). So it's all in the balance. You can observe same behavior in 3DS Max, and somewhat in photography/film.

An advice and a tip:
Some sort of practical example, a comparative study, would help you (and others) ...Also check out: The Corona Physical Material in 3ds Max @YouTube (Download 3D scene here).

BTW.
You can modify any texture/image map to your taste (either via "Filter" or "Color Correct" 'shaders'. But it all depends on file format and intent of use (albedo, diffuse, bump, displace...)  and thus correct Gamma (Articles @polycount)

PS
If you intend to practice and get help or critique, make another thread in proper section.

2023-09-14, 11:18:50
Reply #9

mlon

  • Active Users
  • **
  • Posts: 36
    • View Profile
Hey burnin,

thanks for your reply.
yes, i am familiar with linear workflow for years since also c4d uses it.
The issues are with Corona and it's quirks inside c4d also
described by lollolo and bgolds99.

Double checking each texture in what colorspace it is takes allot of time
and when set to linear the material previews are wrong and too bright.
You could set input color profile inside c4d to linear but then besides
the wrong material previews you also need to adjust all solid colors with a gamma correction.

mlon

2023-09-14, 13:56:15
Reply #10

burnin

  • Active Users
  • **
  • Posts: 1535
    • View Profile
"Input Color Profile" should be set in accordance to used sources...
Do provide an exemplary scene file, exposing the issue.
« Last Edit: 2023-09-14, 14:13:28 by burnin »

2023-09-15, 09:31:18
Reply #11

lollolo

  • Active Users
  • **
  • Posts: 223
    • View Profile
Hi Corona Team, the links I posted above don't work anymore, and I can't find an article in the help desk about this topic.
Could you bring these old articles back online?

https://coronarenderer.freshdesk.com/support/solutions/articles/12000020988-understanding-srgb-gamma-color-values
https://help.c4d.corona-renderer.com/support/solutions/articles/12000010221

2023-09-15, 09:47:05
Reply #12

Beanzvision

  • Corona Team
  • Active Users
  • ****
  • Posts: 3873
  • Bengamin
    • View Profile
    • Cormats
Hi Corona Team, the links I posted above don't work anymore, and I can't find an article in the help desk about this topic.
Could you bring these old articles back online?

https://coronarenderer.freshdesk.com/support/solutions/articles/12000020988-understanding-srgb-gamma-color-values
https://help.c4d.corona-renderer.com/support/solutions/articles/12000010221
Hi, I'm assuming it's these? Please bookmark them as we are no longer using the links above. All articles have been moved here:
https://support.chaos.com/hc/en-us/articles/4528579184657--Understanding-sRGB-gamma-color-values-3ds-Max-
https://support.chaos.com/hc/en-us/articles/4528602798609-How-to-configure-gamma-lwf-color-profile-
Bengamin Jerrems l
Portfolio l Click me!