LuxCoreRender / LuxCore

LuxCore source repository
Apache License 2.0
1.16k stars 145 forks source link

Add .cube file format support #81

Closed Dade916 closed 4 years ago

Dade916 commented 6 years ago

Add the support for .cube files in camera response plugin.

Relevant links:

http://archive.is/cWkgi https://forums.luxcorerender.org/viewtopic.php?f=5&t=9&p=2537#p2536

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/56434964-add-cube-file-format-support?utm_campaign=plugin&utm_content=tracker%2F79505306&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F79505306&utm_medium=issues&utm_source=github).
lacilaci commented 4 years ago

Oh wow. So this is an old issue... I actually see the post bounty on this one, but I already did it for the project as a whole on the bountysourcepage... Maybe later 😆

Anyways, to add to the issue/request: If anyone will decide to add this loader to camera, please do not forget to make this with an adjustable strenght. Some LUTs that are obtainable from internet might be too extreme at 100% but very usable if they are blended/mixed with basic tonemapping (in case of luxcore at this point, blender+filmic)

Dade916 commented 4 years ago

https://github.com/ray-cast/lut

lacilaci commented 4 years ago

Maybe this from adobe might be useful too https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf

there is both 1D and 3D specification

Dade916 commented 4 years ago

I added a new image pipeline plugin supporting .cube files:

film.imagepipelines.0.2.type = COLOR_LUT film.imagepipelines.0.2.file = "domingo_145.cube"

@Theverat, I guess most .cube files will assume an already gamma corrected input so it should be placed after the gamma correction plugin.

@lacilaci I don't see how to apply an "adjustable strength", .cube LUT are a fixed mapping from a color to another. I could consider the two colors has a starting point A and end point B and linearly interpolate between them according a 0.0-1.0 strength parameter (so 0.0 is no transformation and 1.0 is a full transformation). However, linear interpolation in color space 99% of the times doesn't produce the desired result. Are you talking of a feature you have already seen in an existing application ?

Theverat commented 4 years ago

@Theverat, I guess most .cube files will assume an already gamma corrected input so it should be placed after the gamma correction plugin.

I am not using the gamma correction plugin in Blender, Blender does the gamma correction (and its own colorspace stuff) on the end result after the LuxCore imagepipeline is applied.

lacilaci commented 4 years ago

@Theverat hi, yes. Octane, fstorm and iirc corona too allow for adjusting strenght. Not sure how it works behind the scenes, maybe it's just blend between a result without lut applied and a result with lut?

lacilaci commented 4 years ago

By the way, Blender by default uses srgb as colorspace and filmic viewtransform, i suppose lut is going to be applied after that and its like we see in most renderers i think (exception being octane which allows to set order in which apply settings, gamma, response, lut in camera settings)

Dade916 commented 4 years ago

@Theverat can't you set the Blender gamma correction to 1.0 and use our gamma correction ?

@lacilaci you blending the images is exactly the same of blending pixels. I added the ".strength" parameter (value between 0.0 and 1.0):

film.imagepipelines.0.1.type = COLOR_LUT film.imagepipelines.0.1.file = domingo_145.cube film.imagepipelines.0.1.strength = 1.0

lacilaci commented 4 years ago

@Dade916 would it make sense for luxcore camera to have it's own color space settings(let's say linear and srgb switch - later maybe some aces) and then LUT? A lot of blender users rely on current setup of blender srgb+filmic tonepammer which auto-handles highlights so if we are to avoid using blender's color setup we need srgb and custom highlight burning in luxcore camera. But as always ideally user should have a choice to use blenders standards(many newbies like thay) or custom workflow which would require the user to first disable blender's default behavior of applying it's own color correction system wide.

I personally think luxcore should handle(or at least have the option to override) these things on it's own. Assuring that all dccs can get same treatment, but I'm far from being expert on the topic.

lacilaci commented 4 years ago

Filmic highlights is nothing but a custom curve afaik applied on top of srgb. So it shouldn't be a big deal to either replicate or better yet replace that in luxcore camera with a highlight burn controls so that users would be able to manage highlights themselves. Then, this custom lut comes to finish color corrections and you're basically done with tonemapping for 99.9% freelancer/small studio work.

Now thinking further. Bake in some of these settings and a custom lut to a benchmark scene and you can have a super impressive tech. Demos that provide final results just by using luxcore on it's own, no postprocess

lacilaci commented 4 years ago

Just to give a source for the filmic part of blender color correction workflow: http://filmicworlds.com/blog/filmic-tonemapping-with-piecewise-power-curves/

Not sure if this has evolved much since 2017

lacilaci commented 4 years ago

It seems that some predefined colorspace (usually srgb) + basic processing (filmic or whatever highlight controls) are expected always before custom LUTs are applied. Blender does it's own predefined thing that is not great nor terrible, but most other renderers than cycles rely on some sort of controls before applying LUT

Dade916 commented 4 years ago

This continue here: https://github.com/LuxCoreRender/BlendLuxCore/issues/460