Skip to content
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

Merged
merged 4 commits into from
Oct 10, 2018
Merged

Add Trilinear Filtering to Octahedral Maps #7126

merged 4 commits into from
Oct 10, 2018

Conversation

OmarShehata
Copy link
Contributor

@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.

@cesium-concierge
Copy link

Thanks for the pull request @OmarShehata!

  • ✔️ Signed CLA found.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

@OmarShehata
Copy link
Contributor Author

@bagnell Just added the check to only do bilinear filtering if OES_texture_float_linear is not available. Should be good now, and our octahedral WebGL 1 reflections look almost indistinguishable from WebGL 2 cube maps with mips!

@bagnell bagnell merged commit 06080ba into CesiumGS:ibl Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants