Emphasize the importance of mipmaps for textureLod() in Screen-reading shaders

This also mentions that reading the normal/roughness buffer is only
currently supported in Forward+.
This commit is contained in:
Hugo Locurcio
2023-10-26 02:25:20 +02:00
parent c1d835834d
commit 9773552257
4 changed files with 23 additions and 10 deletions

View File

@@ -40,8 +40,9 @@ Your scene tree will look something like this:
As of the time of writing, Godot does not support rendering to multiple
buffers at the same time. Your post-processing shader will not have access
to normals or other render passes. You only have access to the rendered
frame.
to other render passes and buffers not exposed by Godot (such as depth or
normal/roughness). You only have access to the rendered frame and buffers
exposed by Godot as samplers.
For this demo, we will use this :ref:`Sprite <class_Sprite2D>` of a sheep.
@@ -60,6 +61,8 @@ shader by `arlez80 <https://bitbucket.org/arlez80/hex-mosaic/src/master/>`_,
shader_type canvas_item;
uniform vec2 size = vec2(32.0, 28.0);
// If you intend to read from mipmaps with `textureLod()` LOD values greater than `0.0`,
// use `filter_nearest_mipmap` instead. This shader doesn't require it.
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
void fragment() {