[42Seoul] 미니알티 사이트

오젼·2022년 8월 6일
0

[42Seoul]

목록 보기
19/24

fov

diffuse

t_rgba		lighting(t_comps args, t_light *current_light, int in_shadow)
{
	t_ltparams	params;

	set_light_params(&args, &params, 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))));
}
  • diffuse=(albedo) (Light Intensity) (cos(θ))diffuse = (albedo) \ (Light\ Intensity) \ (\cos(\theta))
  • θ=\theta = angle between L and N

specular

  • R=2(LN)NLR = 2(L·N)N - L
  • specular=(Light Intensity) (VR)nspecular = (Light\ Intensity)\ (V⋅R)^n

cone

checker board

uv mapping

bump map

tangent space

이미지

quadric surface

0개의 댓글