t_rgba lighting(t_comps args, t_light *current_light, int in_shadow)
{
t_ltparams params;
set_light_params(&args, ¶ms, current_light);
if (params.light_dot_normal < 0 || in_shadow == 1)
{
params.diffuse = create_tuple(0, 0, 0, 0);
params.specular = create_tuple(0, 0, 0, 0);
}
else
{
params.diffuse = scalar_x_tuple(params.effective_color,
(args.phong.diffuse * params.light_dot_normal));
params.reflect_v = reflect(negate_tuple(params.light_v),
args.normal_vec);
params.reflect_dot_eye = dot_product(params.reflect_v, args.eye_vec);
if (params.reflect_dot_eye <= 0)
params.specular = create_tuple(0, 0, 0, 0);
else
params.specular = scalar_x_tuple(rgba_to_tuple(
current_light->intensity), args.phong.specular *
(pow(params.reflect_dot_eye, args.phong.shininess)));
}
return (tuple_to_rgba(add_tuple(params.ambient,
add_tuple(params.diffuse, params.specular))));
}
https://www.deviantart.com/fargetanik/art/Earth-Truecolor-Texture-Map-12k-819032851
https://www.cs.cornell.edu/courses/cs4620/2020fa/assignments/shader.html
adobe: https://stock.adobe.com/kr/search?k=bump+texture&asset_id=283027187
벽돌 - https://polycount.com/discussion/225076/baking-tiled-materials-in-blender
earth height map - https://asterweb.jpl.nasa.gov/images/GDEM-10km-BW.png
https://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73934/gebco_08_rev_elev_21600x10800.png