mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-12 02:01:29 -10:00
Raytraced shadow penumbras needed a hand-authored $SunAngularSize: in stars.tbl, which no shipped content sets -- so in practice nothing ever got a penumbra, and the shadow-mapped path's $Shadow Smoothness Factor: had no relation to it at all. Derive a size from the sun bitmap instead and drive both methods from the same number. g3_render_rect_screen_aligned_2d() sizes the sun quad so its rad is the tangent of the half-angle it subtends, making tan(angular radius) equal to 0.05 * the mission's +Scale: * the emitting disc's fraction of the bitmap. That fraction is the area of the pixels at or above 90% of the brightest one, converted to an equivalent radius. Across 90 sun bitmaps from retail, the MediaVPs, Blue Planet and BtA it lands at a median of 0.261 (retail's chunkier art at 0.487), and the threshold acts as a constant factor rather than a per-bitmap judgement call -- Spearman rho 0.96 between a 90% and a 50% cutoff. Taken literally that yields suns 3.9-8.5x Sol's apparent diameter once +Scale: is folded in (median 1.55, up to 5.0 in retail's own missions), so the measurement is scaled by 0.25 and clamped to 1.5 degrees, putting typical content near Sol. Derivation is the default: $SunAngularSize: 0 asks for hard shadows, an explicit value still wins, and missions can also set +AngularSize: on an individual sun to override both, with FRED and QtFRED UI (validation and fallback included) to author it. Bitmaps that can't be read -- and the deliberately blank sun bitmaps mods ship to get a light source with no visible disc -- fall back to hard shadows rather than to the widest possible penumbra. That angular size now sizes the raytraced penumbra cone directly (traceShadowRayCone() in shadows.sdr), with sample count following the same Shadow_quality tier that picks the shadow map's resolution (1 ray at Low, up to 16 at Ultra) rather than being a separate setting. The shadow-mapped path's tabled smoothness values were tuned by eye against Sol-sized retail/MediaVPs art, so shadow_smoothness_scale() in shadows.cpp scales them by the active sun's size relative to Sol, clamped to what the shadow map can represent (shadow_clamp_smoothness()). The two methods still disagree about occluder distance -- the raytracer uses the real one, the shadow map's tabled values stand in for a blocker distance pinned to the cascade's own extent -- so RT_SHADOW_SUN_SIZE_CALIBRATION in shadows.sdr is a constant factor that makes a given $SunAngularSize: read as roughly the same softness either way; it's the number to revisit if the shadow map ever grows a real blocker search. Also adds RTAO (raytraced ambient occlusion) sharing the same TLAS as the shadow rays, with lighting-profile-driven radius/strength, and lab controls for RT shadow quality (Low/High), the local light cap, RT shadow samples, RTAO, and an angular-size override for comparing both shadow methods against the same sun. All are safe to change live: they only gate which lights are picked as shadow casters or scale existing uniforms while filling the per-frame light data. Co-Authored-By: Claude Opus 5 <[email protected]>
134 lines
4.4 KiB
C++
134 lines
4.4 KiB
C++
#pragma once
|
|
|
|
#include "model/model.h"
|
|
#include "model/animation/modelanimation.h"
|
|
#include "species_defs/species_defs.h"
|
|
|
|
enum class LabTurretAimType {
|
|
RANDOM,
|
|
UVEC,
|
|
INITIAL,
|
|
};
|
|
|
|
enum class BayMode {
|
|
Arrival,
|
|
Departure,
|
|
};
|
|
|
|
class LabUi {
|
|
public:
|
|
bool show_thrusters = false; // So that it can be toggled on/off based on the lab mode being changed
|
|
|
|
void create_ui();
|
|
void object_changed();
|
|
void closeUi();
|
|
|
|
private:
|
|
void build_options_menu();
|
|
void build_ship_list() const;
|
|
void build_species_entry(const species_info &species_def, int species_idx) const;
|
|
void build_weapon_list() const;
|
|
void build_weapon_subtype_list() const;
|
|
static void build_object_list();
|
|
static void build_asteroid_list();
|
|
static void build_debris_list();
|
|
static void build_prop_list();
|
|
static void build_prop_subtype_list();
|
|
static void build_background_list();
|
|
void show_render_options();
|
|
void show_object_options() const;
|
|
static void show_controls_reference();
|
|
void show_object_selector() const;
|
|
void show_background_selector() const;
|
|
void build_toolbar_entries();
|
|
void build_texture_quality_combobox();
|
|
void build_antialiasing_combobox();
|
|
static void build_shadow_method_combobox();
|
|
static void build_rt_shadow_quality_combobox();
|
|
static void build_max_rt_shadow_lights_slider();
|
|
static void build_rt_shadow_bias_sliders();
|
|
static void build_shadow_penumbra_sliders();
|
|
static void build_rtao_sliders();
|
|
void build_tone_mapper_combobox();
|
|
void build_model_info_box(ship_info* sip, polymodel* pm) const;
|
|
void build_subsystem_list(object* objp, ship* shipp) const;
|
|
void build_subsystem_list_entry(SCP_string& subsys_name,
|
|
SCP_vector<bool>& show_subsys,
|
|
const size_t& subsys_index,
|
|
ship_subsys* cur_subsys,
|
|
object* objp,
|
|
ship* shipp) const;
|
|
void build_weapon_options(ship* shipp) const;
|
|
static void build_primary_weapon_combobox(SCP_string& text,
|
|
weapon_info* wip,
|
|
int& primary_slot) ;
|
|
void build_secondary_weapon_combobox(SCP_string& text, weapon_info* wip, int& secondary_slot) const;
|
|
static void build_dock_test_options(ship* shipp);
|
|
static void build_bay_test_options(ship_info* sip);
|
|
void build_animation_options(ship* shipp, ship_info* sip) const;
|
|
void create_afterburner_animation_node(
|
|
const SCP_vector<animation::ModelAnimationSet::RegisteredTrigger>& anim_triggers) const;
|
|
void create_secondary_weapon_anim_node(
|
|
ship* shipp,
|
|
ship_info* sip) const;
|
|
void create_primary_weapon_anim_node(
|
|
ship* shipp,
|
|
ship_info* sip) const;
|
|
void build_model_info_box_actual(ship_info* sip, polymodel* pm) const;
|
|
void build_team_color_combobox() const;
|
|
static void reset_animations();
|
|
void do_triggered_anim(animation::ModelAnimationTriggerType type,
|
|
const SCP_string& name,
|
|
bool direction,
|
|
int subtype = animation::ModelAnimationSet::SUBTYPE_DEFAULT) const;
|
|
void maybe_show_animation_category(const SCP_vector<animation::ModelAnimationSet::RegisteredTrigger>& anim_triggers,
|
|
animation::ModelAnimationTriggerType trigger_type,
|
|
SCP_string label) const;
|
|
|
|
// if this is true, the displayed object has changed and so every piece of cached data related to
|
|
// the object must be invalidated
|
|
bool rebuild_after_object_change = false;
|
|
|
|
// these flags track the state of open windows. We start with the object selector open and all other
|
|
// subdialogs closed
|
|
bool show_render_options_dialog = false;
|
|
bool show_object_selection_dialog = true;
|
|
bool show_object_options_dialog = false;
|
|
bool show_background_selection_dialog = true;
|
|
bool show_controls_reference_dialog = false;
|
|
|
|
// used to track the "Reset View" function
|
|
bool reset_view = false;
|
|
|
|
// used to track the "Close Lab" function
|
|
bool close_lab = false;
|
|
|
|
// various settings from the graphics dialog
|
|
bool enable_model_rotation = false;
|
|
bool show_insignia = false;
|
|
bool show_damage_lightning = false;
|
|
bool animate_subsystems = false;
|
|
bool hide_post_processing = false;
|
|
bool no_particles = false;
|
|
bool diffuse_map = true;
|
|
bool glow_map = true;
|
|
bool spec_map = true;
|
|
bool reflect_map = true;
|
|
bool env_map = true;
|
|
bool normal_map = true;
|
|
bool height_map = true;
|
|
bool misc_map = true;
|
|
bool ao_map = true;
|
|
bool no_glowpoints = false;
|
|
bool use_wireframe_rendering = false;
|
|
bool no_lighting = false;
|
|
bool show_full_detail = false;
|
|
bool show_afterburners = false;
|
|
bool show_weapons = false;
|
|
bool show_emissive_lighting = false;
|
|
bool show_particles = true;
|
|
bool use_orthographic_projection = false;
|
|
bool show_orientation_widget = true;
|
|
|
|
std::optional<vec3d> volumetrics_pos_backup = std::nullopt;
|
|
}; |