LuxCore: the new image pipeline

Discussion related to the implementation of new features & algorithms to the Core Engine.

Moderators: Dade, jromang, tomb, zcott, coordinators

LuxCore: the new image pipeline

Postby Dade » Wed Nov 13, 2013 12:46 pm

Introductions

LuxCore, among other things, redefines the way image pipeline works. The current Film implementation contains information about a long list of outputs as described here: viewtopic.php?f=34&t=10538

In particular, 2 out channels are not a direct result of the rendering but the product of the image pipeline (applied to the output of the rendering):

- RGB_TONEMAPPED channel;
- RGBA_TONEMAPPED channel (indeed, this channel is just the above output plus alpha information).

The new image pipeline has an plug-in based and configurable architecture where any number of plug-in instances can be used to build the pipeline. For instance, this is the definition of the default pipeline:

Code: Select all
film.imagepipeline.0.type = TONEMAP_AUTOLINEAR
film.imagepipeline.1.type = GAMMA_CORRECTION
film.imagepipeline.1.value = 2.2


The image pipeline is just built with 2 plugins: the autolinear tonemapper and a the comma correction.

The plug-ins

At the moment, this is the list of supported plug-ins (but it can be easily extended with more like film response, false colors, etc.):

- linear tone mapper;
- LuxRender-like linear tone mapper;
- autolinear tone mapper;
- Reinhard02 tone mapper;
- gamma correction;
- output switcher;

This is another example of pipeline:

Code: Select all
film.imagepipeline.0.type = OUTPUT_SWITCHER
film.imagepipeline.0.channel = DEPTH
film.imagepipeline.1.type = TONEMAP_AUTOLINEAR
film.imagepipeline.2.type = GAMMA_CORRECTION
film.imagepipeline.2.value = 2.2


The OUTPUT_SWITCHER will overwrite RGB values with the one coming from the DEPTH buffer; TONEMAP_AUTOLINEAR will map the values between 0 and 1 and GAMMA_CORRECTION will gamma correct the values. The result is that the real-time on screen output will show the Z-Buffer (in shade of grays) instead of the normal RGB buffer. The same can be applied to any output channel like light groups, eye/light sampling in BiDir, etc.
Last edited by Dade on Sun Nov 24, 2013 4:54 am, edited 2 times in total.
User avatar
Dade
Developer
 
Posts: 8356
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Re: LuxCore: the new image pipeline

Postby tomb » Wed Nov 13, 2013 3:26 pm

Cool :) Should be fairly easy to extend with lots of neat stuff!
User avatar
tomb
Developer
 
Posts: 2677
Joined: Thu Oct 11, 2007 4:23 pm
Location: Oslo, Norway

Re: LuxCore: the new image pipeline

Postby pciccone » Wed Nov 13, 2013 3:40 pm

Very interesting work Dade. Thank you for the explanation. What is the difference between Linear and Lux-linear?
User avatar
pciccone
Developer
 
Posts: 1579
Joined: Wed Jan 13, 2010 11:02 am
Location: South Carolina

Re: LuxCore: the new image pipeline

Postby Dade » Wed Nov 13, 2013 4:14 pm

pciccone wrote:Very interesting work Dade. Thank you for the explanation. What is the difference between Linear and Lux-linear?


Not very much, in first case the scale parameter of the linear tone mapper is directly defined while in the other the scale parameter is:

scale = exposure / (fstop * fstop) * sensitivity * 0.65f / 10.f * powf(118.f / 255.f, gamma)

Lux-linear it is mostly an utility taking as input the same parameter of LuxRender linear tonemapper.
User avatar
Dade
Developer
 
Posts: 8356
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Re: LuxCore: the new image pipeline

Postby B.Y.O.B. » Mon Dec 08, 2014 10:43 am

A list of all tonemapper names and their settings would be great for exporter devs ;)
A hint on the code would work, too, if it is easy to see the information there.

I'd like to implement the support for linear, reinhard etc. tonemappers in LuxBlend 2.x mode.
For example, how is the "LuxRender-like linear tone mapper" called internally? How to set its attributes like fstop, sensitivity etc.?
User avatar
B.Y.O.B.
Developer
 
Posts: 5135
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Re: LuxCore: the new image pipeline

Postby Dade » Mon Dec 08, 2014 12:28 pm

B.Y.O.B. wrote:A list of all tonemapper names and their settings would be great for exporter devs ;)
A hint on the code would work, too, if it is easy to see the information there.

I'd like to implement the support for linear, reinhard etc. tonemappers in LuxBlend 2.x mode.
For example, how is the "LuxRender-like linear tone mapper" called internally? How to set its attributes like fstop, sensitivity etc.?


The header with the declaration of all image pipeline plugins not related to tone mapping is here: https://bitbucket.org/luxrender/luxrays ... ault#cl-38
The plugins related to tone mapping are declared here: https://bitbucket.org/luxrender/luxrays ... ault#cl-43

The code parsing of the image pipeline properties in the RenderConfig is here: https://bitbucket.org/luxrender/luxrays ... ult#cl-299

The complete list of plugin types is:

[*]TONEMAP_LINEAR (parameters: scale)
[*]TONEMAP_REINHARD02 (parameters: prescale, postscale, burn)
[*]TONEMAP_AUTOLINEAR (no parameters)
[*]TONEMAP_LUXLINEAR (parameters: sensitivity, exposure, fstop)
[*]NOP (no parameters)
[*]GAMMA_CORRECTION (parameters: value)
[*]OUTPUT_SWITCHER (parameters: channel, switcher)
[*]GAUSSIANFILTER_3x3 (parameters: weight)
[*]CAMERA_RESPONSE_FUNC (parameters: name)

The parameters are the same of LuxRender (where applicable).
User avatar
Dade
Developer
 
Posts: 8356
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Re: LuxCore: the new image pipeline

Postby B.Y.O.B. » Mon Dec 08, 2014 4:47 pm

Thank you, I added the support for lux_linear and reinhard to LuxCore export: https://bitbucket.org/luxrender/luxblen ... f9ac087b89
User avatar
B.Y.O.B.
Developer
 
Posts: 5135
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

Re: LuxCore: the new image pipeline

Postby fade » Tue Feb 16, 2016 6:54 am

Hi. I have been scouring the wiki and forums but I have not found an answer so far, so I'm posting here:

I'm trying to save an image where the alpha channel contains the information from OBJECT_ID_MASK. I was hoping OUTPUT_SWITCHER would let me do this, but from reading the source code it seems OUTPUT_SWITCHER will always write to the RGB channels. Is there a way to do what I'm trying to achieve without patching the source? If not, might i suggest adding a parameter to OUTPUT_SWITCHER so that the user can specify which image channel the output is redirected into. I think this makes sense especially since things like object_id, material_id, depth and so on all contain single channel data. Forcing a copy into each channel of the output image seems unnecessary.
fade
 
Posts: 1
Joined: Tue Feb 16, 2016 3:27 am

Re: LuxCore: the new image pipeline

Postby Dade » Tue Feb 16, 2016 7:35 am

fade wrote:I'm trying to save an image where the alpha channel contains the information from OBJECT_ID_MASK. I was hoping OUTPUT_SWITCHER would let me do this, but from reading the source code it seems OUTPUT_SWITCHER will always write to the RGB channels. Is there a way to do what I'm trying to achieve without patching the source? If not, might i suggest adding a parameter to OUTPUT_SWITCHER so that the user can specify which image channel the output is redirected into. I think this makes sense especially since things like object_id, material_id, depth and so on all contain single channel data. Forcing a copy into each channel of the output image seems unnecessary.


Do you strictly need to save the OBJECT_ID_MASK channel as alpha in a single RGBA image ? I mean, you can easily save the OBJECT_ID_MASK as a separate 1 channel .png file and then use it for any operation you want to do with the RGB output. You just end with 2 files instead of one.

You can define any number of film outputs out of the current rendering.
User avatar
Dade
Developer
 
Posts: 8356
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy


Return to Architecture & Design

Who is online

Users browsing this forum: No registered users and 1 guest