Closed
Description
Godot version
v4.1.1.stable.mono.official [bd6af8e]
System information
Godot v4.1.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 31.0.15.3713) - Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 Threads)
Issue description
I'm trying to implement a vertex jitter shader to emulate psx style graphics.
See: https://github.com/AnalogFeelings/godot-psx for a public implementation I am using for reference.
The shader should support shadows but there appears to be a bug in Godot that is preventing shadows from appearing.
As far as I can tell, the issue relates to VIEWPORT_SIZE. The shader uses VIEWPORT_SIZE to scale the jitter based on screensize.
Steps to reproduce
- spatial shader
- include render mode
render_mode skip_vertex_transform
- inside the
vertex()
function, - use
VIEWPORT_SIZE
in some part of the calculation of VERTEX.
Minimal reproduction project
See screenshot below:
- A cube with a default material; shadows are displayed correctly
- A cube with a custom material
jitter-not-using-viewport.tres
; shadows are displayed correctly
The custom material essentially just doesVERTEX = round(VERTEX * i) / i;
, where i is set by the user - A cube with a custom material
jitter-using-viewport
; shadows are not displayed correctly
The custom material scalesi
byVIEWPORT_SIZE.y