#Any way to acheive shadows like this ?

1 messages · Page 1 of 1 (latest)

spring kestrel
#

I know there is no way to acheive Point filtered shadows in HDRP using the default unity shaders/shadows, how could i go about making something to have pixelated shadows like the image ? Would i need to change the object's shaders ? or something about the lights ? or the render pipeline code itself ? i just need indications on where i should look in the first place

thick sphinx
#

I've answered you in the dicussions thread.

spring kestrel
#

thank you ^^"

spring kestrel
#

there is in fact a way :D
its not antialisaed like the picture but it works anyway

thick sphinx
#

I've answered again on discussions ^^
I think there might be a solution to have a "pixelated filtered shadow", by keeping the PCF_Tent_3x3 method, but use a point sampler state inside it.

spring kestrel
#

In discussions again
Couldnt make it work :(
all the shadows are broken

thick sphinx
#

I answered again, with actually trying it on my side and gave you a solution.
I think this is what you want now :

spring kestrel
#

This is perfect, thank you

spring kestrel
thick sphinx
spring kestrel
#

i did turn off soft shadows, but they are still bilinearly filtered and not point filtered

spring kestrel
thick sphinx
#

L332 is where the shadow is sampled when softshadows are off.
I guess you just have to change the sampler state, like for HDRP.

spring kestrel
#

i test it and i come back

spring kestrel
#

huh
I added a step 0.5 around the function but its not exactly what i expected

attenuation = step(0.5, real(SAMPLE_TEXTURE2D_SHADOW(ShadowMap, sampler_ShadowMap, shadowCoord.xyz)));

Im not sure if i can change the sampler state, i assumed i couldnt like in hdrp but Im gonna try anyways
Sorry if im really slow its a lot of trial and error lol

spring kestrel
#

got it !
ill be honest i had to use chatgpt for help but it did figure it out after a lot of handholding damn

basically, replace line 332 with

        attenuation = shadowCoord.z >= shadowDepth ? 1.0 : 0.0;```
spring kestrel
cinder mirage
#

Minecraft's shadows are not exactly point filtered
They are soft but snapped to world coordinate grid, or texture UVs (times two) like this, no difference if the world is a voxel grid

spring kestrel
#

Oh damn
I might try doing it in shadergraph, it looks cool
Thank you!