Colour correcting HDRIs

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Colour correcting HDRIs

Post by CodeHD »

CodeHD wrote: Tue Apr 21, 2020 8:50 pm I would volunteer, it could be another good exercise task for me ;)
I was going to have a look at it now as I said, but it seems to have been completed already :?:
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Colour correcting HDRIs

Post by Dade »

CodeHD wrote: Thu Apr 30, 2020 6:09 pm
CodeHD wrote: Tue Apr 21, 2020 8:50 pm I would volunteer, it could be another good exercise task for me ;)
I was going to have a look at it now as I said, but it seems to have been completed already :?:
Mmm, no, I don't think so :?:
Support LuxCoreRender project with salts and bounties
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Colour correcting HDRIs

Post by CodeHD »

I checked in Blender + daily build, and HDRI now has a "tint" option.
So maybe BYOB added it there?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Colour correcting HDRIs

Post by B.Y.O.B. »

I just added back the option to use the rgb gain on sky and HDRI to give them a color tint, like it was before v2.3.
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Colour correcting HDRIs

Post by CodeHD »

Ah okay I see. just re-read all of this, so I guess we're still in need for saturation for example. I will take a look at it then.
Might need to come back with some questions about the arbitrary node trees :D
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Colour correcting HDRIs

Post by B.Y.O.B. »

You can look at the displacement shape code, where the height is also obtained from executing a texture node tree. Basically you just create a fake hitpoint and call the GetSpectrumValue() method of the supplied texture.
In the case of environment maps, it would be useful to have UV coordinates in the hitpoint which correspond to the mapping of the HDRI (a latlong sphere mapping).

Since the node tree only has to be evaluated on the CPU and is then baked into the HDRI map, you don't have to deal with OpenCL and its complexity.
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Colour correcting HDRIs

Post by CodeHD »

Ok, so I've been spending a bit of time to work my way through the relevant code and implement something.
I finally did it essentially as a copy of the ReverseGammaCorrection method. I'm not quite sure if I've added the additional argument to all functions, but at least it compiles and works in a simple scene. I guess this could be implemented for function like contrast, hue shift, color temperature shift. Anything else?

I didnt't progress yet on arbitrary nodes, a lot more of the existing code base to uderstand for that... But I'm also not sure if that would matter with respect to writing the code above, or if it will be just a question of evaluating arguments to pass ?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Colour correcting HDRIs

Post by B.Y.O.B. »

CodeHD wrote: Thu May 07, 2020 5:06 pm I didnt't progress yet on arbitrary nodes, a lot more of the existing code base to uderstand for that... But I'm also not sure if that would matter with respect to writing the code above, or if it will be just a question of evaluating arguments to pass ?
The thing is, if you implement contrast, hue shift and color temperature, people will soon ask for another feature, and another, and so on.
If you only implement support for arbitrary nodes, you don't need to do anything else (and if there are missing operations, they will become available to both HDRI tweaking and regular textures/materials at once when implemented).
If you are stuck with anything, feel free to ask me for help. :)
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Colour correcting HDRIs

Post by CodeHD »

I've been slacking off on this, but i've not given up ;)
Anyways, a bit more pointing me in the right direction might be helpful.

I've been looking at the displacement shape as you suggested but (in the LuxCore code) I don't see how that shows a node tree. There it seems to just load a texture map.
Is the tree evaluated in BlendLuxCore?

Also, if I see this right, the background has no option to use nodes in BlendLuxCore at the moment :?:
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Colour correcting HDRIs

Post by Dade »

Adding a pre-process image map pipe line like the pre-process geometry pipe line may be a bit complex as a task and it may be better if I write the infrastructure (if we want to have one; we could plan one for the next version).

In the mean time I would stick to the original simple idea to have another pre-processing ChannelSelectionType option like component selection or color averaging, etc.: https://github.com/LuxCoreRender/LuxCor ... map.h#L554
Support LuxCoreRender project with salts and bounties
Post Reply