Open archondoyen opened 9 months ago
Hi,
Unfortunately, the function sample
only receives a ray as it's input and calculates the outgoing radiance towards the origin of that ray.
The actual pixel position is the pos
argument provided to render_sample
here. You could set the active
flag there.
However keep in mind , that setting a value of the active
array to false, only deactivates the lane. This means that (for the most part) all lanes still perform the computations and that just their outputs (scatter) are disabled.
To gain a performance boost from adaptive sampling you would probably have to use the dr.compress
or dr.scatter_inc
function to compress the lanes and launch less invocations.
Hope this could help.
Thanks.
I try to launch less invocations. I change the number of adjust_pos (from mi.cornell_box() 65535 to 5 ) and only trace the first [1,3,5,7,9] pixels.
https://github.com/DoeringChristian/mitsuba3-experiments/blob/2e267c953c70bde5912bf2430aabc8e688639cc5/path.py#L53
adjusted_pos1 = dr.fma(sample_pos, scale, offset)
adjusted_pos = dr.gather(type(adjusted_pos1), adjusted_pos1, [1,3,5,7,9], active)
Then I got
The RuntimeError: jit_var_loop_init(): loop state variables have an inconsistent size (5 vs 65536)!
It seems that Mitsuba3 cannot render specific pixels independently?
There will be more variables, passed to the sample
function and used in ghe loop. However as the error message states, all loop state variables have to have the same extent.
I am currently learning how to use Mitsuba3, your code about mitsuba3-experiments are immensely helpful.
I want to achieve this function: manually specify the k ray samples for Pixel at (x, y). For example, set 32 samples for Pixel(1,1) and 4 samples for Pixel(200,200).
I've trying to change codes from your "mitsuba3-experiments/integrators/path.py". In "def sample()", I try to modify the "active" state when adding samples, but I cannot locate sample position at screen (x, y).
Could you please provide guidance or assistance on implementing this feature? Any insights or pointers would be greatly appreciated.