godotengine / godot-demo-projects

Demonstration and Template Projects
https://godotengine.org
MIT License
5.65k stars 1.58k forks source link

Add demo showing the use of RenderingEffects to do post processing #942

Closed BastiaanOlij closed 3 months ago

BastiaanOlij commented 1 year ago

Adding a demo to show the use of RenderingEffects to create post processing. Implements https://github.com/godotengine/godot/pull/80214

This is still a pretty simple example, will work on making this more elaborate at some point.

image

BastiaanOlij commented 11 months ago

Next to the very simple grayscale example I've added a work in progress, and not working correctly yet, Stocastic SSR implementation.

Decided to already push this in as it's a much bigger example on how to create different type of passes, how to create additional buffers, how to obtain state around the rendering, and how to do a raster pass.

image

Ansraer commented 11 months ago

While trying the hooks PR yesterday, I noticed that you use float gray = max(max(color.r, color.b), color.g); in your grayscale shader. However, given that the human eye is far more sensitive when it comes to detecting green colors, the correct way to get luminance should be something along the lines of color.r * 0.2125 + color.g * 0.7154, color.b * 0.0721;

Which reminds me, I need to go through the built-in godot shaders. We use this strange max approximation way too often.

BastiaanOlij commented 11 months ago

@Ansraer , changed the grayscale logic :)

Calinou commented 3 months ago

I've updated the demo for 4.3.dev6 by pushing an additional commit, which incorporates @AThousandShips' suggestions. The demo works out of the box now.

However, I get error spam when MSAA 3D is disabled in the project settings (despite the scene rendering correctly):

 Image (binding: 0, index 0) needs the TEXTURE_USAGE_STORAGE_BIT usage flag set in order to be used as uniform.
  servers/rendering/renderer_rd/uniform_set_cache_rd.h:130 - Condition "rid.is_null()" is true. Returning: rid
  servers/rendering/rendering_device.cpp:4092 - Parameter "uniform_set" is null.
  Uniforms were never supplied for set (0) at the time of drawing, which are required by the pipeline.
  Image (binding: 0, index 0) needs the TEXTURE_USAGE_STORAGE_BIT usage flag set in order to be used as uniform.
  servers/rendering/renderer_rd/uniform_set_cache_rd.h:130 - Condition "rid.is_null()" is true. Returning: rid
  servers/rendering/rendering_device.cpp:4092 - Parameter "uniform_set" is null.
  Uniforms were never supplied for set (0) at the time of drawing, which are required by the pipeline.

PS: Is there a way to prevent the reflection from showing up on the sky? I've tried decreasing Max Distance in the SSSR effect but I need to decrease it to a very low value to prevent this, which breaks the reflection on other objects.

BastiaanOlij commented 3 months ago

This has been replaced by #1058