Skip to content

Commit

Permalink
Add rings radius to renderable body radius
Browse files Browse the repository at this point in the history
When we have a satellite close to the planet then its rings and the planet
itself is not visible (it has centerZ > 0) but the rings are visible
Celestia incorrectly sorts render list for solar system object because
it uses objects' farZ which is computed as centerZ - radius. So when
the satellite is too close and the planet is "behind" such computation
gives a result that the satellite is further then the planet (centerZ for
the satellite < 0, but for the planet > 0) As a result depth partitions
are incorrectly computed and we have a close object (the satellite) and
a distant object (the planet) in the same depth partition. And this
partition has huge farZ/nearZ (> 1e6). Such huge difference between
the near and the far plans gives rendering artifacts.

To fix this we should take into account rings radius when calculating
render item radius.
  • Loading branch information
375gnu committed Nov 10, 2023
1 parent dd627cc commit eeffce5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/celengine/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3245,6 +3245,8 @@ void Renderer::addRenderListEntries(RenderListEntry& rle,
rle.isOpaque = true;
}
rle.radius = body.getRadius();
if (body.getRings() != nullptr)
rle.radius += body.getRings()->outerRadius;
renderList.push_back(rle);
}

Expand Down

0 comments on commit eeffce5

Please sign in to comment.