- Home /
Custom (Sprite-)Shader: Combine Sprite with light and original Sprite
I recently started using light in my 2D game and thus using the shader Sprites/Diffuse (instead of Sprites/Default) for all my sprites.
However, I would like to kind of "limit" the amount of light, a sprite can maximally gain to prevent details from "burning out" in white. (I would not set a hard limit, but probably try to find a mathematical function to work similar to a tone curve in Photoshop/image editing)
I assume, writing a custom shader is the way to go here; I don't have any experience with shader programming yet, therefore my question: Is there any point in the rendering pipeline where I can access two things,
The RGB values of the sprite as determined by all the lighting currently on the sprite (using the Lambert model as Sprites/Diffuse appearantly does)
The original RGB values of the sprite, as if there were no lighting at all
and then return RGB-Values in which I actually want the sprites (or each pixel; if I understand shaders correctly, they are calculating the RGB values for each individual pixel) to be rendered with?
Is there a way to achieve that and could someone point me in the right direction how I could create a shader that basically works like Sprites/Diffuse but allows me "access" like described above?
Thanks for any advice!
Have you tried using Linear Rendering/a Tonemapping image effect? Just saying that it's probably easier if it gets you the look you want.
Your answer
Follow this Question
Related Questions
2D Sprite Shader Acting like Light 0 Answers
Distance based lighting 1 Answer
How can shining model in URP with shader graph 0 Answers
Trying to create 2D pixel art lighting 1 Answer
Lights only sometimes working 1 Answer