Update AOV support, ray intersection logic, and README

Added:
- AOV support for normals, albedo, and depth marked as completed.
- New function `normal_unpack` in `BSDF.h`.
- New field `esp` in `ray_t` structure in `RayIntersection.h`.

Changed:
- Updated `normal_ts_to_ws` to accept an additional parameter.
- Refactored `weight_nee_light` for clarity.
- Modified `RAY_EPSILON` for improved precision.
- Updated `path_output` structure to include a `normal` field.
- Normalized unpacked normal vector in `normal_unpack` function.
- Updated `path_trace` to use closest hit ray intersection.
- Updated `render_aov` to utilize closest hit logic.
- Modified `ray_create` to initialize `esp` based on ray origin.
- Improved accuracy in `offset_ray_origin` calculations.
- Updated ray intersection logic in `ray_intersect_triangle` and `ray_intersect_aabb` to include epsilon checks.
- Updated `evaluate_bsdf_directional` and `evaluate_bsdf_const_sky` for shadow rays.
- Adjusted `sample_bsdf_simple_lit` for incoming light direction calculations.
- Enhanced `render_pixel` to manage AOV flags effectively.
- Changed camera rotation and light intensity in `scene_setup`.
- Simplified texture loading by removing unnecessary sRGB conversion.

Modified:
- Several binary image files have been updated.
This commit is contained in:
2025-05-05 01:59:13 +09:00
parent 4b29de15cd
commit f940569ca3
21 changed files with 190 additions and 85 deletions

View File

@@ -14,7 +14,7 @@ vec4s path_trace(const scene_t* scene, ray_t ray, uint32_t sample_index, uint16_
uint16_t depth = 0;
while (depth < max_depth)
{
hit_result_t closest_hit = ray_intersect_scene(&active_ray, scene);
hit_result_t closest_hit = ray_intersect_scene_closest(&active_ray, scene);
if (!closest_hit.hit)
{
@@ -76,7 +76,7 @@ vec4s path_trace(const scene_t* scene, ray_t ray, uint32_t sample_index, uint16_
// active_ray = ray_create(BIAS_RAY_ORIGION(closest_hit.point, glms_vec3_negate(closest_hit.normal)), active_ray.direction);
// continue;
default:
active_ray = ray_create(BIAS_RAY_ORIGION(closest_hit.point, closest_hit.normal), material_output.wi);
active_ray = ray_create(offset_ray_origin(closest_hit.point, material_output.normal, shading_context.wo), material_output.wi);
depth++;
break;
}
@@ -90,7 +90,7 @@ end_path_trace:
// Maybe we should move aov to path_trace and split accumulated_color into direct/indirect diffuse/specular before returning.
void render_aov(const scene_t* scene, ray_t ray, uint32_t sample_index, uint16_t max_depth, aov_output_t* aov_output)
{
hit_result_t closest_hit = ray_intersect_scene(&ray, scene);
hit_result_t closest_hit = ray_intersect_scene_closest(&ray, scene);
if (!closest_hit.hit)
{
return;