-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fix refraction and material transitions. #1673
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); | |
// } |
@@ -539,9 +557,14 @@ public boolean enterBlock(Scene scene, Ray ray, BlockPalette palette) { | |||
ray.distance += distance; | |||
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.
?
@@ -484,6 +500,8 @@ public boolean enterBlock(Scene scene, Ray ray, BlockPalette palette) { | |||
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
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: