-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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
TSL: add support for interpolation type qualifiers such as centroid
#30576
Comments
I'll try implementing this. Do you have a specific project or test case we could test the implementation against? |
Amazing @cmhhelgeson! I'm happy to help however I can. I can share a voxel demo that uses WebGPURenderer and exhibits an issue that should be mitigatable with https://codesandbox.io/p/devbox/8vxpqg I can put this on github or create a more minimal javascript example if that's helpful - let me know. |
Here's a more minimal demo that we can use:
|
I was able to get the centroid interpolation working on my bitonic compute. I'll try your sample tomorrow. |
Here's a port of your example with a toggle to switch between centroid interpolation sampling and the default interpolation sampling. [Live WebGPU Example](https://raw.githack.com/cmhhelgeson/three.js/cmh/centroid/examples/webgpu_centroid_sampling.html I think your Minecraft example would be a good example for the webpage with a larger bounding box and some camera movement, as the parallax of the seams would make the difference between the interpolation more obvious. For now, I'm going to create a branch that simply implements the change without any associated sample. |
Thanks for working on this @cmhhelgeson! If a voxel example for this would be useful I'd be happy to create a simplified javascript version as a follow up. The linked demo has some features that aren't strictly relevant to a more minimal demo, if that's what we want to optimise for (eg voxel ambient occlusion calculation, color and texture block face texture atlas building). If the goal is to have a general voxels example that's all probably fine, but if the goal is to have a minimal demo for this it may be too much. |
Description
It appears it's not currently possible to create a varying with TSL with a interpolation type qualifier, for example in GLSL,
centroid
.In three.js WebGLRenderer projects I have used centroid to work around issues with texture bleeding when using texture atlases with MSAA.
Solution
Consider exposing common interpolation qualifiers via TSL.
I don't have good concrete API suggestions, but here's a simple example of how I'd use this:
Alternatives
Some other general API for exposing common qualifiers.
Additional context
GLSL: Center or Centroid? (Or When Shaders Attack!) - https://opengl.org/pipeline/article/vol003_6
https://www.w3.org/TR/WGSL/#interpolation-sampling-centroid
The text was updated successfully, but these errors were encountered: