Skip to main content

euv_core/game/engine3d/raytrace/scene/
enum.rs

1use super::*;
2
3/// Physical BSDF surface shading family evaluated by ray tracing integrators.
4#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
5pub enum RtMaterialKind {
6    /// Matte diffuse surface (Lambert or Oren-Nayar micro-roughness).
7    #[default]
8    Diffuse,
9    /// GGX microfacet metallic conductor with colored Fresnel reflectance.
10    Metal,
11    /// Refractive dielectric (glass or water) with Fresnel, Snell refraction, TIR, and Beer-Lambert absorption.
12    Dielectric,
13    /// Unified Disney/GGX Principled BSDF combining diffuse, specular, metallic, clearcoat, and transmission.
14    Principled,
15    /// Pure area light emitter radiating HDR energy without reflecting incident light.
16    Emissive,
17}
18
19/// Physical light emitter geometry supported by direct sampling, soft shadows, and MIS.
20#[derive(Clone, Copy, Debug, PartialEq)]
21pub enum RtLightKind {
22    /// Infinite directional light (sun/moon) with optional cone angular radius for soft penumbrae.
23    Directional {
24        /// Unit direction pointing from the scene toward the light source.
25        direction: Vec3,
26        /// Cone half-angle in radians (`0.0` produces crisp shadows; `~0.00465` matches solar disk).
27        angular_radius_rad: f32,
28    },
29    /// Omnidirectional spherical point light with inverse-square falloff and optional emitter radius.
30    Point {
31        /// World-space light center.
32        position: Vec3,
33        /// Spherical emitter radius in meters (`0.0` for delta point light).
34        radius: f32,
35    },
36    /// Focused cone spotlight with smooth inner-to-outer angular falloff and optional emitter radius.
37    Spot {
38        /// World-space emitter center.
39        position: Vec3,
40        /// Unit beam direction pointing away from the emitter.
41        direction: Vec3,
42        /// Cosine of the inner full-intensity cone half-angle.
43        inner_cos: f32,
44        /// Cosine of the outer cutoff cone half-angle.
45        outer_cos: f32,
46        /// Spherical emitter radius in meters.
47        radius: f32,
48    },
49    /// Physically based rectangular area emitter supporting exact uniform surface sampling and MIS.
50    RectArea {
51        /// World-space rectangle center.
52        position: Vec3,
53        /// Unit tangent axis along rectangle width.
54        right: Vec3,
55        /// Unit bitangent axis along rectangle height.
56        up: Vec3,
57        /// Unit emitting normal direction.
58        normal: Vec3,
59        /// Total rectangle width in meters.
60        width: f32,
61        /// Total rectangle height in meters.
62        height: f32,
63        /// Whether both sides of the rectangle emit radiance.
64        two_sided: bool,
65    },
66    /// Physically based circular disk area emitter supporting exact uniform disk sampling and MIS.
67    DiskArea {
68        /// World-space disk center.
69        position: Vec3,
70        /// Unit tangent axis in the disk plane.
71        right: Vec3,
72        /// Unit bitangent axis in the disk plane.
73        up: Vec3,
74        /// Unit emitting normal direction.
75        normal: Vec3,
76        /// Disk radius in meters.
77        radius: f32,
78        /// Whether both sides of the disk emit radiance.
79        two_sided: bool,
80    },
81}
82
83/// Background environment dome evaluated when rays escape all scene geometry.
84#[derive(Clone, Copy, Debug, PartialEq)]
85pub enum RtEnvironment {
86    /// Completely dark background (zero radiance).
87    Black,
88    /// Uniform constant HDR radiance sphere (useful for white-furnace energy conservation tests).
89    Solid(Vec3),
90    /// Physical sky-to-ground atmospheric gradient with optional solar disk radiance.
91    GradientSky {
92        /// Zenith sky HDR color at `+Y`.
93        zenith: Vec3,
94        /// Horizon sky HDR color at `y = 0`.
95        horizon: Vec3,
96        /// Ground hemisphere HDR bounce color at `-Y`.
97        ground: Vec3,
98        /// Unit direction pointing toward the sun disk.
99        sun_dir: Vec3,
100        /// HDR radiance emitted inside the sun angular disk.
101        sun_color: Vec3,
102        /// Sun angular half-angle in radians.
103        sun_angular_radius_rad: f32,
104    },
105}