Hybrid Back/Forward path tracing (aka BiDir without MIS)

Discussion related to the LuxCore functionality, implementations and API.
Post Reply
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by Dade »

Introduction

The current implementation of PhotonGI caustic cache has been stretched up to the point to not make any sense. I'm looking for an alternative solution to replace and discard caustic cache altogether. Hybrid Back/Forward path tracing is what I'm thinking to use at the moment.

Hybrid Back/Forward path tracing

Path tracing builds paths from the eye toward the light source. Many years ago it was called also backward ray tracing. Light tracing does the opposite, builds paths from the light source toward the eye and it is really (only) good to render caustics (forward path tracing).

Bidirectional path tracing does both, building many times the same path in different ways and mix the result with MIS (multiple importance sampling). BiDir is slow because of the "building many times the same path" part.

My idea is to trace, alternatively, back and forward paths. The ratio is driven by a user defined parameter. The result works with OpenCL, is extremely fast and is really good to render caustics:

caustic.jpg

Notice the samples/sec. This picture was rendered using a single GPU and the GPU was dedicated to render only eye paths while the CPU was dedicated to render light paths (i.e. caustics).

This is technically bidirectional path tracing done using GPUs but without MIS and with asymmetrical workload. I think this solution is currently used by Iray.

Parameters

You can enable hybrid Back/Forward path tracing with:

Code: Select all

path.hybridbackforward.enable = 1
You control the ratio between eye and light paths with:

Code: Select all

path.hybridbackforward.partition = 0.8
This will trace the 80% of eye paths and a 20% of light paths.

The parameters work for both PATHCPU and PATHOCL (but read below). TILEPATH ignores the parameter because tile rendering can not work with light paths, for obvious reasons.

OpenCL

GPUs can still render only eye paths so when using PATHOCL, the parameters control only the ratio of the CPU work: GPU will always rende only eye paths, CPU will render both.
Most of the times, if not all, it is best to dedicate the GPU to render only eye paths, and the CPU only light paths (i.e. "path.hybridbackforward.partition = 0.0").

Glossy caustics

If this solution replaces caustic cache, I will add the support for glossy caustics too. It currently render only specular caustics like caustic cache.
Support LuxCoreRender project with salts and bounties
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by Sharlybg »

GPUs can still render only eye paths so when using PATHOCL, the parameters control only the ratio of the CPU work: GPU will always rende only eye paths, CPU will render both.
Most of the times, if not all, it is best to dedicate the GPU to render only eye paths, and the CPU only light paths (i.e. "path.hybridbackforward.partition = 0.0").
This seem to be a more natural idea. And les tricky settings. Thanks for the R&D.
Also the possibility to rules the CPU load between caustics and simple path is good idea when considering the fact that there are configuration with monster CPU. And scene where caustics is a bonus.
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by lacilaci »

well... this looks really neat.

And if it could also do glossy caustics, we might have a pretty fantastic solution.

I also agree that if caustic cache cannot be improved upon, it should be discarded

I have to ask though, will this render sds?
epilectrolytics
Donor
Donor
Posts: 790
Joined: Thu Oct 04, 2018 6:06 am

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by epilectrolytics »

This looks really promising!

Is it unbiased?
Does it do SDS-paths?

The caustic cache just became usable again with periodic permutation.
This is an approach with lots of potential but probably too high a cost of precious development time.
I understand if dealing with it has become dreadful.
Also it is difficult to set up for the user.

Can't wait to test the new build! :mrgreen:
provisory
Posts: 235
Joined: Wed Aug 01, 2018 4:26 pm

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by provisory »

Yes!
I think, this will be the Solution!
provisory
Posts: 235
Joined: Wed Aug 01, 2018 4:26 pm

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by provisory »

epilectrolytics wrote: Sun Jun 23, 2019 2:01 pm Is it unbiased?
Does it do SDS-paths?
LightCPU can do SDS-paths, and unbiased (if I'm not mistaken), so I think it should be too.
Actually what I don't understand, is why this hybrid path tracing can't do glossy caustics out of the box, when LightCPU can?
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by Dade »

epilectrolytics wrote: Sun Jun 23, 2019 2:01 pm Is it unbiased?
Yes.
epilectrolytics wrote: Sun Jun 23, 2019 2:01 pm Does it do SDS-paths?
It is like BiDir, it can only if the light is intersectable (i.e. it is directly visible, like an area light, not like a point light, etc.). But if the area light is very small, it may be not very good at rendering SDS paths (again, like BiDir).
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by Dade »

provisory wrote: Sun Jun 23, 2019 3:17 pm Actually what I don't understand, is why this hybrid path tracing can't do glossy caustics out of the box, when LightCPU can?
Because there is a static fixed partition of tasks: specular caustics are rendered by light paths and glossy caustics are rendered by eye paths. You can literally do 2 sperate renderings, one with "path.hybridbackforward.partition = 1.0" and one "path.hybridbackforward.partition = 0.0", merge the two images and get the correct result. There is no task overlaps like in normal BiDir.

It is about modifying the code so light paths will take care of glossy caustics too (and eye paths will not).
Support LuxCoreRender project with salts and bounties
epilectrolytics
Donor
Donor
Posts: 790
Joined: Thu Oct 04, 2018 6:06 am

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by epilectrolytics »

Holy shit this thing is fast!!
Wallpaper scene is nearly clean in two minutes, probably OIDN ready in one!
Including dispersion!
Screenshot.jpg
But (nearly) no SDS-paths is a problem for me, especially since we now have a solution for this since three days with periodic caustic cache.
I understand that no more development should be invested into caustic cache and this is fine with me but please let's keep this on board until there is another solution to the SDS problem.

In Blender Cycles render tab there is an option to choose between supported and experimental feature set.
Can we use this in Luxcore to hide the caustic cache from the user instead of discarding it?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Hybrid Back/Forward path tracing (aka BiDir without MIS)

Post by B.Y.O.B. »

Cool stuff!
One question: does it make sense to use this for CPU-only rendering, or will Bidir still win there?
Post Reply