-
Hi, I have a custom BSDF with textures (BitmapTexture) and try to optimize their values in a optimization loop. Checking the scene parameters, I see that they are flagged as differentiable as well as the corresponding data of the BitmapTexture. But I get the following error at the dr.backward call:
The scene parameter is:
The texture data is:
Could you please tell me how to properly optimize brdf texture in this case? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi @osylum Sounds like you might not be updating the scene parameter after you've created the optimizer:
Basically the scene parameters need to be aware that the optimizer is tracking its gradients. This line |
Beta Was this translation helpful? Give feedback.
-
I added both params.update(opt) and scene_params.update(opt) after setting the optimizer parameters with the same error:
|
Beta Was this translation helpful? Give feedback.
-
sure, I upated the style for the errors. I had followed the tutorials. But in my case, there is a difference as compared to the tutorials or your example. In your example, mi.traverse(scene), the texture to update is there:
In my case, when using scene_params = mi.traverse(scene), the parameter I want to access shows up as:
and need to further traverse this parameter to access the data, as param = mi.traverse(scene_params['object.bsdf.nested_bsdf.rho_d']):
|
Beta Was this translation helpful? Give feedback.
-
Great! now I can see it in the scene_params list:
and do not get an error during the call to |
Beta Was this translation helpful? Give feedback.
(Please format your answers with code blocks for error messages, and answer in the same thread. It makes it easier to read and to follow for myself and anyone else coming across this thread).
I don't understand why you have duplicate scene parameters. Please follow the tutorials, they serve as a great starting point.
I put together a minimal texture optimisation script here: