-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add transmission prerender pass when using KHR_materials_transmission #8623
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks pretty cool :-)
I guess the next steps could be to fill the dispose in ensure that mesh.material.getRenderTargetTextures = null;
is not necessarily set as I am afraid it might break some setups.
Then we could go in a deeper review ?
I am also wondering at what extend we could rely on our realtime filtering feature to ensure an accurate roughness ? |
I also wonder if it should be derived into ScreenSpaceRefraction as we are doing for reflection as it can be extended to standard mat ? I know it is a lot of questions but I love the idea very much !!! |
I've added |
yup it is only at the material level as we did not split refraction from reflection in this mode which is smthg I could add later. I bet the error comes from texture 2d not being supported at the moment (only cube) but it would be so awesome to introduce this part :-) |
It would be great to have this for 2D refraction textures, for sure. |
We have some checks issue (mostly doc and linting) |
…tart it automatically when transmission is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly nitpick comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. @sebavan Do you want to look at it further?
Actually, @MiiBond, what is calling dispose on the transmission helper ? I am wondering if it would not leak ? |
@sebavan the helper has global scope and only one should ever be created. We don't want it to be cleaned up when the loader is and we don't want another one to be created when another loader is. |
@MiiBond I was thinking on scene.dispose, should we add a scene.onDisposeObservable to call the helper dispose function ? |
@sebavan Quite right. I'll open another PR. |
To better support transmission as defined in the glTF
KHR_materials_transmission
extension, here's an example of a Helper that can setup the rendering of the opaque scene behind the transmissive object(s).To enable it, add this line:
var transHelper = new BABYLON.TransmissionHelper({renderSize: 1024}, scene);
Currently, transmissive surfaces just show the IBL through them like shown here:
With the helper running, transmissive surfaces will show the opaque scene behind instead:
Looking for feedback. Is this even the right way to handle this issue?