PRIMITIVES
Advanced Computer Graphics
SEMINAR 2
Primitive Shading
2
Double intensity = MaxIntensity / ray.HitParam;
return ray.HitModel.Color * intensity;
zNear & zFar
3
Bias
4
ray
camera
sun
shadow
ray
P – intersection point
sphere
Unexpected intersections
Can be corrected with bias
AABB (Axis Aligned Bounding Box)
5
AABB – intersection parameters
6
2D case:
For x coordinate:
AABB checking for intersection
7
Ring (3D Circle)
8
Sphere
9
Sphere – Geometric Solution
10
C
P
P’
O
d
R
tca
thc
L
t1
t0
r
Sphere – Analytical Solution
11
where:
Triangle
12
where:
If ray intersects triangle they have a common point:
Template Assignment
13