Added mip selection using ray differentials
This commit is contained in:
@@ -98,7 +98,11 @@ static void render_pixel(const rendering_config_t* config, scene_t* scene, vec3s
|
||||
image_plane_point = glms_vec3_add(image_plane_point, glms_vec3_scale(camera_right, sensor_offset_x));
|
||||
image_plane_point = glms_vec3_add(image_plane_point, glms_vec3_scale(camera_up, sensor_offset_y));
|
||||
|
||||
ray_t ray = ray_create(scene->camera.position, glms_vec3_normalize(glms_vec3_sub(image_plane_point, scene->camera.position)));
|
||||
// Calculate initial spread angle for ray differentials
|
||||
float pixel_height = scene->camera.size_y / (float)config->height;
|
||||
float spread_angle = atanf(pixel_height / scene->camera.focal_length);
|
||||
|
||||
ray_t ray = ray_create(scene->camera.position, glms_vec3_normalize(glms_vec3_sub(image_plane_point, scene->camera.position)), 0.0f, spread_angle);
|
||||
|
||||
aov_output_t aov_output = {0};
|
||||
if (has_flag(aov_flags, AOV_BEAUTY))
|
||||
@@ -147,7 +151,7 @@ void renderer_start(render_job_t* job)
|
||||
|
||||
vec3s coord = glms_vec3_add(job->scene->camera.position, glms_vec3_scale(quat_get_forward(job->scene->camera.rotation), job->scene->camera.focal_length));
|
||||
|
||||
uint32_t x, y, tile_index; // OpenMP requires these to be declared outside the parallel region.
|
||||
int64_t x, y, tile_index; // OpenMP requires these to be declared outside the parallel region.
|
||||
#pragma omp parallel for schedule(dynamic, 1) default(none) \
|
||||
shared(tile_count_x, tile_count_y, tile_count, coord, job) \
|
||||
private(x, y, tile_index)
|
||||
|
||||
Reference in New Issue
Block a user