A system, method, and computer program product are provided for shading using a dynamic object-space grid. An object defined by triangle primitives in a three-dimensional (3D) space that is specific to the object is received and an object-space shading grid is defined for a first triangle primitive of the triangle primitives based on coordinates of the first triangle primitive in the 3D space. A shader program is executed by a processing pipeline to compute a shaded value at a point on the object-space shading grid for the first triangle primitive.
Legal claims defining the scope of protection, as filed with the USPTO.
1. A method comprising: receiving an object defined by a plurality of triangle primitives in a three-dimensional (3D) space that is specific to the object; defining an object-space shading grid for at least one of the plurality of triangle primitives based on coordinates at vertices of the at least one triangle primitive in the 3D space, wherein a shape of an object-space shading element corresponds to a shape of the at least one triangle primitive, wherein the object-space shading grid comprises at least one object-space shading element; and executing, by a processing pipeline, a shader program to compute a shaded value at a point on the object-space shading grid for a first triangle primitive.
2. The method of claim 1 , wherein the vertices comprise a first vertex, a second vertex, and a third vertex that define the first triangle primitive and the point corresponds to the first vertex.
3. The method of claim 2 , further comprising: executing, by the processing pipeline, the shader program to compute a second shaded value at a second point that corresponds to the second vertex; and executing, by the processing pipeline, the shader program to compute a third shaded value at a third point that corresponds to the third vertex.
4. The method of claim 3 , further comprising computing a shaded sample at a location within the first triangle by interpolating the first, second, and third shaded values.
5. The method of claim 1 , wherein the object-space shading grid comprises an additional level comprising only vertex positions of four sub-triangles produced by bisecting each edge of the first triangle primitive.
6. The method of claim 5 , wherein the additional level of the object-space shading grid is dynamically generated during execution of the shader program.
7. The method of claim 1 , wherein the object-space shading grid is mipmapped such that each higher resolution mip level is generated by subdividing a lower resolution mip level into substantially congruent sub-triangles within the first triangle primitive.
8. The method of claim 7 , further comprising: transforming a screen-space pixel into the 3D space that is specific to the object to generate a footprint; and identifying a first mip level of the mipmapped object-space shading grid that includes a sub-triangle having an area that most closely approximates an area of the footprint.
9. The method of claim 8 , further comprising identifying a second mip level of the mipmapped object-space shading grid that includes a sub-triangle having an area that closely approximates the area of the footprint.
10. The method of claim 9 , further comprising executing the shader program to compute a second shaded value at a second point on the object-space shading grid for the sub-triangle.
11. The method of claim 10 , wherein the sub-triangle is defined by the point, the second point on the object-space shading grid, and a third point on the object-space shading grid.
12. The method of claim 11 , further comprising: executing the shader program to compute a third shaded value at the third point for the sub-triangle; and computing a shaded sample at a sample location within the sub-triangle based on the shaded value, the second shaded value, and the third shaded value.
13. The method of claim 1 , further comprising: transforming a screen-space pixel into the 3D space that is specific to the object to generate a footprint defined by at least a first sample location; and determining that a sub-triangle within the first triangle encloses the first sample location.
14. The method of claim 13 , further comprising, executing the shader program to compute a second shaded value at a second point on the object-space shading grid that corresponds to a first vertex of the sub-triangle.
15. The method of claim 1 , further comprising updating the object-space grid in response to a change in a shape of the first triangle primitive.
16. The method of claim 1 , further comprising computing a dynamic shading rate for the first triangle primitive that varies within the first triangle primitive and is used to sample the object-space shading grid for the first triangle primitive.
17. A system comprising: a processing pipeline that is configured to: receive an object defined by a plurality of triangle primitives in a three-dimensional (3D) space that is specific to the object; define an object-space shading grid for at least one of the plurality of triangle primitives based on coordinates at vertices of the at least one triangle primitive in the 3D space, wherein a shape of an object-space shading element corresponds to a shape of the at least one triangle primitive, wherein the object-space shading grid comprises at least one object-space shading element; and execute a shader program to compute a shaded value at a point on the object-space shading grid for a first triangle primitive.
18. The system of claim 17 , wherein the object-space shading grid is mipmapped such that each higher resolution mip level is generated by subdividing a lower resolution mip level into substantially congruent sub-triangles within the first triangle primitive.
19. The system of claim 17 , wherein the object-space shading grid comprises an additional level comprising only vertex positions of four sub-triangles produced by bisecting each edge of the first triangle primitive.
20. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, causes the processor to perform steps comprising: receiving an object defined by a plurality of triangle primitives in a three-dimensional (3D) space that is specific to the object; defining an object-space shading grid for at least one of the plurality of triangle primitives based on coordinates at vertices of the at least one triangle primitive in the 3D space, wherein a shape of an object-space shading element corresponds to a shape of the at least one triangle primitive, wherein the object-space shading grid comprises at least one object-space shading element; and executing, by a processing pipeline, a shader program to compute a shaded value at a point on the object-space shading grid for a first triangle primitive.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
March 11, 2015
September 5, 2017
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.