







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








p
p
p
p
p
p4 p
p
p
p
p
p
p
p
DrawTree(tree, eye) classifyPosition(tree.splitter, eye); case FRONT: DrawTree(tree.back); DrawPolygon(tree.polygons); DrawTree(tree.front); case BACK: DrawTree(tree.front); DrawPolygon(tree.polygons); DrawTree(tree.back); case COINCIDENT: DrawTree(tree.front); DrawTree(tree.back);
Declare and set in vertex shader: (^) Declare and use in frag shader:
How does the GPU compute value of tri_color for fragment P?
vertex A barycentric coordinate u
vertex C barycentric coordinate w
vertex B barycentric coordinate v
u = Area(PCB) / Area(ACB) v = Area(PAC) / Area(ACB) w = 1 – u – v
Computing area of a triangle:
v 1 = C - P v 2 = B - P
Area(PCB) = 0.5 * || v 1 x v 2 ||
vertex A barycentric coordinate u
vertex C barycentric coordinate w
vertex B barycentric coordinate v
Normalized barycentric coordinates: u + v + w = 1.