0 votes

make screen flash red in 3d, as in: the player takes damage, so the screen flashes red...

Godot version 3.5.stable
in Engine by (67 points)

1 Answer

0 votes

easiest shader ever.
To apply screen shader to 3d You need to child some ColorRect to root node and extend it to whole screen ( remember to set mouse filter to ignore )
You add material and new shader to ColorRect.
Set up uniform float switch
in fragment() do :

COLOR = mix(vec4(0.0),vec4(1.0,0.0,0.0,1.0),switch)

and now You can turn your blood flash on with

ColorRect.material.set_shader_param("switch",1.0)

and of

ColorRect.material.set_shader_param("switch",0.0)

which You should switch between player being hit and some timer countdown after hit

If You don't know about shaders yet, just check the documentation and my code will become clear to You

by (8,101 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.