Pjbomb2 / TrueTrace-Unity-Pathtracer

A passion projects that has been going on for awhile, finally at a place where I feel comfortable tentatively uploading it to Github for others
MIT License
630 stars 44 forks source link

Update "Ray Tracing Object" on material change #13

Closed cpetry closed 10 months ago

cpetry commented 1 year ago

Hello,

in my project I can freely change materials of all dynamic objects. How can I update the "Ray Tracing Object" to re-evaluate or recreate the information there to the actual new material set?

cpetry commented 1 year ago

I figured it out:

Could this update be done automatically ofter "Build Aggregated BVH" please?

Pjbomb2 commented 1 year ago

What do you mean? It should instantly update as long as enable obejct moving is on?

cpetry commented 1 year ago

Well it seems that it does not update when I change material colors. I use materialPropertyBlocks and perhaps this only gets updated when BVH is recalculatd

Pjbomb2 commented 1 year ago

Heyyo, by chance could you provide me some code I could use as an example of how it might be used/how you use it, so I could build a fix around it? Possibly over discord if you can? Also sorry for late reply, lifes calming down finally

Pjbomb2 commented 1 year ago

I think I only just understood what this meant fully... the reason why I havent done this so far is that that would require checking all properties of a material every frame, will look to see if theres a callback I can use tho

Pjbomb2 commented 10 months ago

I have added callable functions that allow you to tell truetrace when a material has changed, as its not performance friendly to check everything automatically unfortunately