how to modify light "power and color" after rendering back

Board: Home Board index Raytracing General Development

(L) [2014/08/07] [ost by MohamedSakr] [how to modify light "power and color" after rendering] Wayback!

I see in some commercial renderers, like Maxwell (or non commercial like LuxRender), that they give the option to store each light ID, so after the render finishes, you can change light illumination intensity and color so it affects the whole scene
with the same approach they give the option to modify some camera settings

I think this option is called "multi light"

how this is done?
(L) [2014/08/07] [ost by Dade] [how to modify light "power and color" after rendering] Wayback!

>> MohamedSakr wrote:I see in some commercial renderers, like Maxwell (or non commercial like LuxRender), that they give the option to store each light ID, so after the render finishes, you can change light illumination intensity and color so it affects the whole scene
with the same approach they give the option to modify some camera settings

I think this option is called "multi light"

how this is done?
In LuxRender, instead of storing the radiance in single place, it is stored in a vector where the index is the ID of the light group: it is like rendering the same image multiple times but only with one light group powered at time, the results are than merged with a set of scale factors controlled by the user (so he/she can scale the power of each light group).
(L) [2014/08/07] [ost by MohamedSakr] [how to modify light "power and color" after rendering] Wayback!

so you store average ray length per pixel? (I think this may lead to Bias)
(L) [2014/08/08] [ost by Dade] [how to modify light "power and color" after rendering] Wayback!

>> MohamedSakr wrote:so you store average ray length per pixel? (I think this may lead to Bias)
Uh ? No, instead of a single value per pixel we store a vector. Each element of the vector represents the contribution of each light group.
(L) [2014/08/08] [ost by MohamedSakr] [how to modify light "power and color" after rendering] Wayback!

there are 2 points here that concerns me:
1- if you will store everything, this means the more the samples, the more memory consumption , so if you render with PT or BDPT to get each light group contribution for each pixel, you will store a very lot of sample "lengths" in each pixel vector

2- for this approach, you won't terminate rays which doesn't contribute (what about russian roullete?)

let me conclude what I understand to see if it's correct:
1- for each light group there will be a separate image data
2- the data stored for each (sample & pixel) is (sample ray length, Factor "of all bounces till it reaches this point in pixel", light group ID)
the final result = Factor * L[light group ID] / length^2  , and this is for each sample that is stored in that pixel for this light group ID (that's why I think the memory will blow up)
(L) [2014/08/10] [ost by ingenious] [how to modify light "power and color" after rendering] Wayback!

No, it's much more simple than that. The contribution of each light source is additive. Think about it as rendering separate images where for each image you turn only one light on. Summing up those individual images gives you the final image with the contributions of all lights. And  you can manipulate each image before summing them up to adjust the brightness or color of each light. That's it.
(L) [2014/08/10] [ost by MohamedSakr] [how to modify light "power and color" after rendering] Wayback!

well now I got more confused  [SMILEY :D]

we can't store the brightness only in the light group layer "it will scale unrealistically!!"
so at least I think we need to store also an average distance of each pixel to light source

so I think I got a good idea to do this now  [SMILEY :)]

thanks a lot for help Dade and Iliyan, you inspired me to do some test cases and see
(L) [2014/08/10] [ost by Dade] [how to modify light "power and color" after rendering] Wayback!

>> MohamedSakr wrote:
we can't store the brightness only in the light group layer "it will scale unrealistically!!"
so at least I think we need to store also an average distance of each pixel to light source

You are only storing the radiance arriving at the eye (nothing else is required) and you have just keep the amount separated by every light group in order to be able to dynamically merge the values scaled by a user defined parameter.
(L) [2014/08/10] [ost by MohamedSakr] [how to modify light "power and color" after rendering] Wayback!

oh I see now!!, in the previous equation "FinalResult = Factor * L[LightGroupID] / distance^2" , the distance is not needed as it can be stored and summed in the Factor (which will result in the radiance), then it will be just a storage of radiance per pixel as you said, really thanks for the help Dade  [SMILEY :D]
(L) [2014/08/10] [ost by yuriks] [how to modify light "power and color" after rendering] Wayback!

Your understanding still seems somewhat confused (sorry if that's not indeed the case), so here's an alternative way to explain it:

Light intensity is additive. That means that rendering a scene with N light sources is the same as rendering the scene with only one light source active at a time. Here's a rendering from my renderer with 3 different lights: The sky, one in the upper left corner, and the visible light to the left of the sphere:
[IMG #1 Image]

You can then freely adjust the intensity of each light simply by adding the pixel values together. This is a 0.0/1.0/1.0 add:
[IMG #2 Image]

A 0.6/0.3/0.8:
[IMG #3 Image]

And one with all lights at full intensity: (1.0/1.0/1.0)
[IMG #4 Image]

You can try this experiment "at home" in an image editor, but keep in mind that you must add the images in linear space, or the results won't be right. (Use a linear color space in Photoshop, or Krita if you don't have PS.) In this case even then the results won't be 100% exact, because the images are already tonemapped to remove values above 1.0, which is a non-linear operation, but the results are close enough. In a production renderer you'd do all these steps before tone-mapping.

This works, but is wasteful, since the entire image needs to be completely re-rendered, from scratch, for each light or group of lights. Since all operations on light are linear, you can use associativity of operations to move the calculation f(L_1) + f(L_2) + f(L_3) (where f is the function that computer the pixel intensity for a light, a linear operator) to the outside, as so: f(<L_1, L_2, L_3>). This gives the "light vector" scheme explained by Dade.
[IMG #1]:[IMG:#0]
[IMG #2]:[IMG:#1]
[IMG #3]:[IMG:#2]
[IMG #4]:[IMG:#3]

back