Zylann / godot_atmosphere_shader

Planet atmosphere shader for Godot Engine
Other
89 stars 7 forks source link

Outer atmo ring disappears under orthographic camera #5

Open Sabrejack opened 3 months ago

Sabrejack commented 3 months ago

Hello, thank you for implementing this atmo shader.

When viewing the atmosphere effect from a far distance under an orthographic camera, it seems to get drawn at double size. Any thoughts?

image

Zylann commented 3 months ago

The shader wasn't designed to work with orthographic projection, projects I use it in are all perspective. Something probably needs to be tweaked in areas that use the projection matrix, or maybe the projected plane, but I'm not sure what. In Godot 4.3 it doesnt render at all. I wouldn't think of ortho to somehow double the scale of things when perspective doesn't. No clue about the planet rendering on top of it either. Also your issue title doesn't reflect what you're describing?

Sabrejack commented 3 months ago

Sorry about the title, at first it looked like it was disappearing but it was just being drawn larger than the box. image

with force fullscreen, I get this image

and this is with planet radius set to 0.5: image

Anyway, thanks, I'll see what I can figure out.

Zylann commented 3 months ago

Note also that if you are testing with Godot 4.3, there is a pending change to handle reverse-Z that I havent pushed yet because Godot doesnt have a define yet to test if reverse-Z is present or which version of Godot is used.

Sabrejack commented 3 months ago

Thanks. In this case, we are still on 4.1.

I did notice a bug about INV_PROJECTION_MATRIX in orthographic mode, as well, so I tried substituting inverse(PROJECTION_MATRIX) but that wasn't it. I'll keep at it for now.