Color blending help
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Gunroar:Cannon()
- Party member
- Posts: 1144
- Joined: Thu Dec 10, 2020 1:57 am
Color blending help
I have a light system that changes the alpha value of items depending in how far they are away from light. The problem is that they appear see through when far and infront of an object. I know I could instead multiply the color of the item by its alpha value and set BlendModeAlpha to "premultiplied" but I was hoping there was another solution that doesn't involve touching the item's color.
- Gunroar:Cannon()
- Party member
- Posts: 1144
- Joined: Thu Dec 10, 2020 1:57 am
Re: Color blending help
Is it that my request doesn't make sense or ... (I see how it might not make sense)
Like picture 1 is drawn.
Then I want to draw another picture (2) on top of that one but darker just by changing opacity only.
But now picture 1 can be seen through picture 2.
Any fix?
Like picture 1 is drawn.
Then I want to draw another picture (2) on top of that one but darker just by changing opacity only.
But now picture 1 can be seen through picture 2.
Any fix?
Re: Color blending help
Show pictures what you have and what you want.
- Gunroar:Cannon()
- Party member
- Posts: 1144
- Joined: Thu Dec 10, 2020 1:57 am
Re: Color blending help
Ahhh... getting a screenshot currently would be kind of inconvenient ... but I have this picture:
Where the transparent boos (ghosts) are what I'm getting but I just want them to be the same dark shade while not being see-through. Is it possible?
Where the transparent boos (ghosts) are what I'm getting but I just want them to be the same dark shade while not being see-through. Is it possible?
Re: Color blending help
I'm not sure if I understand your problem, but couldn't you just render the darker sprites to a separate canvas and make the whole canvas transparent instead of every single sprite?
Re: Color blending help
To render a sprite darker, but without any transparency, I think you could just set the red, green, and blue values before you draw whatever you want to draw, and then reset the color back to normal. If you don't want your sprites to be "see through", then there's no need to mess with alpha values at all. I hope this is sort of what you are going for.
Code: Select all
function love.draw ( )
--less color saturation should result in whatever is drawn
--appearing darker.
love.graphics.setColor (0.5, 0.5, 0.5)
--draw your darker ghost here
love.graphics.setColor (1, 1, 1)
--whatever is drawn after this will be drawn normally.
end
- Gunroar:Cannon()
- Party member
- Posts: 1144
- Joined: Thu Dec 10, 2020 1:57 am
Re: Color blending help
Yes. that achieves what I wanted, but the thing is I was cheap.
I used a variable that holds the alpha value so I could change a creative's light just by alpha and told myself "I'm sure there's a way to make it so the alpha doesn't actually make it see through using shaders, blendmodes, or something". Oh well.
I used a variable that holds the alpha value so I could change a creative's light just by alpha and told myself "I'm sure there's a way to make it so the alpha doesn't actually make it see through using shaders, blendmodes, or something". Oh well.
Who is online
Users browsing this forum: Ahrefs [Bot], Amazon [Bot] and 5 guests