Files
SimpleRayTracing/header/Lighting/SkyLight.h
Misaki 4c62b3ecde Add HDR sky lighting support and improve rendering
Added support for HDR sky lighting, including sampling environment maps with a hierarchical CDF.
Added new utility functions for handling HDR sky data, including memory management and sampling functions.
Added functions to improve texture handling, including pixel data retrieval and texture coordinate management.
Changed the path tracing algorithm to enhance light evaluation from HDR skies and adjust light contribution calculations.
Changed BSDF sampling functions to utilize constants from Common.h for better readability.
Changed the main application logic to load HDR textures and configure the scene with improved lighting settings.
Refactored ray intersection logic to enhance accuracy and performance in triangle intersections.
Adjusted the sample count in the rendering configuration to optimize performance.
Updated the README.md to document new features and example renders.
2025-05-04 01:33:00 +09:00

34 lines
997 B
C

#ifndef SKY_LIGHT_H
#define SKY_LIGHT_H
#include "Algorithm/BSDF.h"
#include "Algorithm/RayIntersection.h"
#include "Light.h"
#include <string.h>
typedef struct
{
vec3s color;
float intensity;
} constant_sky_data_t;
typedef struct
{
uint32_t width;
uint32_t height;
texture_entity_t texture;
float intensity;
float total_weight;
vec3s* cdf_cache; // Precomputed cache for sampling, xy for texture coordinates, z for PDF
} hdr_sky_data_t;
sky_light_t sky_create_constant_sky(const constant_sky_data_t* data);
path_output evaluate_bsdf_const_sky(const void* data, const light_shading_context_t* context, vec3s throughput, uint32_t sample_index);
sky_light_t sky_create_hdr_sky(const texture_collection_t* textures, texture_entity_t hdri_entity, float intensity);
path_output evaluate_bsdf_hdr_sky(const void* data, const light_shading_context_t* context, vec3s throughput, uint32_t sample_index);
void hdr_sky_free(hdr_sky_data_t* data);
#endif // SKY_LIGHT_H