Confusion over [[position]] attribute in fragment shader

I’m not in that headspace at them moment, so I am actually slightly puzzled at that code too :slight_smile:.

Looking at the rendered data, shadowPosition is already in NDC due to the orthographic matrix, and the w is set to 1.0, so no point in dividing by it.

The rasteriser does not perform the perspective divide for shadow position. With orthographic matrices there is generally no perspective divide necessary anyway.

xy acts like uv coordinates which are from 0 to 1, and gets the texture data from the shadow map.

1 Like