## Purely based on luxcore and luxrays rendering

General Project and community related discussion.

### Purely based on luxcore and luxrays rendering

Hi all, I am trying to perform rendering purely based on the luxcore and luxrays libraries.
Although the luxRender and luxBlend are awesome, I prefer to develop my own GUI for a simple rendering app.
However, I am lack of experience on the luxcore and luxrays libraries and now can only refer to some out-dated tutorials. Some of the methods in the old version are now not available.
For example the caustics effect in rendering gemstones, reflection on the ground and other objects is missing. Or am I using the wrong settings?

Here is my attempt on rendering a quadrilateral glass and 2 diamonds. I only used an HDR image for environment lighting.
Some rendering stats for it:
[Elapsed time: 1231/0sec][Pass 12040/0][Convergence 28.501087%][Avg. samples/sec 9.01M on 47.1K tris]

And following are the properties I used in the rendering like the volume for the diamonds and the glass
Code: Select all
                     //Light                     Property("scene.lights.studio019.type")("infinite") <<                     Property("scene.lights.studio019.file")("studio019.hdr") <<                     Property("scene.lights.studio019.gamma")(1.0f/2.2f)                    //Volume properties                    Property("scene.volumes.vol_diamond.type")("clear") <<                    Property("scene.volumes.vol_diamond.absorption")(0.01f, 0.01f, 0.01f) <<                    Property("scene.volumes.vol_diamond.ior")(2.42) <<       //Sapphire = 1.77, Diamond = 2.42                    Property("scene.volumes.vol_diamond.priority")(0) <<                    //Glass                    Property("scene.volumes.vol_object.type")("clear") <<                    Property("scene.volumes.vol_object.absorption")(0.1f, 0.1f, 0.1f) <<                    Property("scene.volumes.vol_object.ior")(1.77) <<       //Sapphire = 1.77, Diamond = 2.42                    Property("scene.volumes.vol_object.priority")(1)                      ...                     //Material properties of the quad-glass and diamond                     Property("scene.materials.mat_object.type")("glass") <<                     Property("scene.materials.mat_object.kr")("tex_obj_diff") <<                     Property("scene.materials.mat_object.exteriorior")("tex_obj_diff") <<   //The color texture for the quad-glass                     Property("scene.materials.mat_object.volume.interior")("vol_object") <<                     Property("scene.materials.mat_diamond.type")("glass") <<                     Property("scene.materials.mat_diamond.volume.interior")("vol_diamond")                     ....                    //Engine settings                    Property("renderengine.type")("PATHOCL") <<                    Property("sampler.type")("METROPOLIS") <<                    Property("pathocl.pixelatomics.enable")(1)                                 ....

The camera settings

Camera type: perspective
Camera position: Point[0.593465, 0.564009, 5]
Camera target: Point[0.5, 0.5, 0]
Camera FOV: 28.1812
Camera focaldistance: 5.100

lip

Posts: 7
Joined: Thu Aug 03, 2017 10:34 pm

### Re: Purely based on luxcore and luxrays rendering

Which engine and sampler are you using?
If you want render caustics, Bidir + Metropolis is probably your best choice.
Also, make sure that the path depth is high enough (something like 8 should be enough).

B.Y.O.B.

Posts: 5181
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

### Re: Purely based on luxcore and luxrays rendering

The problem is likely to be in your HDR image. Given the very uniform lighting of your rendering, I assume your HDR isn't a true "HDR" but is more an "LDR" in an HDR file format (i.e. there is no high dynamic range of values, the lighting pixels are only 5 times brighter than the average while, in reality, they should be 10000000 brighter (aka a LOT brighter)).

Your rendering should have sharp shadows to have caustics so try to use a strong directional light source like a small triangle.

There is also the other problem highlighted by B.Y.O.B: smaller is the light source and harder is for a path tracer to find it (through the diamonds) so use path tracing an a not-so-small-triangle or bidirectional path tracing and a light source as small as you want (i.e. and it will lead to sharp nice caustics).

Posts: 8404
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

### Re: Purely based on luxcore and luxrays rendering

B.Y.O.B. wrote:Which engine and sampler are you using?
If you want render caustics, Bidir + Metropolis is probably your best choice.
Also, make sure that the path depth is high enough (something like 8 should be enough).

I was using PATHOCL with Metropolis.

Dade wrote:The problem is likely to be in your HDR image. Given the very uniform lighting of your rendering, I assume your HDR isn't a true "HDR" but is more an "LDR" in an HDR file format (i.e. there is no high dynamic range of values, the lighting pixels are only 5 times brighter than the average while, in reality, they should be 10000000 brighter (aka a LOT brighter)).

Your rendering should have sharp shadows to have caustics so try to use a strong directional light source like a small triangle.

There is also the other problem highlighted by B.Y.O.B: smaller is the light source and harder is for a path tracer to find it (through the diamonds) so use path tracing an a not-so-small-triangle or bidirectional path tracing and a light source as small as you want (i.e. and it will lead to sharp nice caustics).

I have checked the hdr image I used. You are right, the [R,G,B] value for the brightest area is around [5.0, 5.0, 5.0]. However, I was wondering if in a studio environment, will the lights being used has 1000000 brighter in reality for caustics and dispersion

I tried this, with similar rendering time as comparison (although the number of samples/sec reduced to 1.61M comparing with PATHOCL ) for the same scene while using BIDIRCPU and metropolis.
In addition, I have tried to add gain [10000.0, 10000.0, 10000.0] to the environment light it does not have any effect at all.

I added the sun and sky lights and attach image used 783 secs for rendering.
Code: Select all
                Property("scene.lights.skyl.type")("sky") <<                Property("scene.lights.skyl.dir")(0.166974f, 0.59908f, 0.783085f) <<                Property("scene.lights.skyl.turbidity")(2.2f) <<                Property("scene.lights.skyl.gain")(0.8f, 0.8f, 0.8f) <<                Property("scene.lights.sunl.type")("sun") <<                Property("scene.lights.sunl.dir")(0.166974f, 0.59908f, 0.783085f) <<                Property("scene.lights.sunl.turbidity")(2.2f) <<                Property("scene.lights.sunl.gain")(10000.8f, 10000.8f, 10000.8f)

lip

Posts: 7
Joined: Thu Aug 03, 2017 10:34 pm

### Re: Purely based on luxcore and luxrays rendering

lip wrote:I have checked the hdr image I used. You are right, the [R,G,B] value for the brightest area is around [5.0, 5.0, 5.0]. However, I was wondering if in a studio environment, will the lights being used has 1000000 brighter in reality for caustics and dispersion

They will be. The problem is in the vast majority of HDR files available: they are fake HDR, most of the times, they are just the result of converting a JPG in HDR format.

P.S. dispersion is not available with LuxCore but only with the old classic LuxRender.

Posts: 8404
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

### Re: Purely based on luxcore and luxrays rendering

lip wrote:In addition, I have tried to add gain [10000.0, 10000.0, 10000.0] to the environment light it does not have any effect at all.

Raising the gain does not work (it scales all values).
You will need a different HDR.

Also, sun and sky should both have the same gain for a realistic image.
The reflections in your image are black because the sky is so dark compared to the sun, it appears black.
Set both gains to 1.

B.Y.O.B.

Posts: 5181
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany

### Re: Purely based on luxcore and luxrays rendering

lip wrote:I have checked the hdr image I used. You are right, the [R,G,B] value for the brightest area is around [5.0, 5.0, 5.0]. However, I was wondering if in a studio environment, will the lights being used has 1000000 brighter in reality for caustics and dispersion

They will be. The problem is in the vast majority of HDR files available: they are fake HDR, most of the times, they are just the result of converting a JPG in HDR format.

P.S. dispersion is not available with LuxCore but only with the old classic LuxRender.

I shall adjust the value of the target HDR if needed and I am trying to approximate the dispersion by cheating the PBR engine ( using multiple materials ).

B.Y.O.B. wrote:
lip wrote:In addition, I have tried to add gain [10000.0, 10000.0, 10000.0] to the environment light it does not have any effect at all.

Raising the gain does not work (it scales all values).
You will need a different HDR.

Also, sun and sky should both have the same gain for a realistic image.
The reflections in your image are black because the sky is so dark compared to the sun, it appears black.
Set both gains to 1.

The following image has set the gain values of both the sky and the sun identical. However, the diamonds is so dark
By cheating to the PBR engine, a little chromatic is caught. Though the image was taken at a low convergence value ~2.6%. Perhaps the chromatic will disappear as the rendering goes on.
Isn't the cheating leads to blueish diamond ? Not sure...

lip

Posts: 7
Joined: Thu Aug 03, 2017 10:34 pm

### Re: Purely based on luxcore and luxrays rendering

Just for reference, this image was rendered over night with multiple materials for the diamonds ( trying to catch dispersion but obviously failed ).

Code: Select all
                Property("scene.lights.skyl.type")("sky") <<                Property("scene.lights.skyl.dir")(0.166974f, 0.59908f, 0.783085f) <<                Property("scene.lights.skyl.turbidity")(2.2f) <<                Property("scene.lights.skyl.gain")(10.8f, 10.8f, 10.8f) <<                Property("scene.lights.sunl.type")("sun") <<                Property("scene.lights.sunl.dir")(0.166974f, 0.59908f, 0.783085f) <<                Property("scene.lights.sunl.turbidity")(2.2f) <<                Property("scene.lights.skyl.relsize")(10.1f) <<                Property("scene.lights.sunl.gain")(10.8f, 10.8f, 10.8f)                ...                Property("scene.lights.studio019.type")("infinite") <<                Property("scene.lights.studio019.file")("studio019.hdr") <<                Property("scene.lights.studio019.gain")(10.0f, 10.0f, 10.0f) <<                Property("scene.lights.studio019.gamma")(1.0f/2.2f)                ...                Property("renderengine.type")("BIDIRCPU") <<                Property("sampler.type")("METROPOLIS") <<                Property("pathocl.pixelatomics.enable")(1) <<

lip

Posts: 7
Joined: Thu Aug 03, 2017 10:34 pm

### Re: Purely based on luxcore and luxrays rendering

lip wrote:Just for reference, this image was rendered over night with multiple materials for the diamonds ( trying to catch dispersion but obviously failed )

You can not render dispersion with volumes tricks. The only solution I can think too is to render the same image multiple times with light sources emitting only a specific light wave length (and changing the index of refraction of the volumes in each rendering pass). Than merge all the renderings to obtain the final image.

For instance: 3 renderings with light emitting only Red, Green and Blue; then merged in order to obtain an RGB image. You may have to do more than 3 renderings (only 3 wave lengths is likely not to be enough) but it should give you an idea how to fake dispersion.

Posts: 8404
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

### Re: Purely based on luxcore and luxrays rendering

For dispersion faking: you could also mix glass materials in the colors red, green, blue (different IOR each) with a mix shader.
See for example: https://blenderartists.org/forum/showth ... ost2027309

B.Y.O.B.

Posts: 5181
Joined: Wed Nov 10, 2010 4:10 pm
Location: Germany