Hi all,
these days I was reading about shader, fragments and materials, I wanted to create a shader that changes the screen darker making it so it feels darker.
Now I did not really know how to do it with a shader, I could practice a bit with the examples I found here, which yeah made me realise I will have to read more into OpenGL to really create a Shader. I was reading into it but I did not found away to make a vect4 transparent.
So i decided to create a GO with a sprite and add a black rectangle as sprite and changed its color with like this:
sprite.set_constant("shadow#sprite", "tint", vmath.vector4(1, 1, 1, 0.2))
Is this a viable way for this effect?
How would you do a shader on a quad thats screen size to make it have that effect?
Iām not sure if I fully understand what youāre trying to do, but there might be several ways to approach it. Thereās a good (though possibly a bit old) tutorial on color grading:
Or if you want something like this:
More complex with shadows:
https://github.com/defold/sample-lights-and-shadows
This would describe it the best:
I would like to have a full screen shader like these which makes everything darker. Like if i would put a black sprite over everything and change its ātintā to an alpha value of 0.4. This gives me the same effect basicly.
This is exactly what color grading does. You can combine it with the first shadow tutorial
2 Likes
Ok thank you. i will have a look into it!
I think for this simple effect donāt need to borher with shaders⦠For full screen effect you can use a GUI node and play with its color property - itās a vector4 with āwā component as alpha (opacity).
Maybe you have solved it already but it can help someone else.
1 Like
Thanks yeah the GUI approach seems good for that. I did make a Gameobject instead of a GUI object with the same result. But yeah GUI makes more sense since it always will cover all. the Gameobject i had to add to the player.
Thanks.
1 Like