Open capnm opened 6 years ago
If I increase sky_custom_fov and then set back to zero the skybox or panorama looks correct. Weird.
In Blender, the background is at least not disturbing and physically theoretically looks more correct. I think it should be set to the maximum FOV value similar to Blender.
The background flickers when you turn the view, but that doesn't seem to be a problem.
The background flickers when you turn the view, but that doesn't seem to be a problem.
I tried that out as I was looking into fixing this, but I think the rapid color flashes when rotating can be problematic for people who are prone to light-induced seizures.
Here's a patch that sets the sky FOV to 0.1 in orthogonal mode when no custom sky FOV is set:
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
index a33c94fbcd..34a8ad2b57 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
@@ -1306,13 +1306,15 @@ void RasterizerSceneHighEndRD::_draw_sky(RD::DrawListID p_draw_list, RD::Framebu
// Camera
CameraMatrix camera;
- if (custom_fov) {
+ if (custom_fov || p_projection.is_orthogonal()) {
+ // Use a very low FOV when using orthogonal projection.
+ // This is more technically correct compared to drawing a stretched out sky.
float near_plane = p_projection.get_z_near();
float far_plane = p_projection.get_z_far();
float aspect = p_projection.get_aspect();
- camera.set_perspective(custom_fov, aspect, near_plane, far_plane);
+ camera.set_perspective(MAX(0.1, custom_fov), aspect, near_plane, far_plane);
} else {
camera = p_projection;
But as I said, it kind of hurts to look at when panning the camera around, especially in panoramas with strong light variations.
@clayjohn @reduz Any opinions on this?
Now when I think about it again, in orthogonal mode it would be better to turn the panorama off for the background and/or make a viewport option for a replacement color.
The background is turned off in the Blender material preview viewport, and you can also turn it off in the render viewport.
The sky in the very default "just opened Godot and created new project" 3D scene seems to have the same problem. When set to orthogonal view, the sun seems to be broken in the same way.
@DDL-Blue Indeed, this issue isn't limited to PanoramaSky. It'll occur with any sky that's not a plain color.
Godot version:
0dbe01483a902c49ecedf4fd36b74353424145a5
OS/device including version:
Linux
Issue description:
Auto/default FOV
The same with a similar custom FOV
Steps to reproduce: Attach a panorama texture to the environment node and press numpad-5.