diff --git a/docs/rendering.md b/docs/rendering.md index 55f06c3..47ee8ba 100644 --- a/docs/rendering.md +++ b/docs/rendering.md @@ -47,19 +47,22 @@ Vector3 sim_to_render(Vec3 pos, double scale) { - Optimized for solar system scale - Used for position transformations -**Size Scale:** `1e-9` (same as distance scale) -- Applied to body radii -- Minimum visible radius: 0.5 units (ensures tiny bodies are visible) +**Size Scale:** `0.02` (logarithmic radius scaling factor) +- Applied to body radii using logarithmic scaling +- Minimum visible radius: 0.01 units (ensures tiny bodies are visible) **Radius Scaling:** ```cpp float scale_radius(double radius, double scale) { - float scaled = (float)(radius * scale); - float min_radius = 0.5f; + float scaled = (float)(scale * log10(radius)); + float min_radius = 0.01f; return (scaled > min_radius) ? scaled : min_radius; } ``` +Uses logarithmic scaling to handle extreme radius ranges (1.5M to 700M meters). +Scale factor 0.02 produces: Sun ~0.18, planets 0.13-0.16, moons 0.12-0.13 render units. + ## Camera System ### Camera Setup diff --git a/src/renderer.cpp b/src/renderer.cpp index 230f817..acbdd63 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -87,7 +87,7 @@ void setup_camera(RenderState* render_state) { render_state->camera.projection = CAMERA_PERSPECTIVE; render_state->distance_scale = 1e-9; - render_state->size_scale = 1e-9; + render_state->size_scale = 0.02f; render_state->texture_loaded = false; render_state->spacecraft_texture = (Texture2D){0, 0, 0, 0, 0}; @@ -248,8 +248,8 @@ Vector3 sim_to_render(Vec3 pos, double scale) { // Scale a radius for rendering (with minimum visible size) float scale_radius(double radius, double scale) { - float scaled = (float)(radius * scale); - float min_radius = 0.5f; // Minimum visible radius + float scaled = (float)(scale * log10(radius)); + float min_radius = 0.01f; // Minimum visible radius return (scaled > min_radius) ? scaled : min_radius; }