Open GensokyoLover opened 1 year ago
I'm confused as to what you're trying to do. I'm not entirely sure this is even supported.
I'm trying to calculate the radiance of each Emitter to result image. So when Loop calculating Emitter sampling contribution, i called Emitter->put(pos,aov) to store the radiance in corresponding location of emitter's imageblock
and for this reason I init the emitter's imageblock in integrator.cpp and add a varible(const Vector2f& pos) in Integrator::sample method comparing to the old version
Hello,I further tested and found that the reason for this error is the atomic addition operation in ImageBlock. When I remove dr::scatter_reduce in ImageBlock::accum, the program can be compiled by drjit. So does mitsuba support atomic operations in Loop? Thank you for your time
Hello,I further tested and found that the reason for this error is the atomic addition operation in ImageBlock. When I remove dr::scatter_reduce in ImageBlock::accum, the program can be compiled by drjit. So does mitsuba support atomic operations in Loop? Thank you for your time
------------------ 原始邮件 ------------------ 发件人: "Nicolas @.>; 发送时间: 2023年4月3日(星期一) 晚上10:08 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [mitsuba-renderer/mitsuba3] Failed to parse input PTX string When EmitterPtr called my custom function in PathIntegrator::sample (Issue #633)
I'm confused as to what you're trying to do. I'm not entirely sure this is even supported.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
It is supported. The issue here, I believe, is that the individual Imageblock
objects of each emitter should be part of the loop's state variables. Since you need to read and write to them at every loop iteration (scatter_reduce
operation) they should be state variables.
This is not an obvious fix, especially in your current setup where the emitters hold the ImageBlock
objects. Then again, it shouldn't even be the ImageBlock
but rather the underyling tensor (ImageBlock::tensor()
) that should be passed to the loop.
Obviously the number of these tensors dynamically varies with your scene, so you can't pass them all through the Loop constructor. You'll have to use Loop::put()
.
Honestly, I'm not quite sure this is all supported. You might just want to loop over all your emitters and render with only one of them "turned on" at each iteration.
I tried and still failed. First time,I tried to put ImageBlock::tensor() but received a error--"tensor dont have index_ptr". So i turned to put ImageBlock::tensor()::data() and this time mitsuba reported "Caught a critical exception: jit_var_loop_init(): loop state variables have an inconsistent size (480000 vs 15360000)!" in jitc_var_loop_init fuction. Finally i tried to remove the jitc_raise method in that function and received another jit_raise "Caught a critical exception: jit_var_scatter(): cannot scatter to a placeholder variable!". Your Advice is pretty good to achieve the single light film,but our scenes has a lot of light sources. So we are trying to render all of the lights at once.
The jit_raise about inconsistent size seems only allow the data structure whose size is equal to the number of total samples.
Oh, I hadn't thought about the size conflict initially, sorry.
I think this is not something we can support currently in recorded loops, it breaks the parallelism model. You can use a normal cpp loop instead of the DrJit loop in the sample
method. This should work, albeit with a performance cost.
Summarize
I want to add a function in Emitter to be called when rendering to calculate the contribution of each Emitter. When called by Emitter* in SamplingIntegrator::render_sample function, it succeeded. But it failed in path::sample function when called by EmittPtr. I am wondering why it failed. This has bothered me for a long time. Thank you so much for your time.
System information:
OS: win10 CPU: i5-9400F GPU: nvidia 1660S Python: 3.9 NVidia driver: 528.33 CUDA: 12.0
Dr.Jit: 0.4.1 Mitsuba: 3.2.1 Is custom build? False Compiled with: vs2022 x64 Variants: scalar_rgb cuda
reproduce
command
function and varible added in Class Emitter
where the function is used