- 
                Notifications
    You must be signed in to change notification settings 
- Fork 81
Fix refraction and material transitions. #1673
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
base: master
Are you sure you want to change the base?
Fix refraction and material transitions. #1673
Conversation
| I would suggest changing  | 
| if (currentBlock.refractive) { | ||
| //ray.setCurrentMaterial(currentBlock.waterlogged ? Water.INSTANCE : Air.INSTANCE); | ||
| } | 
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.
Either remove this or comment it alltogether.
| if (currentBlock.refractive) { | |
| //ray.setCurrentMaterial(currentBlock.waterlogged ? Water.INSTANCE : Air.INSTANCE); | |
| } | |
| // if (currentBlock.refractive) { | |
| // ray.setCurrentMaterial(currentBlock.waterlogged ? Water.INSTANCE : Air.INSTANCE); | |
| // } | 
| distance = 0; | ||
| if (currentBlock.intersect(ray, scene)) { | ||
| if (prevBlock != currentBlock) | ||
| if (prevBlock != currentBlock) { //|| (currentBlock.refractive)) { | 
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.
?
| int depth = implementation.getDepth(); | ||
|  | ||
| double distance = 0; | ||
| //tread air as a null block depending on octreetype and were we are in the trace | 
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.
| //tread air as a null block depending on octreetype and were we are in the trace | |
| // Treat air as a null block depending on octreetype and were we are in the trace | 
2d41b57    to
    2c076c8      
    Compare
  
    2c076c8    to
    ee0b2c6      
    Compare
  
    | Given that #1830 seems to replace this PR, I'd like to maybe merge this into 2.5.0 but not 2.6.0? 🤔 @Peregrine05 and @ConsueTerra, what do you think? What's the difference between the fixes in #1830 (which I still refuse to figure out due to the vast amount of unrelated commits) and this PR? | 
This PR fixes #1515, in a way that is less hacky than #1601 by defining octree type and modifying the intersection logic based on which octree we are in. Also recovers total internal reflections. This is because Air has different contexts depending on location. Current changes fix solid block refractions, and partially addresses sub block refractions like glass panes. Currently I cant figure out a good methodology for fixing glass panes that does not break intersection logic. Additionally there are quite a few edge cases to consider like partially water logged glass panes.
Now this makes for some weird views, dont know if these are correct but the above tests makes it seems so, in any case that is a function of refraction and Fresnel code than intersection code

Glass panes are still wrong example:
