[Solved/Workarounded] Making the DLSR renderer ignore selected pixels?

So in my endeavour to make the lighted material unlit at certain pixels I’ve used the glowmap texture to ignore lighting when the value is 1 and display lighting when it’s 0 (and interpolate in between).

This works really well and is super sharp compared to the bloom filter, buuut…

then the DLSL comes along and shits shadows all over everything.

Now what I’d need is a way to make the dlsr treat pixels as ShadowMode.Cast instead of ShadowMode.CastAndReceive depending on object’s material’s glowmap.

Sounds to me I’ll need my own version of the AbstractShadowRenderer to make it point at a modified version of the PreShadow and PostShadow shaders?

So @nehon (since you wrote the dlsr) and anyone else that would know, would this sort of thing be possible? And if you have any tips on how to approach it I’d greatly appreciate it since I’m sort of lost at the moment.

P. S.
In case this turns out to be completly unviable and impossible I can use the modified Lighting.j3md in tandem with the bloomfilter as it gives a decent result:

The modified shader makes the areas sharper (and makes the text readable from afar) and the bloom filter makes them brighter.

So tell me if this is just a mad idea so I can just leave the setup as it is and call it a close enough.

1 Like

You could edit the shadow techniques in Lighting.j3md to point to a custom fragment shader that mask the output with your glowmap

Oh, that makes more sense! Would it be the PreShadow, PostShadow or PostShadow15? I assume the PostShadows are for the shadow post filter and the preshadow for the dlsr?

To me it seems that the PreShadow technique takes care of discarding the pixels that are not shadowed and return a white output for everything else

So probably you only need to edit this one, you can try to add discard; at the beginning and see if shadows disappear.

O-kay it seems that it doesn’t affect the dlsr and merely messes with the material lighting which I already have sorted.

The PostShadow looks more like the thing, with words like PSSM inside :stuck_out_tongue: .

What is the final code you are trying?

I already deleted it, but what it did was discard the pixel if the glowmap value was > 0.5. Tried with < 0.5 too and messed with some other values like 0.9/0.7/0.3 etc.

Ahh wait, :stuck_out_tongue: this prevents things from casting shadows, while you want to prevent things to receive them, then yes, it might be the post shadow.

1 Like

I still can’t tell if it’s the PostShadow or PostShadow15. The code looks about 80% the same, though the 15 has an outFragColor parameter that it writes to and the other one does it straight to the gl_FragColor.

PostShadow15 supports multisampling and is used if you card supports GLSL>=1.50 (gl_FragColor is deprecated since 1.30) , so you would have to edit both of them if you don’t want to cut prior opengl3 support or multisampling.
I saw this in almost every filter, but i’m not sure why this way is preferred over GLSLCompat and __VERSION __ checks that would allow to support everything without duplicating the code…

Good, managed to fetch the texCoord in and it’s working now but I can only make the spots darker instead of deleting the shadows for some reason.

Any idea what these frags are supposed to return? vec4(0) for max shadow and vec4(1) for no shadow?

Try to return color

What you have there is the filter I think, but yes I’ll just pass the diffuse map in and use that :slight_smile:

you’re going to have a hard time with this…
one way could be to pass the highlights to the shadow post pass so that shadow is not rendered in those area… but it’s complicated because you’d need mrt and stuffs like that… which can potentially reduce your user base…
IMO your best bet is the bloom filter…

Ah true, I’ve just looked into it, and you are right, it seems from this line

That no shadow = vec4(1) , don’t know why it doesn’t work… maybe try to call discard instead, or yeah you could use the post filter that looks a lot easier to understand.


@RiccardoBlb @nehon you guys were saying?

Why even turn off the shadows when you can multiply the diffuse 4 times where the shadow shades it so it bleeds through like a freaking lightbulb. :laughing:


Hehheheeh well done mate :wink:

1 Like

For thinking outside the box

1 Like