godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.76k stars 21.12k forks source link

writing to `POSITION` gives wrong `VIEW` in fragment shader #98362

Open darthLeviN opened 1 week ago

darthLeviN commented 1 week ago

Tested versions

stable 4.3

System information

Kubuntu 22.04

Issue description

If you write to POSITION to make a full screen post processor, then your VIEW vector will become invalid and you have to calculate it manually. What i observe that if i write to POSITION then the VIEW variable will become affected by camera translation.

Steps to reproduce

write to POSITION

Minimal reproduction project (MRP)

viewbugreport.zip

tetrapod00 commented 1 week ago

Possible docs fixes:

darthLeviN commented 1 week ago

Possible docs fixes:

so this is a limitation not a bug? is the wrong value of VIEW used for something else?

tetrapod00 commented 1 week ago

Likely a limitation and not a bug. I'm not sure since I haven't looked at the source just yet. From the Advanced Postprocessing page:

POSITION bypasses the built-in transformations and sets the vertex position in clip space directly.

From that, I would expect that setting POSITION in vertex() probably would not affect the automatically calculated VERTEX or VIEW in fragment(),