how to modify light "power and color" after rendering

Practical and theoretical implementation discussion.
MohamedSakr
Posts: 83
Joined: Thu Apr 24, 2014 2:27 am

how to modify light "power and color" after rendering

Post by MohamedSakr » Thu Aug 07, 2014 6:11 am

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?

Dade
Posts: 206
Joined: Fri Dec 02, 2011 8:00 am

Re: how to modify light "power and color" after rendering

Post by Dade » Thu Aug 07, 2014 7:08 am

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).

MohamedSakr
Posts: 83
Joined: Thu Apr 24, 2014 2:27 am

Re: how to modify light "power and color" after rendering

Post by MohamedSakr » Thu Aug 07, 2014 2:06 pm

so you store average ray length per pixel? (I think this may lead to Bias)

Dade
Posts: 206
Joined: Fri Dec 02, 2011 8:00 am

Re: how to modify light "power and color" after rendering

Post by Dade » Fri Aug 08, 2014 6:48 am

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.

MohamedSakr
Posts: 83
Joined: Thu Apr 24, 2014 2:27 am

Re: how to modify light "power and color" after rendering

Post by MohamedSakr » Fri Aug 08, 2014 4:54 pm

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)

ingenious
Posts: 282
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK
Contact:

Re: how to modify light "power and color" after rendering

Post by ingenious » Sun Aug 10, 2014 2:58 am

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.
Image Click here. You'll thank me later.

MohamedSakr
Posts: 83
Joined: Thu Apr 24, 2014 2:27 am

Re: how to modify light "power and color" after rendering

Post by MohamedSakr » Sun Aug 10, 2014 4:12 am

well now I got more confused :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 :)

thanks a lot for help Dade and Iliyan, you inspired me to do some test cases and see

Dade
Posts: 206
Joined: Fri Dec 02, 2011 8:00 am

Re: how to modify light "power and color" after rendering

Post by Dade » Sun Aug 10, 2014 7:39 am

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.

MohamedSakr
Posts: 83
Joined: Thu Apr 24, 2014 2:27 am

Re: how to modify light "power and color" after rendering

Post by MohamedSakr » Sun Aug 10, 2014 10:40 am

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 :D

yuriks
Posts: 7
Joined: Fri Jul 25, 2014 1:22 am

Re: how to modify light "power and color" after rendering

Post by yuriks » Sun Aug 10, 2014 9:24 pm

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:
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:
Image

A 0.6/0.3/0.8:
Image

And one with all lights at full intensity: (1.0/1.0/1.0)
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.

Post Reply