-
-
Notifications
You must be signed in to change notification settings - Fork 21.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 Texture Smooth Pixel Filter property to BaseMaterial3D #88650
base: master
Are you sure you want to change the base?
Add Texture Smooth Pixel Filter property to BaseMaterial3D #88650
Conversation
I'll be shocked if this doesn't make it in seeing as so many games use it. Having to hack around with shader material is a pain, especially since it makes it tough to use the 3D sprite nodes. This is much better... |
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.
Docs are just fine and say all you need to know about it.
The feature itself is highly requested for games with this art-style. Even me and a group of friends could actually make use of this.
818cb20
to
3e65973
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
@PerikiyoXD Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead. |
When enabled, this displays the texture with an appearance that mimics nearest-neighbor filtering with a shader to smooth out aliasing between pixels. This can be used for a pixel art look that is still antialiased regardless of the current antialiasing method in use. This is also available in SpriteBase3D and Label3D.
3e65973
to
3827d6b
Compare
This was discussed a while ago in a rendering meeting under @clayjohn 's discretion (I believe?). The meeting notes about this are as follows:
Just putting these here for safe-keeping. I hope you're taking notes too, Calinou! Cheers! |
What do you mean by Also, how can I get rid of
Sounds good, it might be worth creating a dedicated proposal for this though, as I feel this is out of scope for this particular PR. |
Ya, just a wrapper function for texture sampling so that the code isn't duplicated every time you want to sample a texture.
texture size should be passed in as a uniform |
When enabled, this displays the texture with an appearance that mimics nearest-neighbor filtering with a shader to smooth out aliasing between pixels. This can be used for a pixel art look that is still antialiased regardless of the current antialiasing method in use.
This is also available in SpriteBase3D and Label3D. This could also be implemented in Decal (via a project setting to toggle it for all decals), but this may be left to a future PR as it's more complex.
Thanks to @CptPotato for providing the shader code 🙂
Testing project: test_smooth_pixel_filtering.zip
Preview
On Label3D (alpha transparency) and SpriteBase3D (alpha scissor transparency, so only the internals are smoothed out):
Without mipmaps
Watch videos in fullscreen to avoid aliasing (viewport resolution is 1280×720, but videos are 3840×2160).
Disabled
nearest.mp4
Enabled
smooth_pixel_filter.mp4
With mipmaps + 16× anisotropic filtering
Disabled
nearest_aniso.mp4
Enabled
smooth_pixel_filter_aniso.mp4