This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Projects the specified position (point) onto the plane with the specified origin and normal. | |
float3 projectOnPlane(float3 position, float3 origin, float3 normal) | |
{ | |
return position - dot(position - origin, normal) * normal; | |
} | |
// Computes the shading position of the specified geometric position and vertex positions and | |
// normals. For a triangle with normals describing a convex surface, this point will be slightly | |
// above the surface. For a concave surface, the geometry position is used directly. | |
// NOTE: The difference between the shading position and geometry position is significant when |