Skip to content
Discussion options

You must be logged in to vote

Sorry, I responded too quickly.

You are correct. dr.backward and dr.forward are just aliases for, respectively, dr.backward_from and dr.forward_from. Both functions set the variable's gradient to 1 before propagating.

Here's my corrected suggestion:

import mitsuba as mi
import drjit as dr

mi.set_variant('cuda_ad_rgb')

scene_description = mi.cornell_box()
scene_description['integrator']['type'] = 'prb'
scene = mi.load_dict(scene_description)

params = mi.traverse(scene)
key = 'red.reflectance.value'

prev_value = params[key]
new_value = mi.Color3f([0, 0, 1])

params[key] = new_value
params.update()
ref_img = mi.render(scene, params=params, seed=0xDEADBEEF)

params[key] = prev_value
dr.en…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ryukang
Comment options

@njroussel
Comment options

Answer selected by njroussel
@ryukang
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants