Tachyon (current)
Current Main Branch
|
Tachyon demo scene that emulates the famous "ColorChecker" color rendition charts, as a means of testing for correct color space conversions, and to evaluate the impact of HDR tone mapping operators on the rendered images. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "ProfileHooks.h"
#include "stb_image_write.h"
#include "TachyonOptiX.h"
#include "colorchecker_tables.h"
Go to the source code of this file.
Macros | |
#define | STB_IMAGE_WRITE_IMPLEMENTATION |
Functions | |
void | HSItoRGB (float h, float s, float i, float &r, float &g, float &b) |
void | int_to_normalized_float (const int *srgbi, int maxval, float *srgbf) |
void | srgb_to_linear (const float *srgb, float *lin) |
void | linear_to_srgb (const float *lin, float *srgb) |
void | img_draw_box_rgba4ub (int bxs, int bys, int bxe, int bye, unsigned char *rgba4ub, int imgxs, int imgys, unsigned char *img) |
void | img_draw_box_rgbaf32 (int bxs, int bys, int bxe, int bye, float *rgbaf32, int imgxs, int imgys, float *img) |
unsigned char * | img_gen_colorchecker_4ub (int tilesz, int pad, const int *srgbi, int &imgszx, int &imgszy) |
float * | img_gen_colorchecker_f32 (int tilesz, int pad, const int *srgbi, int maxval, int convertsrgbtolinear, int &imgszx, int &imgszy) |
float * | calc_colorchecker_gridpts (float tilesz, float pad, float height) |
float * | calc_colorchecker_linear_rgba (const int *srgbi, int maxval) |
float * | calc_colorchecker_patch_verts (float tilesz, float pad, float height) |
int * | calc_colorchecker_patch_indices (int &numtris, int &meshindices) |
float * | calc_colorchecker_patch_colors (const float *colors) |
void | color4f_to_color3f (float *col3f, const float *col4f, int num) |
void | gen_colorchecker_spheres (TachyonOptiX *rt, int numpts, float *coords, float radius, float *colors, int mat) |
void | gen_chart (TachyonOptiX *rt, int numpts, float *coords, int *trimesh_indices, float *colors, int mat) |
void | gen_teximg (TachyonOptiX *rt, int imszx, int imszy, float width, float height, float length, int mat) |
void | gen_floor (TachyonOptiX *rt, float width, float height, float length, int mat) |
int | main (int argc, const char **argv) |
Tachyon demo scene that emulates the famous "ColorChecker" color rendition charts, as a means of testing for correct color space conversions, and to evaluate the impact of HDR tone mapping operators on the rendered images.
Definition in file colorchecker.cpp.
#define STB_IMAGE_WRITE_IMPLEMENTATION |
Definition at line 45 of file colorchecker.cpp.
float* calc_colorchecker_gridpts | ( | float | tilesz, |
float | pad, | ||
float | height | ||
) |
Definition at line 250 of file colorchecker.cpp.
References COLORCHECKER_NUM_PATCHES.
Referenced by main().
float* calc_colorchecker_linear_rgba | ( | const int * | srgbi, |
int | maxval | ||
) |
Definition at line 285 of file colorchecker.cpp.
References COLORCHECKER_NUM_PATCHES, int_to_normalized_float(), and srgb_to_linear().
Referenced by main().
float* calc_colorchecker_patch_colors | ( | const float * | colors | ) |
Definition at line 385 of file colorchecker.cpp.
References COLORCHECKER_NUM_PATCHES.
Referenced by main().
int* calc_colorchecker_patch_indices | ( | int & | numtris, |
int & | meshindices | ||
) |
Definition at line 358 of file colorchecker.cpp.
References COLORCHECKER_NUM_PATCHES.
Referenced by main().
float* calc_colorchecker_patch_verts | ( | float | tilesz, |
float | pad, | ||
float | height | ||
) |
Definition at line 309 of file colorchecker.cpp.
References COLORCHECKER_NUM_PATCHES.
Referenced by main().
void color4f_to_color3f | ( | float * | col3f, |
const float * | col4f, | ||
int | num | ||
) |
Definition at line 409 of file colorchecker.cpp.
Referenced by gen_chart(), gen_colorchecker_spheres(), and gen_floor().
void gen_chart | ( | TachyonOptiX * | rt, |
int | numpts, | ||
float * | coords, | ||
int * | trimesh_indices, | ||
float * | colors, | ||
int | mat | ||
) |
Definition at line 447 of file colorchecker.cpp.
References TachyonOptiX::add_trimesh(), color4f_to_color3f(), TriangleMesh::indices, TriangleMesh::vertcolors3f, and TriangleMesh::vertices.
Referenced by main().
void gen_colorchecker_spheres | ( | TachyonOptiX * | rt, |
int | numpts, | ||
float * | coords, | ||
float | radius, | ||
float * | colors, | ||
int | mat | ||
) |
Definition at line 423 of file colorchecker.cpp.
References TachyonOptiX::add_spherearray(), SphereArray::center, color4f_to_color3f(), SphereArray::primcolors3f, and SphereArray::radius.
Referenced by main().
void gen_floor | ( | TachyonOptiX * | rt, |
float | width, | ||
float | height, | ||
float | length, | ||
int | mat | ||
) |
Definition at line 524 of file colorchecker.cpp.
References TachyonOptiX::add_trimesh(), color4f_to_color3f(), TriangleMesh::indices, length(), TriangleMesh::vertcolors3f, and TriangleMesh::vertices.
Referenced by main().
void gen_teximg | ( | TachyonOptiX * | rt, |
int | imszx, | ||
int | imszy, | ||
float | width, | ||
float | height, | ||
float | length, | ||
int | mat | ||
) |
Definition at line 470 of file colorchecker.cpp.
References TachyonOptiX::add_trimesh(), TriangleMesh::indices, length(), TriangleMesh::tex2d, and TriangleMesh::vertices.
Referenced by main().
void HSItoRGB | ( | float | h, |
float | s, | ||
float | i, | ||
float & | r, | ||
float & | g, | ||
float & | b | ||
) |
Definition at line 58 of file colorchecker.cpp.
References M_PI.
void img_draw_box_rgba4ub | ( | int | bxs, |
int | bys, | ||
int | bxe, | ||
int | bye, | ||
unsigned char * | rgba4ub, | ||
int | imgxs, | ||
int | imgys, | ||
unsigned char * | img | ||
) |
Definition at line 101 of file colorchecker.cpp.
Referenced by img_gen_colorchecker_4ub().
void img_draw_box_rgbaf32 | ( | int | bxs, |
int | bys, | ||
int | bxe, | ||
int | bye, | ||
float * | rgbaf32, | ||
int | imgxs, | ||
int | imgys, | ||
float * | img | ||
) |
Definition at line 132 of file colorchecker.cpp.
Referenced by img_gen_colorchecker_f32().
unsigned char* img_gen_colorchecker_4ub | ( | int | tilesz, |
int | pad, | ||
const int * | srgbi, | ||
int & | imgszx, | ||
int & | imgszy | ||
) |
Definition at line 162 of file colorchecker.cpp.
References img_draw_box_rgba4ub().
Referenced by main().
float* img_gen_colorchecker_f32 | ( | int | tilesz, |
int | pad, | ||
const int * | srgbi, | ||
int | maxval, | ||
int | convertsrgbtolinear, | ||
int & | imgszx, | ||
int & | imgszy | ||
) |
Definition at line 202 of file colorchecker.cpp.
References img_draw_box_rgbaf32(), and srgb_to_linear().
void int_to_normalized_float | ( | const int * | srgbi, |
int | maxval, | ||
float * | srgbf | ||
) |
Definition at line 66 of file colorchecker.cpp.
Referenced by calc_colorchecker_linear_rgba().
void linear_to_srgb | ( | const float * | lin, |
float * | srgb | ||
) |
Definition at line 83 of file colorchecker.cpp.
int main | ( | int | argc, |
const char ** | argv | ||
) |
static methods for querying OptiX-supprted GPU hardware independent of whether we actually have an active context.
Definition at line 574 of file colorchecker.cpp.
References TachyonOptiX::add_directional_light(), TachyonOptiX::add_material(), TachyonOptiX::add_material_textured(), TachyonOptiX::add_tex2d_rgba4u(), calc_colorchecker_gridpts(), calc_colorchecker_linear_rgba(), calc_colorchecker_patch_colors(), calc_colorchecker_patch_indices(), calc_colorchecker_patch_verts(), TachyonOptiX::camera_dof_enable(), colorchecker_maxval, COLORCHECKER_NUM_PATCHES, colorchecker_srgbi, TachyonOptiX::device_count(), TachyonOptiX::framebuffer_colorspace(), TachyonOptiX::framebuffer_download_rgb4u(), TachyonOptiX::framebuffer_get_size(), TachyonOptiX::framebuffer_resize(), gen_chart(), gen_colorchecker_spheres(), gen_floor(), gen_teximg(), img_gen_colorchecker_4ub(), TachyonOptiX::optix_version(), TachyonOptiX::print_raystats_info(), PROFILE_POP_RANGE, PROFILE_PUSH_RANGE, PROFILE_START, TachyonOptiX::render(), TachyonOptiX::RT_BACKGROUND_TEXTURE_SKY_SPHERE, RT_COLORSPACE_sRGB, TachyonOptiX::RT_FOG_NONE, TachyonOptiX::RT_PERSPECTIVE, RT_TEX_COLORSPACE_sRGB, TachyonOptiX::RT_VERB_TIMING, TachyonOptiX::set_aa_samples(), TachyonOptiX::set_ao_ambient(), TachyonOptiX::set_ao_direct(), TachyonOptiX::set_ao_maxdist(), TachyonOptiX::set_ao_samples(), TachyonOptiX::set_bg_color(), TachyonOptiX::set_bg_color_grad_bot(), TachyonOptiX::set_bg_color_grad_top(), TachyonOptiX::set_bg_gradient(), TachyonOptiX::set_bg_gradient_botval(), TachyonOptiX::set_bg_gradient_topval(), TachyonOptiX::set_bg_mode(), TachyonOptiX::set_camera_dof_fnumber(), TachyonOptiX::set_camera_dof_focal_dist(), TachyonOptiX::set_camera_lookat(), TachyonOptiX::set_camera_pos(), TachyonOptiX::set_camera_stereo_convergence_dist(), TachyonOptiX::set_camera_stereo_eyesep(), TachyonOptiX::set_camera_type(), TachyonOptiX::set_camera_zoom(), TachyonOptiX::set_cue_mode(), TachyonOptiX::set_verbose_mode(), TachyonOptiX::shadows_enable(), stbi_flip_vertically_on_write(), and stbi_write_png().
void srgb_to_linear | ( | const float * | srgb, |
float * | lin | ||
) |
Definition at line 73 of file colorchecker.cpp.
Referenced by calc_colorchecker_linear_rgba(), and img_gen_colorchecker_f32().