I’m pretty clueless when it comes to shader coding and I’m wondering if someone could help me fix what I currently have. I want to build a shader that I’ll use with my projector and it’ll just project the image exactly as it is in terms of colors and opacity, nothing more, nothing less. I’ve been searching all over the internet for some examples to see if I could find one that I could just tweak but haven’t been all that lucky. I did however find one that’s pretty close. Btw, these will be used on a mobile game so I’m trying to make them as simple as possible without any extra features to save performance. I’m trying to project a circle that indicates a “hero unit” and a shadow in the middle of it. Bellow is what it currently looks like:
The image in the corner is what I’d like to project. Here’s my current code:
I’m guessing for someone who can code shaders this isn’t anything difficult but to me it’s all Chinese. If anyone could help me, I would really appreciate it. I’d also like to remove that extra functionality at the end with the “Distance attenuation”. What it does is it makes it so based on distance the image fades out. Since I’m trying to make it as simple as possible that’s not really needed. Thanks in advance!
I think your main change is to have changed the Blending mode (Blend OneMinusSrcAlpha SrcAlpha), then you removed the distance attenuation and tint to keep the texture with the saem color as it comes.
The image you posted was white because you were using additive blending.
I ended up finding one which after some “random” edits to see what happens turned out to do what I was looking for. Unfortunately I’m not entirely sure what the code does or how I could simplify it even more, but it seems to do the job for now. If anyone knows how this code could be simplified even more, that would be awesome!
@stefanplc I can’t thank you enough for your posted shader as I have been searching the internet and asking around and noone was able to help on that so awesome work!