Page 1 of 2

Musgrove Texture Issues

Posted: Sun Jan 24, 2021 2:19 pm
by Racleborg
Hi there

The Dimension, lacunarity, Octaves and Intensity values don't appear to be working in the Blender Musgrove Texture?

(See attached files)

Cheers

Re: Musgrove Texture Issues

Posted: Tue Jan 26, 2021 2:27 pm
by B.Y.O.B.
Thanks for the report, fixed.

Re: Musgrove Texture Issues

Posted: Tue Jan 26, 2021 4:34 pm
by Racleborg
@BYOB

Thank you

I don't think the Noise Depth is working on the Marble texture, either. (attached Files)

Re: Musgrove Texture Issues

Posted: Tue Jan 26, 2021 5:27 pm
by B.Y.O.B.
Fixed.

Re: Musgrove Texture Issues

Posted: Tue Jan 26, 2021 11:56 pm
by Racleborg
@B.Y.O.B

Thank you :)

Re: Musgrove Texture Issues

Posted: Thu Jan 28, 2021 3:09 pm
by Racleborg
@B/Y.O.B

In the Blender Marble Texture, the Noise depth appears to be doing some strange stuff at a value of 29 and above.
(attached files).

Re: Musgrove Texture Issues

Posted: Thu Jan 28, 2021 4:50 pm
by B.Y.O.B.
Racleborg wrote: Thu Jan 28, 2021 3:09 pm In the Blender Marble Texture, the Noise depth appears to be doing some strange stuff at a value of 29 and above.
(attached files).
I suspect the problem is here: https://github.com/LuxCoreRender/LuxCor ... .cpp#L1399
(the noise depth is called "oct" in the code)

In this code, a signed integer 1 is bit-shifted to the left by oct + 1 places. Since an integer typically has 32 bits, the maximum we can shift is by 31, and since 1 is added to oct in the equation, oct should be limited to 30. And indeed, in the original Blender UI for the old marble texture, the noise depth is limited to 30.

Now, I'm not sure why the code would make problems from oct = 29 on like in your example. Maybe that problem is elsewhere.

One thing I noticed is that the integers should be unsigned (u suffix), but I'm not sure if the compiler automatically detects and fixes this.
So the expression would be:

Code: Select all

((float)(1u << oct) / (float)((1u << (oct + 1)) - 1))

Re: Musgrove Texture Issues

Posted: Thu Jan 28, 2021 5:08 pm
by Racleborg
@B.Y.O.B

Thank you for the explanation :)

Could the input be restricted to a maximum of 29?

Re: Musgrove Texture Issues

Posted: Thu Jan 28, 2021 5:16 pm
by B.Y.O.B.
Racleborg wrote: Thu Jan 28, 2021 5:08 pm Could the input be restricted to a maximum of 29?
It should be max. 30 and the other bug causing it to fail at 29 should be found and fixed.

Re: Musgrove Texture Issues

Posted: Thu Jan 28, 2021 6:19 pm
by B.Y.O.B.
Since fscale is multiplied by 2 each loop iteration, it just gets very big. This causes the call of noisefunc() to return NAN at around iteration 29. When x, y, z are bigger values, maybe even sooner.

I don't know how/if the Blender developers dealt with this.
I would suggest to lower the max. noise depth even further to mitigate the problem, maybe to a max of 25. Note that most of the time, much lower noise depth values will be used, as the difference between them gets indistinguishable at low numbers like 8 or so.