• Nikhila Ravi's avatar
    back face culling in rasterization · 4bf30593
    Nikhila Ravi authored
    Summary:
    Added backface culling as an option to the `raster_settings`. This is needed for the full forward rendering of shapenet meshes with texture (some meshes contain
    multiple overlapping segments which have different textures).
    
    For a triangle (v0, v1, v2) define the vectors A = (v1 - v0) and B = (v2 − v0) and use this to calculate the area of the triangle as:
    ```
    area = 0.5 * A  x B
    area = 0.5 * ((x1 − x0)(y2 − y0) − (x2 − x0)(y1 − y0))
    ```
    The area will be positive if (v0, v1, v2) are oriented counterclockwise (a front face), and negative if (v0, v1, v2) are oriented clockwise (a back face).
    
    We can reuse the `edge_function` as it already calculates the triangle area.
    
    Reviewed By: jcjohnson
    
    Differential Revision: D20960115
    
    fbshipit-source-id: 2d8a4b9ccfb653df18e79aed8d05c7ec0f057ab1
    4bf30593
test_rasterize_meshes.py 46.2 KB