Skip to content
Discussion options

You must be logged in to vote

Hi @qnzhou,

One approach is to leverage dr.dispatch to achieve what you're after:

def custom_eval(self, other_args):
    if self.is_mesh():
        verts = mi.traverse(self)['vertex_positions']
        # perform computation here
        return final_output
    return mi.Float(0)

dr.dispatch(si.shape, custom_eval, other_args)

where other_args could be other input you need to compute your evaluation.

It's not ideal to repeatedly call mi.traverse so you could alternatively cache the mapping of shapes to vertices/faces

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@qnzhou
Comment options

Answer selected by qnzhou
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants