Page 1 of 1

Issue With Too Many Alpha Textured Meshes

Posted: Sat Jul 28, 2018 5:01 am
by rrubberr
Hi, I've had an issue since I originally started using Luxrender around version 1.4 of original Lux where, when trying to render grass with flat texture cards, the particularly dense areas where the "alpha" of the grass cards overlap turns black.
The attachment testt1.png is no longer available
A zoomed in example.
A zoomed in example.
The weird part about this is that it doesn't happen in the trees, which have many overlapping leaves, but it does happen in the grass. I have tried increasing the maximum light depth, but it doesn't seem to resolve the issue.

Does this have to do with using a particle system to place the grass, or is it just because there are so many layers of grass? Any assistance is greatly appreciated.

Re: Issue With Too Many Alpha Textured Meshes

Posted: Sat Jul 28, 2018 9:16 am
by B.Y.O.B.
Can you show your material node setup?
Are you using the opacity socket or still the old "mix with null"? The opacity socket is a lot faster.
If I remember correctly, it should also not be dependent on the path depth, however in a quick test I can reproduce a darkening effect that appears weakly when stacking 16 planes behind each other and grows stronger when more planes are added, eventually leading to a black area.

It might be a bug in LuxCore.
I opened an issue: https://github.com/LuxCoreRender/LuxCore/issues/124

(These were all rendered with path depth 1):

Re: Issue With Too Many Alpha Textured Meshes

Posted: Sat Jul 28, 2018 3:29 pm
by rrubberr
B.Y.O.B. wrote: Sat Jul 28, 2018 9:16 am Can you show your material node setup?
Are you using the opacity socket or still the old "mix with null"? The opacity socket is a lot faster.
If I remember correctly, it should also not be dependent on the path depth, however in a quick test I can reproduce a darkening effect that appears weakly when stacking 16 planes behind each other and grows stronger when more planes are added, eventually leading to a black area.

It might be a bug in LuxCore.
I opened an issue: https://github.com/LuxCoreRender/LuxCore/issues/124

(These were all rendered with path depth 1):
I was using the mix with null method, but I will update all of my transparencies to use opacity instead. Thank you for the tip.

No way to solve it though, currently?

Re: Issue With Too Many Alpha Textured Meshes

Posted: Sat Jul 28, 2018 4:11 pm
by Dade
I think I have already described this problem some time ago :?: It isn't exactly a bug but a quite complex problem.

Long story short: the code needs an undefined and unbounded number of random variables to handle multiple layers of transparent objects however it receives only one single random variable from the sampler (because it can only generate a bounded number of variables).
So, the only solution was to generate a new random variable starting from the previous one, when new layer of transparent surface is found. The problem is that this operation requires more and more numerical precision each layer you find. With only 32bit floating point numbers, it runs out of "bits" after few layers (ending probably to generate always 0.0 as value).

However, in the mean time, I had the same problem when I re-wrote the volume rendering code and I used there a new solution, one that doesn't suffer from the numerical precision problem.

Now, I have applied the same solution used for heterogeneous volume rendering, to the generic scene intersection code and it seems to works fine and to solve the above problem:
opa.jpg

Re: Issue With Too Many Alpha Textured Meshes

Posted: Sat Jul 28, 2018 7:28 pm
by rrubberr
Dade wrote: Sat Jul 28, 2018 4:11 pm Now, I have applied the same solution used for heterogeneous volume rendering, to the generic scene intersection code and it seems to works fine and to solve the above problem:
Thank you for the quick fix.

Re: Issue With Too Many Alpha Textured Meshes

Posted: Sat Jul 28, 2018 10:59 pm
by Sharlybg
Now, I have applied the same solution used for heterogeneous volume rendering, to the generic scene intersection code and it seems to works fine and to solve the above problem:
Wow just like black magic. Like listen the best of Mozart. You are an artist i think.playing with line of code like that is just mind blowing.
Thank you.