Update project roadmap and improve rendering logic
Changed the pixel rendering function to include anti-aliasing using Sobol sampling in Renderer.c. Changed the path tracing function to adjust light shading context and Russian roulette logic in PathTracing.c. Changed the normal calculation logic to use a ternary operator in RayIntersection.c. Changed the Sobol sample calculation for consistency in Debug.c. Removed some items from the project roadmap in README.md. Modified the sample count from 64 to 16 in main.c, affecting rendering quality and performance.
This commit is contained in:
@@ -38,7 +38,8 @@ vec4s path_trace(const scene_t* scene, ray_t ray, uint32_t sample_index, uint16_
|
||||
vec3s emission = hit_material->emission;
|
||||
accumulated_color = glms_vec4_add(accumulated_color, glms_vec4(glms_vec3_mul(throughput, emission), 0.0f));
|
||||
|
||||
light_shading_context_t light_context = {
|
||||
light_shading_context_t light_context =
|
||||
{
|
||||
.hit_point = closest_hit.point,
|
||||
.normal = closest_hit.normal,
|
||||
.tangent = closest_hit.tangent,
|
||||
@@ -64,7 +65,8 @@ vec4s path_trace(const scene_t* scene, ray_t ray, uint32_t sample_index, uint16_
|
||||
accumulated_color = glms_vec4_add(accumulated_color, glms_vec4(sky_light, 0.0f));
|
||||
|
||||
// Bounce and prepare for the next iteration
|
||||
shading_context_t shading_context = {
|
||||
shading_context_t shading_context =
|
||||
{
|
||||
.position = closest_hit.point,
|
||||
.normal = closest_hit.normal,
|
||||
.tangent = closest_hit.tangent,
|
||||
@@ -91,7 +93,6 @@ vec4s path_trace(const scene_t* scene, ray_t ray, uint32_t sample_index, uint16_
|
||||
{
|
||||
float q = fminf(glms_vec3_max(throughput), 0.95f);
|
||||
float rr_sample = sobol_sample(sample_index, sobol_get_dimension(depth, PRNG_TERMINATE));
|
||||
// float rr_sample = random_float();
|
||||
if (rr_sample > q)
|
||||
{
|
||||
break; // Terminate the path
|
||||
|
||||
@@ -213,17 +213,12 @@ hit_result_t ray_intersect_triangle(const ray_t* ray, const triangle_t* triangle
|
||||
vec3s normal = glms_vec3_scale(triangle->vertices[0].normal, w);
|
||||
normal = glms_vec3_add(normal, glms_vec3_scale(triangle->vertices[1].normal, u));
|
||||
normal = glms_vec3_add(normal, glms_vec3_scale(triangle->vertices[2].normal, v));
|
||||
if (glms_vec3_dot(normal, direction) > 0.0f)
|
||||
{
|
||||
normal = glms_vec3_negate(normal);
|
||||
}
|
||||
|
||||
normal = glms_vec3_dot(normal, direction) < 0.0f ? normal : glms_vec3_negate(normal);
|
||||
result.normal = glms_vec3_normalize(normal);
|
||||
|
||||
vec3s tangent = glms_vec3_scale(triangle->vertices[0].tangent, w);
|
||||
tangent = glms_vec3_add(tangent, glms_vec3_scale(triangle->vertices[1].tangent, u));
|
||||
tangent = glms_vec3_add(tangent, glms_vec3_scale(triangle->vertices[2].tangent, v));
|
||||
|
||||
result.tangent = glms_vec3_normalize(tangent);
|
||||
|
||||
result.uv.x = w * triangle->vertices[0].uv.x
|
||||
|
||||
Reference in New Issue
Block a user