-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 Trilinear Filtering to Octahedral Maps #7126
Conversation
Thanks for the pull request @OmarShehata!
Reviewers, don't forget to make sure that:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
} | ||
else | ||
{ | ||
coord.x *= (textureSize.y / textureSize.x); | ||
} | ||
|
||
return texture2D(projectedMap, coord).rgb; | ||
// Do bilinear filtering | ||
vec3 color1 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb; |
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 should only happen if the OES_texture_float_linear
extension isn't available. Do you have that extension available?
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.
I do have that extension available. Should it just return return texture2D(projectedMap, coord).rgb;
in that case?
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.
Yes. You can disable it for testing in Context.js
. Comment out the line that requests that extension.
@bagnell Just added the check to only do bilinear filtering if |
@bagnell the good news is the octahedral specular map in WebGL 1 and the original cube map in WebGL 2 now look identical* !
* Identical for lower mips, small differences in higher mips.
I noticed the Z axis was reversed in the projection. And I also need to swap the positiveY with the negativeY faces when constructing the cube maps, I'm not sure why exactly (but I updated the gallery/Hello World example to reflect that).
Finally, I added trilinear filtering. Note that it they do look identical even without the trilinear filtering, but without it any values in between the current ones in the sphere will pop/be discrete as opposed to be a gradual change.