Systems and methods for hair light rasterization

Through depth classification and rasterization processing of hair segments, a hair cover layer is generated, which solves the problem of overloading the GPU by hair rendering in the prior art, and achieves efficient hair rendering effect.

CN114202607BActive Publication Date: 2024-12-24ELECTRONIC ARTS INC
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202111086330.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2021-09-10
Filing Date
2021-09-16
Publication Date
2024-12-24
Estimated Expiration
2041-09-16

AI Technical Summary

Technical Problem

Existing triangle modeling techniques overload the graphics processing unit (GPU) when rendering hair, resulting in excessive computational complexity and inability to effectively handle the limit on the number of polygons in real-time applications.

Method used

By receiving and processing hair data for valuable people, a collection of hair segments that are not obscured by opaque objects is determined, depth classification and rasterization is performed, and a hair cover is generated, and applied to the rendered image of the scene. The specific steps include: classifying the hair segments as tiles, eliminating the invisible segments based on conservative depth tests, performing bundle space shading, and combining the results into a hair covering layer.

Benefits of technology

It significantly reduces the number of polygons required to render hair, improves the processing efficiency of the GPU, adapts to the polygon budget limitations of real-time applications, and achieves efficient hair rendering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114202607B_ABST
    Figure CN114202607B_ABST
Patent Text Reader

Abstract

A method for hair rasterization includes: receiving hair data of hair bundles, each hair bundle including one or more hair segments; determining a first set of hair segments that are not completely obscured by one or more opaque objects; classifying each hair segment in the first set of hair segments into buckets corresponding to one or more tiles of pixels overlapping the hair segment and one or more clusters arranged per tile by depth; for each tile, rasterizing the hair segments included in a first cluster for the tile, the first cluster for the tile being a cluster that is closest to a camera position and includes at least one hair segment; and accumulating color and opacity for each pixel of the tile based on rasterizing the hair segments included in the first cluster; and combining the tiles including the rasterized hair segments into a hair overlay.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims the benefit of U.S. Provisional Application No. 63 / 078,959, filed on September 16, 2020, the entire contents of which are incorporated herein by reference. Technical Field

[0003] The present disclosure relates generally to computer graphics, and more particularly to systems and methods for hair rasterization. Background Art

[0004] For three-dimensional (3D) graphics applications, such as video games or animated films, it is often beneficial to process data efficiently by reducing the computational complexity of a given operation. This is particularly the case in real-time applications, such as video games.

[0005] Various operations may be performed using computer-generated objects in a scene. An object may be represented as a polygonal mesh that includes a collection of vertices, edges, and faces that define the shape and / or boundary of the object.

[0006] Conventional graphics processing systems, such as GPUs (graphics processing units) or consoles, typically operate on triangular geometry. However, for rendering hair, GPUs are not suitable.

[0007] If modeled using triangles, hair often consists of many very long and thin triangles. This poses a problem for the GPU, which operates best on relatively large triangles. For example, a character's hair bundle may include 30-60 individual segments that make up the hair bundle. Since the GPU cannot handle line geometry, each hair segment is modeled using two thin triangles that form a thin rectangle. This modeling technique of using two thin triangles to model a hair segment is then repeated for each hair segment of the hair bundle. The process is further repeated for each hair bundle of an asset, and there may be several assets with hair in the image to be rendered.

[0008] It is obvious that this technique of modeling hair using triangles involves a very large number of polygons. For a given character, the character may have 150,000 hair bundles, each of which includes 30-60 hair segments, each of which is modeled using 2 thin triangles. In one example, this results in approximately 18 million triangles to model the hair of just one character (e.g., 150,000 hair bundles × 60 hair segments × 2 triangles per hair segment = 18,000,000 triangles). What's more, this calculation only takes into account the hair on the character's head, while there may be other hair on the character, such as, for example, beard hair or eyebrow hair. Further, approximately the same number of triangles will be required for each character with hair. Considering that the polygon budget for real-time applications (such as video games) is approximately 2-3 million polygons per frame, modeling techniques for hair strands using triangles are not practical because the triangle budget is simply inflated several times compared to the budget for the hair of just one character, leaving no budget for any of the other polygons of the character and the overall scene.

[0009] Thus, there remains a need in the art for improved systems and methods for rendering hair. Summary of the invention

[0010] Embodiments of the present disclosure provide a method, device, and computer-readable storage medium for hair rasterization. A method includes: receiving hair data for a valuable person by one or more processors, wherein the hair data includes one or more hair bundles associated with the valuable person, and each hair bundle includes one or more hair segments; determining by the one or more processors a first set of hair segments that are not completely obscured by one or more opaque objects relative to a position of a camera, wherein the camera is configured to capture an image of a scene including the valuable person; classifying by the one or more processors each hair segment in the first set of hair segments into one or more buckets corresponding to one or more tiles of pixels overlapped by the hair segment in screen space; for each bucket corresponding to a given tile of pixels, classifying by the one or more processors each hair segment in the bucket for the given tile The hair segments are further classified into clusters arranged by depth from the position of the camera; for each tile of pixels, the one or more processors rasterize the hair segments included in a first cluster for the tile, the first cluster for the tile being a cluster closest to the position of the camera and including at least one hair segment, and the one or more processors accumulate the color and opacity of each pixel for the tile based on rasterizing the hair segments included in the first cluster; and the one or more processors combine the tiles of pixels including the rasterized hair segments to generate a hair overlay layer, wherein the hair overlay layer is configured to be applied on top of a rendered image of an object in the scene to add hair to the rendered image.

[0011] In one aspect, determining a first set of hair segments that are not completely obscured by one or more opaque objects relative to the position of the camera includes: for each pixel in screen space, determining a distance from the position of the camera to the nearest opaque surface covered by the pixel as a per-pixel distance for the pixel; for each tile of pixels, accumulating the per-pixel distances for the pixels associated with the tile to determine a conservative depth value for the tile, wherein the conservative depth value is a value equal to the maximum per-pixel distance between pixels of the tile; and determining that the hair segment is included in the first set of hair segments that are not completely obscured by one or more opaque objects based on determining that at least a portion of the hair segment is closer to the position of the camera than the conservative depth value for the tile corresponding to the portion of the hair segment.

[0012] In one aspect, for a first tile of pixels, a size of a cluster of pixels for the first tile in a depth direction relative to the location of the camera increases non-linearly with increasing distance from the location of the camera.

[0013] In one aspect, for a first cluster of a first tile, rasterizing a hair segment associated with the first cluster includes: determining the number of pixels to be rasterized for the hair segment; generating a one-pixel wide line for the hair segment based on the determined number of pixels to be rasterized for the hair segment; for each pixel of the one-pixel wide line, performing a lookup in a bundle space shading memory to determine a color value for the pixel; converting each pixel of the one-pixel wide line into a two-pixel pair to generate a two-pixel wide line for the hair segment, wherein for a given pixel of the one-pixel line, the determined color value for the given pixel is copied to the other pixel of the two-pixel pair for the given pixel; for each pair of pixels making up the two-pixel wide line, distributing opacity between the two pixels of the two-pixel pair; and culling any occluded pixels by performing a per-pixel depth test for opaque objects in the scene.

[0014] In one aspect, a first pixel pair includes a first pixel and a second pixel, and distributing opacity between the first pixel and the second pixel in the first pixel pair is based on determining a relative coverage of a first hair segment overlapping the first pixel and the second pixel between the first pixel and the second pixel.

[0015] In one aspect, the method further includes generating color values ​​stored in the bundle space shading storage, which includes: receiving hair bundle data for a first hair bundle, wherein the hair bundle data includes a root color of a root of the first hair bundle, a tip color of a tip of the first hair bundle, and information related to how to interpolate color along the first hair bundle from the root to the tip; sampling the hair bundle at a number N positions along the first hair bundle; eliminating sample positions corresponding to hair segments of the first hair bundle that are not included in a first set of hair segments that are not completely obscured by one or more opaque objects to generate a set of visible sample positions for the first hair bundle; performing shading at the visible sample positions; and storing the results of performing the shading in the bundle space shading storage.

[0016] In one aspect, for a first pixel of a first tile, accumulating a color for the first pixel includes averaging color values ​​associated with pixels corresponding to rasterized hair segments included in a first cluster for the first tile that overlap with a position of the first pixel in screen space.

[0017] In one aspect, for a first pixel of a first tile, accumulating opacity for the first pixel includes: receiving the following opacity value buffer: the opacity value buffer corresponds to a rasterized hair segment included in a first cluster for the first tile that overlaps with the position of the first pixel in screen space, wherein the opacity value buffer is sorted in order based on the closest distance to the position of the camera; and accumulating the opacity for the first pixel based on the order of the opacity values ​​in the opacity value buffer. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 is a block diagram of a computer system for rendering an image according to aspects of the present disclosure.

[0019] Figure 2 is a block diagram illustrating processor and buffer interaction according to one embodiment.

[0020] Figure 3 is a block diagram of a scene to be rendered according to one embodiment.

[0021] Figure 4A is a block diagram illustrating rendering of a scene according to one embodiment.

[0022] Figure 4B is an example of an image of a scene according to one embodiment.

[0023] Figure 5 is an example of a polygonal mesh according to one embodiment.

[0024] Figure 6 is an example of a character according to one embodiment.

[0025] Figure 7 is an example of a hair bundle according to one embodiment.

[0026] Figure 8 is an example of hair strands shown in world space coordinates, according to one embodiment.

[0027] Fig. 9 is a flow chart of method steps for performing hair light rasterization according to one embodiment.

[0028] Fig.10 is a flow chart of method steps for performing front-end rasterization according to one embodiment.

[0029] Fig.11 is an example of a tile grid overlaid on top of a render target, according to one embodiment.

[0030] Fig.12 is an example of a hair segment overlapping multiple tiles according to one embodiment.

[0031] Fig.13 is a flow chart of method steps for performing conservative depth testing according to one embodiment.

[0032] Fig.14A is an example of a pixel tile according to one embodiment.

[0033] Fig. 14B FIG. 1 is a diagram illustrating a method for Fig.14A The depth value of the pixel tile shown in .

[0034] Fig.15 Illustrated are tiles organized into clusters by depth, according to one embodiment.

[0035] Fig.16 is a graph illustrating how the boundaries of each cluster vary as the distance from the camera increases, according to one embodiment.

[0036] Fig.17 Illustrated are active and inactive clusters for a given tile according to one embodiment.

[0037] Fig.18 is a flow chart of method steps for performing beam space shading according to one embodiment.

[0038] Fig.19 is a conceptual diagram illustrating beam space coloring according to one embodiment.

[0039] Fig. 20 is a flow chart for rasterizing a tile with visible hair, according to one embodiment.

[0040] Fig.21A is an example of the orientation of a light hair segment relative to the tile.

[0041] Fig.21B is an example of the orientation of the steep hair segment relative to the tile.

[0042] Fig. 22 is an example illustrating a two-pixel wide line according to one embodiment.

[0043] Fig.23 is a conceptual diagram illustrating how opacity is accumulated according to one embodiment. DETAILED DESCRIPTION

[0044] The following specific embodiments are exemplary in nature and are not intended to limit the present disclosure or the application and use of the present disclosure. In addition, there is no intention to be bound by any expressed or implied theory presented in the above technical field, background technology, invention content, accompanying drawings or the following specific embodiments.

[0045] As described above, modeling hair using thin triangles is not practical for GPU hardware rendering for real-time applications. Accordingly, embodiments of the present disclosure provide a system and method for hair rasterization using a GPU that overcomes the limitations of existing solutions.

[0046] As will be described in more detail below, embodiments of the present disclosure provide systems and methods for rasterizing hair on a GPU. In some embodiments, a method for hair rasterization includes receiving hair clump data for a person of value (e.g., a character). Each hair clump can be composed of multiple hair segments. In some embodiments, conservative depth is used to cull hair segments that are not visible to the camera, which is described in more detail below. In some embodiments, clump space shading can be performed on the hair clumps by evaluating shading at fixed anchor positions and storing these color values, also as described below.

[0047] According to various embodiments, a tile grid (e.g., 8×8 pixel tiles) is overlaid on a render target. Visible hair segments are placed in buckets corresponding to which tile the hair segment overlaps. The hair segments in each per-tile bucket may be further sorted into clusters based on the depth of the hair segment into the scene from the camera position. Finally, the visible hair segments at each time are rasterized based on depth-based clustering and bundle space shading.

[0048] Take the context of a video game as an example. The display of a video game is generally a video sequence presented to a display device that is capable of displaying the video sequence. The video sequence typically includes a plurality of frames. By showing the frames in sequence order, the simulated objects appear to move. The game engine typically generates frames in real time in response to user input, so rendering time is often limited.

[0049] As used herein, a "frame" refers to an image of a video sequence. In some systems (such as interlaced displays), a frame may include multiple fields or more complex structures, but in general, a frame can be thought of as a view into a computer-generated scene at a specific time or short time window. For example, with a 60 frames per second video, if one frame represents the scene at t=0 seconds, then the next frame will represent the scene at t=1 / 60 seconds. In some cases, a frame may represent a scene from t=0 seconds to t=1 / 60 seconds, but in simple cases, a frame is a snapshot in time.

[0050] A "scene" includes those simulated objects that are positioned in world coordinate space within a view cone, view rectangular prism, or other shaped view space. In some schemes, the scene includes all objects within the view cone defined by the view point and the view rectangle (which are not obscured by other objects), where the boundary is the perspective plane passing through each edge of the view point and the view rectangle, possibly truncated by the background.

[0051] The simulated objects may be generated entirely from mathematical models that describe the shape of the objects (such as an arm and torso described by a collection of planes and / or curved surfaces), from stored images (such as a face of a famous person), or a combination thereof. If the game engine (or more specifically, a rendering engine that is part of or used by the game engine) has data about where each object or part of an object is in the scene, then frames for the scene may be rendered using standard rendering techniques.

[0052] Scenes may include several objects or entities, some of which are animated, because objects or entities may appear to be moving in response to game engine rules or user input. For example, in a basketball game, the character of one of the basketball players may shoot in response to user input, while the defensive player will attempt to stop the shooter in response to the logic as a part of the game rules (for example, the artificial intelligence component of the game rules may include the rule that the defender blocks the shooting when the shooting attempt is detected), and when the ball moves through the net, the net will move in response to the ball. The net is expected to be inanimate, but the movement of the athlete is expected to be animated and appear natural. Typically, animating objects are generally referred to as characters in this article, and in specific examples (such as, animations of American football, football, baseball, basketball or other sports games), characters are typically simulated athletes in the game. In many cases, characters correspond to actual sports humanoids, and those actual sports humanoids may have contributed motion capture data for use when their corresponding characters are animated. Athletes and characters may be non-human, simulated robots or other character types.

[0053] In some cases, an artist-created object visible in a scene may be composed of multiple sub-objects, each of which may be quite complex and include many surfaces. For example, for an object represented as a polygonal mesh, the object may be composed of a collection of polygonal sub-meshes that form the complete object.

[0054] In some embodiments, hair is modeled by an artist using curves (specifically, line primitives) (e.g., in Maya or 3D Studio Max), and is not modeled as a polygonal mesh. A line primitive includes two vertices. To represent a hair strand, multiple line primitives are connected in a chain. Each line primitive shares its points with adjacent line primitives. The chain of these line primitives forms what will be called a hair strand. Each individual primitive may also be referred to as a hair segment.

[0055] Go to the attached picture, Figure 1 1 is a block diagram of a computer system 100 for rendering images according to aspects of the present disclosure. Computer system 100 may be used, for example, to render images for a video game. Computer system 100 is shown to include a console 102 coupled to a display 104 and an input / output (I / O) device 106. Console 102 is shown to include a processor 110, program code storage 112, temporary data storage 114, and a graphics processor 116. Console 102 may be a handheld video game device, a video game console for operating a video game (e.g., a dedicated computing device), a general-purpose laptop or desktop computer, or other suitable computing system (such as a mobile phone or tablet computer). Although in Figure 1 Although shown as one processor in FIG. 1 , processor 110 may include one or more processors having one or more processing cores. Figure 1 Although shown as one processor, graphics processor 116 may include one or more processors having one or more processing cores.

[0056] The program code storage 112 may be a ROM (read-only memory), a RAM (random access memory), a DRAM (dynamic random access memory), an SRAM (static random access memory), a hard disk, other magnetic storage, an optical storage, other storage, or a combination or variation of these storage device types. In some embodiments, portions of the program code are stored in a programmable ROM (e.g., a ROM, a PROM (programmable read-only memory), an EPROM (erasable programmable read-only memory), an EEPROM (electrically erasable programmable read-only memory), etc.), and portions of the program code are stored on a removable medium such as a disk 120 (e.g., a CD-ROM, a DVD-ROM, etc.), or may be stored on a cassette, a memory chip, etc., or may be obtained on a network or other electronic channel as needed. In some implementations, the program code may be found to be embodied in a non-transient computer-readable storage medium.

[0057] Temporary data storage 114 may be used to store variables and other game and processor data. In some embodiments, temporary data storage 114 is RAM and stores data generated during play of the video game, and portions thereof may also be reserved for frame buffers, depth buffers, polygon lists, texture storage, and / or other data needed for or available for rendering images as part of the video game presentation.

[0058] In one embodiment, I / O devices 106 are devices that a user interacts with to play a video game or otherwise interact with console 102. I / O devices 106 may include any device for interacting with console 102, including, but not limited to, a video game controller, a joystick, a keyboard, a mouse, a keypad, a VR (virtual reality) headset or device, and the like.

[0059] Display 104 may be any type of display device, including a television, a computer monitor, a laptop screen, a mobile device screen, a tablet screen, etc. In some embodiments, I / O device 106 and display 104 include common devices, such as a touch screen device. Further, in some embodiments, one or more of I / O device 106 and display 104 are integrated into console 102.

[0060] In various embodiments, because a video game is likely to cause the particular sequence of images presented on display 104 to depend on the results of processing game instructions and those game instructions are likely to in turn depend on user input, console 102 (as well as processor 110 and graphics processor 116) are configured to quickly process input and render responsive image sequences in real time or near real time.

[0061] Various other components may be included in the console 102, but are omitted for clarity. An example includes a networking device configured to connect the console 102 to a network, such as the Internet.

[0062] Figure 2 is a block diagram illustrating the interaction of a processor and a buffer according to one embodiment. Figure 2As shown in , the processor 110 executes program code and program data. In response to executing the program code, the processor 110 outputs rendering instructions to the graphics processor 116. The graphics processor 116 then reads data from the polygon buffer 150 and interacts with (one or more) pixel buffers 160 to form an image sequence of one or more images that are output to the display. Alternatively, instead of sending the rendering instructions to the graphics processor 116 or in addition to sending the rendering instructions to the graphics processor 116, the processor 110 can interact directly with the polygon buffer 150. For example, the processor 110 can determine which objects are to be displayed in the view and provide polygons or other mathematical representations of those objects to the polygon buffer 150 for subsequent processing by the graphics processor 116.

[0063] In one example implementation, processor 110 issues high-level graphics commands to graphics processor 116. In some implementations, such high-level graphics commands may be, for example, those specified by the OpenGL specification, DirectX, Vulkan, proprietary console variants, or those specified by a graphics processor manufacturer.

[0064] In one implementation of the image rendering process, the graphics processor 116 reads polygon data from the polygon buffer 150 for a polygon, processes the polygon and updates the pixel buffer(s) 160 accordingly, and then moves on to the next polygon until all polygons are processed or at least all polygons that need to be processed and / or are in view are processed. Thus, the renderer processes a stream of polygons, even though the polygons can be read in place and can be a finite set, where the number of polygons is known or determinable. For memory efficiency and speed, it may be preferred in some implementations that the polygons are processed as a stream (as opposed to random access or other ordering) so that fast, expensive memory for the polygons being processed is not required for all polygons comprising the image.

[0065] In some embodiments, the processor 110 may load the polygon buffer 150 with polygon data in sorted order (if possible, which may not be the case if overlapping polygons exist), but more typically, the polygons are stored in the polygon buffer 150 in an unsorted order. It should be understood that although these examples use polygons as image elements processed, the apparatus and methods described herein may also be used on image elements other than polygons. Furthermore, in some embodiments, hair is modeled using curves (e.g., a series of interconnected vertices that form a hair strand) and is not modeled as polygons.

[0066] Figure 3300 is a block diagram of a scene 300 to be rendered according to one embodiment. The scene 300 includes a plurality of 3D (three-dimensional) objects, including, for example, objects 302, 302A, 302B. Each object may be composed of a collection of polygons (e.g., triangles). A camera 306 is configured to capture an image of the scene 300. A projection of the scene 300 is captured by the camera 306 and represented by a screen space 308. The view of the scene 300 captured by the camera 306 is represented by a viewport 304. As shown, some of the objects (such as object 302A of the scene 300) may be outside the viewport 304. Also as shown, some of the objects (such as object 302B) may be partially outside the viewport 304.

[0067] In one embodiment, the image of scene 300 displayed on the display device corresponds to screen space 308. As camera 306 moves in 3D space relative to objects in the scene, the view of scene 300 that camera 306 can see (i.e., the image represented by screen space 308) can change. Furthermore, objects can move in scene 300.

[0068] Figure 4A is a block diagram illustrating the rendering of a scene 400 according to one embodiment. Figure 3 As shown in FIG. 4 , a scene 400 includes a plurality of objects. A camera 406 is configured to capture an image of the scene 400 represented in a screen space 408. The camera 406 observes the scene 400 through a viewport 410.

[0069] Various techniques may be used to render the scene 400 in screen space, including rasterization, ray tracing, or other techniques. Rasterization seeks to render pixels as those directly visible from the camera 406. In some implementations, rasterization may provide good performance when the renderer (e.g., the processor 110 and / or the graphics processor 116) does not need any global information about the scene 400.

[0070] A rasterization algorithm takes a 3D scene 400, depicted as objects comprising polygons, and renders the scene onto a 2D surface (typically, a computer monitor) in screen space 408. The polygons themselves are represented as a collection of triangles. Each triangle is represented by three vertices in 3D space. At a very basic level, a rasterizer takes a stream of vertices, transforms them into corresponding 2D points in screen space 408, and fills in the transformed 2D triangles as appropriate.

[0071] Rasterization typically involves culling one or more objects or portions of objects. Frustrumculling removes any objects outside the viewport 410 (such as object 402A). Viewport culling removes portions of objects that partially overlap the edges of the viewport 410 (such as portions of object 402B). Backface culling removes back portions 404 of objects that cannot be seen by the camera 406. In some embodiments, a depth test may be performed to remove portions 406 of objects that are occluded by other objects on a per-pixel basis in screen space 408.

[0072] When rasterization is complete, an image of the scene in screen space 408 is generated. The pixel density of screen space 408 may also result in a loss of information about objects in scene 400 in some embodiments.

[0073] Figure 4B is an example of an image of a scene according to one embodiment. Figure 4B The image shown in Figure 4A An image in screen space 408 of scene 400 captured by camera 406 in FIG.

[0074] For each pixel 412 in screen space 408, the processor may access data corresponding to the location of an object within the pixel, the color of the object, the orientation of the object, properties of the object (e.g., transparency or translucency), and / or surface roughness information, etc. Thus, the result of rasterization is a 2D image of a 3D scene.

[0075] Although rendering has been described herein using rasterization, other embodiments may involve rendering a scene using other techniques, such as ray tracing, ray casting, radiosity, or any other rendering technique, or combinations thereof.

[0076] Figure 5 is an example of a polygonal mesh 500 according to one embodiment. As described, polygonal mesh 500 may correspond to an object created by an artist. In the example shown, the object represents a chair. Polygonal mesh 500 includes a collection of vertices, edges, and faces that define the shape and / or boundary of the object created by the artist. The faces may include various polygonal shapes, such as triangles, quadrilaterals, convex polygons, concave polygons, regular polygons (e.g., polygons that may have sides of equal length and may have equal angles), and / or irregular polygons (e.g., polygons that may not have sides of equal length and may not have equal angles).

[0077] In various embodiments, polygon mesh 500 may be composed of one or more polygon sub-meshes. Each sub-mesh may include a series of polygons. Figure 5In the example shown in , the polygonal mesh is composed of multiple sub-meshes 502, 504, 506, 508, 510, 512, where sub-mesh 502 represents the base of the chair, sub-mesh 504 represents the legs of the chair, sub-mesh 506 represents the seat of the chair, sub-mesh 508 represents the handles of the chair, sub-mesh 510 represents the back of the chair, and sub-mesh 512 represents the headrest of the chair.

[0078] Figure 6 600 is an example of a character 600 according to one embodiment. The body of character 600 may be modeled as a polygonal mesh. The hair of model 602 may be modeled using hair bundles, such as hair bundle 602. In some implementations, there may be 100,000 or more hair bundles for a single character.

[0079] Figure 7 is an example of a hair bundle 700 according to one embodiment. The hair bundle 700 is composed of vertices p0, p1, p2, p3. The vertices are connected in series to form a hair segment. Figure 7 , vertices p0 and p1 form hair segment s0, vertices p1 and p2 form hair segment s1, and vertices p2 and p3 form hair segment s2.

[0080] Figure 8 is an example of a hair strand 700 shown in world space coordinates according to one embodiment. In three-dimensional (3D) world space coordinates, vertex p0 has coordinates {x0, y0, z0}, vertex p1 has coordinates {x1, y1, z1}, vertex p2 has coordinates {x2, y2, z2}, and vertex p3 has coordinates {x3, y3, z3}.

[0081] In one embodiment, there is a separate memory storage for vertex data (i.e., in Figure 8 802) and another storage in memory for the connectivity of the vertices (i.e., in Figure 8 804). The vertex data includes 3D coordinates giving the position of the vertex in world space, while the index data (ie, connectivity) describes which two vertices form a line primitive, ie, a hair segment.

[0082] exist Figure 8 In the example shown in , there are four vertices; therefore, the vertex data table 802 has four rows. These four vertices make up the hair bundle 700, which includes three hair segments; therefore, the index data table 804 has three rows.

[0083] In some embodiments, there may be additional data for vertices in the vertex data table 802, such as tangents (which may be useful for lighting and tessellation) and other metadata that allows a given vertex to be mapped back to which hair clump identifier it belongs to or which local primitive ID (i.e., hair segment ID) within a hair clump it belongs to.

[0084] In one embodiment of performing hair rasterization, the underlying geometry of a render target (e.g., a character body) is rendered using standard polygon-based rendering, and a hair overlay is generated using the disclosed embodiments. The hair overlay includes pixel-level hair data. The hair overlay can be simply placed pixel by pixel on top of the underlying geometry (rendered using standard polygon-based rendering) to generate the final rendered image.

[0085] Fig. 9 is a flow chart of method steps for performing hair light rasterization according to one embodiment. In various implementations, the method may be performed by processor 110, graphics processor 116, or a combination of processor 110 and graphics processor 116. In one implementation, Fig. 9 The flowchart in represents the overall process of hair rasterization for a character's hair. More information about each step of the process is provided in more detail in subsequent figures. The method can be repeated for each character with hair. In one embodiment, steps 902, 904, and 906 are repeated for each character, which builds up one or more buffers containing clustered hair segments. In an implementation using a single buffer, the buffer contains hair segments for each character. In some embodiments, step 908 is performed only once on the buffer containing all clustered hair segments for each character. Doing so can be referred to as "batching". Batching can enhance the performance of hair rendered by a large number of orders of magnitude because there is some overhead in performing step 908. Thus, steps 902, 904, and 906 inject their data into a cluster data structure (e.g., a buffer), and then step 908 is performed once, regardless of how many characters are present in the scene with hair. Each segment can keep track of which region from the bundle space shading buffer to look up their individual color.

[0086] As shown, the method begins at step 902, where a processor receives hair clump data for a character. As described, an artist can model hair using clumps composed of interconnected vertices. In some embodiments, the hair clumps are sparsely modeled, and additional vertices for the hair clumps can be generated by the processor at rendering time.

[0087] At step 904, the processor performs front-end rasterization. In some embodiments, the front-end rasterization includes: using conservative depth to cull invisible hair segments; and clustering hair segments into pixel tiles by depth. In this step, a tile grid is overlaid on the rendering target (e.g., a grid of 8×8 pixel blocks). The processor uses a conservative depth test to coarsely identify tiles with visible hair. In some embodiments, the conservative depth test is based on the following operation: coarsely culling hair segments based on the depth of the closest opaque object within the tile associated with the hair segment. In some embodiments, each tile can be divided into clusters in the depth direction, such as 32 clusters. Each cluster can have a boundary at a preconfigured distance from the camera, except for the cluster at the farthest distance from the camera, which has an outer boundary at a maximum distance of the scene to be rendered. A given hair segment that passes coarse culling through the conservative depth test is classified based on its depth, so that the given hair segment is associated with each cluster that overlaps with it. In Figure 10-17 Additional details for performing front-end rasterization are provided in .

[0088] At step 906, the processor performs clump-space shading. In some implementations, hair shading varies slowly and predictably across the span of a single hair clump. Some embodiments evaluate shading for a hair clump at fixed anchor locations and store color values ​​for the fixed anchor locations. Then, while generating pixels covered by a hair segment, the rasterizer code can look up two adjacent shading anchor points for a pixel and interpolate the values ​​along the hair clump. Doing so allows the disclosed embodiments to run shading at varying rates if performance requires it and / or if the user so desires. Although a hair clump may cover hundreds of pixels, in some embodiments the rasterizer only evaluates shading at fixed anchor locations and, during rasterization, interpolates the remaining color values. In Figure 18-19 Additional details on performing bundle space shading are provided in .

[0089] At step 908, the processor rasterizes the tiles with visible hair based on cluster and bundle space shading. The result is a hair overlay layer that includes pixel-level hair data. The hair overlay layer can be placed on top of the underlying geometry rendered using standard polygon-based rendering to generate the final image. Figure 20-23 Additional details are provided in . In one embodiment, to place the hair overlay on top of an opaque scene, the hair overlay is alpha blended based on what the hair alpha (i.e., opacity) is for the final render target. So if the hair has accumulated to a 90% alpha value, then when it is placed on the scene, one embodiment lets 10% of the opaque background bleed through. In one implementation, the alpha blending is performed using an "over" operator. This can be an image operation that occurs for each pixel.

[0090] Front-end rasterization

[0091] Fig.10 is a flow chart of method steps for performing front-end rasterization according to one embodiment. In various implementations, the method may be performed by processor 110, graphics processor 116, or a combination of processor 110 and graphics processor 116. In one implementation, Fig.10 The flowchart in Fig. 9 More details about step 904 in.

[0092] As shown, the method begins at step 1002, where the processor receives hair data for a character. As described, an artist can model hair using hair bundles composed of interconnected vertices. In one embodiment, the hair data received at step 1002 is a buffer of vertex and connectivity data for the character's hair, see e.g. Figure 8 The vertex and connectivity data provides information to determine the individual hair segments of a character's hair clumps. Each hair segment can be assigned a hair segment identifier (ID). Each hair clump is assigned a hair clump ID. In one implementation, the hair segment ID and the hair clump ID are what allow the processor to look up the correct shading value from the clump space shading storage when doing the actual rasterization.

[0093] At step 1004, for each hair segment, the processor projects the hair segment into camera space and determines which one or more tiles the hair segment overlaps with. In some embodiments, hair rasterization is based on decomposing the render target into tiles. There can be various ways to implement this step. In one embodiment, the hair segments are processed in parallel, where each thread picks a hair segment and then traverses the screen space tiles that it overlaps with. The processor grabs a hair segment and walks the tile, thereby performing binning. This embodiment has tile traversal logic, because there will be one processor configured for the tile. Alternatively, in another embodiment, the tiles are processed in parallel, where the processor can access the tiles exclusively, and the processor loops on the hair segments one by one. In some implementations, an intermediate acceleration structure is used, which groups the hair segments into "local" chunks, which themselves are bounded by AABBs (axis-aligned bounding boxes). We will then loop only over groups of hair rather than spatially tiled individual hair segments, and then perform overlap tests of their associated AABBs against the screen space tiles, which will then speed up the process. Instead of touching the segments one by one, this implementation will only commit all hair segments within the AABB into tiles at once, making this step much faster. From this, several implementation strategies are possible. AABBs can be one of the better performing implementations, but require preprocessing the hair segments into localized groups with AABB boundaries. Also, in some implementations, these AABBs are updated every frame for animated hair, but not for static hair. This also means: we can perform coarse culling on smaller AABBs of groups of hair rather than individual segments to speed up the process. In some implementations, it is even possible to have multiple levels / tiers of culling tests, where we perform this test on the AABBs as well as the individual segments of the content that survives the culling.

[0094] Fig.11 is an example of a tile grid 1100 overlaid on top of a render target according to one embodiment. As an example, the tile grid 1100 is formed of 8×8 blocks of pixels. In various embodiments, the number of pixels in each tile of the tile grid 1100 is configurable. Fig.11 The tile 1102 in bold outline in the example in is a tile that includes a hair segment that overlaps with the tile 1102. It should be noted that even if a hair segment is completely occluded by an opaque object, such a hair segment will still be considered to cover the corresponding tile. The culling of hair segments is considered at a later processing stage.

[0095] In one embodiment, to implement step 1004 on a GPU, a thread is started for each hair segment. Given the world space coordinates of the two vertices of the hair segment and the camera position, the GPU projects the hair segment into the camera space. In some implementations, a single hair segment may overlap one or more tiles. Fig.12 is an example of a hair segment 1202 overlapping multiple tiles according to one embodiment. In the example shown, the hair strand overlaps the Fig.12 4. After step 1004 ends, the result is a buffer of hair segment IDs for each tile that has hair segments that (at least partially) overlap with the corresponding tile. In one embodiment, the hair segment IDs are stored in a "primitive list" buffer owned by the tile. Each cluster owns a subset / range of primitives in the primitive list. Each segment also submits other metadata, such as a bundle ID, vertex pair identifiers (this can be implemented in various ways). One implementation simplifies this to a VertexID, and the next implementation always positions it as +1 (plus one). This metadata information can be used during rasterization for vertex lookups, tangent lookups, shading lookups, etc.

[0096] At step 1006, the processor performs coarse culling of hair segments using a conservative depth test. After ending step 1006, the result is a coarse culled buffer for each tile having hair segment IDs of hair segments that are potentially visible in a given tile due to not being occluded by opaque objects. Fig.13 One embodiment for performing conservative depth testing is described in .

[0097] Fig.13 is a flow chart of method steps for performing conservative depth testing according to one embodiment. In various implementations, the method may be performed by the processor 110, the graphics processor 116, or a combination of the processor 110 and the graphics processor 116.

[0098] At step 1302, the processor selects a given tile to be processed. At step 1304, the processor receives a segment buffer for the given tile. The segment buffer includes hair segments that at least partially overlap the tile, e.g., performing Fig.10 The result of step 1004 in .

[0099] At step 1306 , the processor generates a depth value for a given tile (ie, a so-called “conservative depth” value for the tile).

[0100] Fig.14Ais an example of a pixel tile according to one embodiment. For each pixel of the pixel tile, a per-pixel distance to the closest opaque surface in the given pixel is determined. Each pixel is therefore associated with a distance. As described, a character may be modeled using a polygonal mesh, and hair may be modeled using a hair bundle including hair segments. To determine the per-pixel distance to the closest opaque surface, the hair geometry is ignored. In the example in FIG. 14 , pixels in pixel set 1402 are associated with a first distance, which is the distance to the closest opaque surface in each pixel in pixel set 1402, and pixels in pixel set 1404 are associated with a second distance, which is the distance to the closest opaque surface in each pixel in pixel set 1404. In one example, the second distance (which is a single distance corresponding to each of the pixels in pixel set 1404) is farther from the camera than the first distance (which is a single distance corresponding to each of the pixels in pixel set 1402). To determine a depth value for a given tile, the farthest per-pixel distance between pixels in the tile is used as the depth value for the pixel tile.

[0101] Fig. 14B FIG. 1 is a diagram illustrating a method for Fig.14A The depth values ​​1406 for the pixel tile shown in FIG. 1406. The depth values ​​for the pixels of a given tile are referred to as the "conservative depth" of the tile. As discussed, each pixel is associated with a single distance value. Fig.14A , pixels in the tile are associated with a first distance value (i.e., pixels in pixel set 1402) or with a second distance value (i.e., pixels in pixel set 1404), where the second distance value is farther from the camera than the first distance value. Thus, the second distance is selected as the depth value 1406 for the given tile. In one embodiment, all pixels of the tile are visited serially and the processor calculates the maximum value of the set. In another embodiment, the pixels of the tile can be visited in parallel. To achieve parallel processing, one embodiment performs the test hierarchically by halving the set each time. Each thread picks two values ​​and you repeat the step. For an 8×8 tile, you have 64 pixels, so it takes 6 steps, i.e., Log2(64). Algorithms for the parallel case are called "parallel reduction" and are very suitable for GPUs.

[0102] Reference back Fig.13, at step 1308, the processor selects a given segment from the segment buffer for the given tile. At step 1310, the processor culls the given segment if the entire segment is farther from the camera than the depth value for the given tile (i.e., the conservative depth value). In one embodiment, the given segment includes a first vertex and a second vertex, the first vertex corresponding to a first depth relative to the camera, and the second vertex corresponding to a second depth relative to the camera. If both the first depth of the first vertex and the second depth of the second vertex are farther from the camera than the depth value determined for the given tile at step 1306, then the hair segment that is completely obscured by the opaque object can be culled.

[0103] At step 1312, the processor determines whether there are any more segments to process for a given tile. If so, the method returns to step 1308 described above. If not, the method continues to step 1314. Fig.13 The method in shows segments being processed serially, but in some embodiments, the segments may be processed in parallel (ie, by tile), as described above.

[0104] At step 1314, the processor determines whether there are any more tiles to process. In one embodiment, only those tiles that have hair segments that overlap with the tile are processed. See, e.g. Fig.11 , which shows tile 1102 in bold outline, having hair segments that overlap with the tile. If the processor determines that there are more tiles to process, the method returns to step 1302 described above, where the next tile with overlapping hair segments is selected. If no more tiles are left to be processed, the method terminates. Fig.13 The method in is shown as processing separate tiles and hair segments of tiles with overlapping hair in serial, but it should be noted that these processes can be performed in parallel, for example by launching separate GPU threads.

[0105] Reference back Fig.10 , after performing coarse culling of hair segments using a conservative depth test at step 1006 , the method continues to step 1008 .

[0106] At step 1008, the processor sorts the remaining hair segments into clusters by depth.

[0107] Fig.15Illustrated are tiles organized into clusters by depth according to one embodiment. In some embodiments, each tile can be divided into clusters, such as 32 clusters, in the depth direction. The number of clusters for each tile is configurable. Each cluster can have a boundary at a preconfigured distance from the camera position. The last cluster (away from the camera) can have an outer boundary set to a maximum distance to the scene to be rendered. According to some embodiments, a given hair segment can be classified based on its depth, such that the given hair segment is classified with respect to the cluster(s) with which the hair segment overlaps.

[0108] Fig.15 An example of a tile 1500 is shown. The tile is decomposed into five (5) clusters in the depth direction, namely, clusters 1501, 1502, 1503, 1504, 1505. Fig.15 As shown in the example in , the boundary (in the depth direction) of each cluster varies nonlinearly, so that the distance between the inner cluster boundary and the outer cluster boundary increases with each successive cluster at a distance from the camera. Fig.16 is a graph illustrating how the boundaries of each cluster increase with increasing distance from the camera according to one embodiment. For each tile, the hair segment is clipped into the viewing cone for the tile (i.e., in the x-direction and the y-direction). In some embodiments, if a hair segment spans two clusters (in the z-direction), the hair segment can be clipped at the cluster boundary between the two clusters and divided into two sub-segments, each of which is classified into its corresponding cluster.

[0109] After the hair segments for a tile have been classified by clustering, there may be some clusters that do not have hair segments. A cluster within a tile that includes at least one hair segment or part thereof is called an "active cluster," and a cluster within a tile that does not include a hair segment or part thereof is called an "inactive cluster."

[0110] Fig.17 The active and inactive clusters for a given tile are illustrated in accordance with one embodiment. In the example shown, tile 1702 is selected. In this example, the tiles may be organized into thirteen (13) clusters in the depth direction, numbered 0 to 12. Fig.17 In the embodiment, clusters 0 to 3 and clusters 5 to 12 are "active" clusters, since these clusters include hair segments or parts thereof. Cluster 4 is an "inactive" cluster 1700, since it does not include any hair segments or parts thereof.

[0111] Reference back Fig.10 (i.e., performing front-end rasterization), once this method is complete, the result is that occluded hair segments have been coarsely culled, and the remaining hair segments have been sorted by tile and by clusters within tiles (by depth). In one embodiment, Fig.10The method in is repeated for all valuable persons (e.g., valuable persons with hair), so we end up having classified every hair valuable person. The final rasterization is then performed once. For example, for a scene with five (5) characters, the front-end rasterization and bundle space shading are repeated five (5) times. In one implementation, these processes write to the same buffer. Then, one instance of rasterization is performed, which visits the active clusters and generates pixels in front-to-back order. As described above, this implementation is called "batching" because we do not perform immediate rendering, but batch everything and prepare a large data structure and then do one rasterization at a time.

[0112] Beam Space Shading

[0113] like Fig. 9 As described in , after front-end rasterization is performed at step 904, bundle space shading is performed at step 906. In some embodiments, bundle space shading refers to decoupling the shading of hair bundles from screen coverage. In some implementations, hair shading changes slowly and predictably with the span of the hair bundle. Some disclosed embodiments evaluate the shading of hair bundles at fixed anchor positions and store these color values. Then, while generating pixels covered by hair segments, the rasterizer code can look up two adjacent shading anchor points and interpolate color values ​​between the two adjacent shading anchor points along the hair bundle. Doing so provides significant improvements in performance, especially when there are many layers of hair that need to be rendered on top of each other. Performing bundle space shading also allows the disclosed embodiments to run shading at varying rates if performance requires it and / or if the user so desires.

[0114] In some embodiments, even though the clumps may cover hundreds of pixels in the image, the rasterizer evaluates shading at anchor points (i.e., sample points), and during rasterization, the remaining color values ​​are interpolated. While it is possible to have implementations that do shading at anchor points during rasterization, one implementation is to do it all before rasterization. So once all the culling and shading is done, we then start the rasterizer (again batching), which will then look up and interpolate the closest two values ​​for the generated pixel.

[0115] Fig.18 is a flow chart of method steps for performing beam space shading according to one embodiment. In various implementations, the method may be performed by processor 110, graphics processor 116, or a combination of processor 110 and graphics processor 116. In one implementation, Fig.18 The flowchart in Fig. 9 More details about step 906 in .

[0116] As shown, the method begins at step 1802, where the processor receives a hair tress to be processed. As described, the hair tresses are modeled by an artist. In one implementation, each hair tress is composed of hair segments defined by vertices and interconnections between vertices. In some embodiments, the hair tresses are sparsely modeled, and the processor is configured to upsample the hair tresses to add additional virtual vertices to improve the visual quality of the hair tresses. Each hair tress includes a root (e.g., attached to an object) and a tip at the other end of the hair tress opposite the root. Each hair tress may also include information related to the hair tress, such as a root color, a tip color, and how to interpolate the color between the root and the tip along the hair tress. In one embodiment, the hair color may be linearly interpolated from the root color to the tip color.

[0117] At step 1804, the processor identifies the world space positions of the vertices in the hair strand.

[0118] At step 1806, the processor samples the hair strand at a number N positions along the hair strand. The value of N is configurable. In one implementation, the value of N can be approximately 4-64 samples. In one embodiment, the N samples are evenly spaced along the hair strand. Another embodiment introduces some jitter to also improve aliasing. If you use the same offset and spacing for the anchor points, this may cause aliasing, for example because each of the sample positions samples the shadow at the same interval. However, if you have jitter and random offsets, in some embodiments this may instead add pleasing noise. These offsets can be low difference numbers, such as "blue noise jitter".

[0119] At step 1808, the processor removes invisible samples based on the invisible segments. Fig.13 As described in , the conservative depth test coarsely culls hair segments that are completely occluded by opaque objects. Therefore, at step 1808, any of the N samples along the hair strand associated with the hair segment that was coarsely culled based on the conservative depth test may also be culled. One embodiment reuses the visibility information output from the front-end culling. For example, each segment ID has a 1-bit value that the shading task is "ready" to consider, and a list of shading tasks is generated only for visible segments.

[0120] At step 1810, the processor calculates lighting and shading for the visible samples. Visible samples are those samples that were not culled at step 1808. Step 1810 takes into account lighting, shadows, and interpolated color values ​​at the visible sample locations based on color interpolation between the root and tip of the hair strand. Some embodiments also do things like simulate deep scattering within the hair curl at this step to introduce nice translucency effects. Simulating deep scattering can be part of calculating shadows.

[0121] At step 1812, the processor stores the color value for the visible sample in a shading store. The shading store is a buffer that will later be exposed to the rasterizer so it can do a color lookup for a given pixel, as described in more detail below. In one implementation, all valuables are written to the same shading store so that the rasterizer has access to the shading for each valuable; thus, the rasterizer can rasterize how once without having to spin it up again and again for each character (i.e., waste overhead).

[0122] At step 1814, the processor determines whether there are any more hair tresses to process for the given person. If so, the method returns to step 1802, where the next hair tress is selected for processing. If the processor determines that there are no more hair tresses to process, the method terminates.

[0123] Fig.18 The method may be repeated for each character (ie, a person of value) that includes a hair strand, and the results may be stored in a shading memory with separate offsets per character.

[0124] Fig.19 1 is a conceptual diagram illustrating clump space shading according to one embodiment. An example hair clump 1900 is shown. In the example shown, the hair clump 1900 has been straightened into a line for ease of description. In one example, the hair clump 1900 may cover approximately 800 pixels in screen space. The hair clump 1900 may be sampled at configurable intervals (e.g., every 3 pixels) along its length, resulting in samples 1910 (note that for clarity, the samples are not shown in FIG. 1 ). Fig.19 Only 5 samples are shown).

[0125] The hair strand 1900 can be visualized as a gradient 1900A. The gradient 1900A includes a root color 1902 of the hair strand 1900 and a tip color 1904 of the hair strand 1900. The colors along the gradient 1900A can be interpolated 1906 (e.g., linearly) between the root color 1902 and the tip color 1904. In one implementation, the artist provides the root color and the tip color, but the hue for the hair comes from shadow and anisotropic lighting simulations and deep scattering simulations. It should be noted that these simulations can be evaluated at anchor points.

[0126] As described, invisible samples (i.e., samples corresponding to invisible hair segments) are culled, and shading information is calculated for visible samples. The results of this sparse shading (i.e., color information at the sample locations) are saved in shading storage 1950. In the example shown, the entire length of the hair strand 1900 is visible, so each sparsely colored sample for the hair strand is saved in shading storage 1950. Fig.18 shows a serial process, but again, Fig.18 The method shown in can be performed in parallel with one thread per hair segment, and then all characters are processed in parallel.

[0127] Rasterization

[0128] After the front-end rasterization (i.e., step 904) is complete and the bundle space shading information has been pre-stored in the shading storage (i.e., step 906), the tiles with potentially visible hair can be rasterized (i.e., step 908). Each tile of the render target can be processed independently, for example by a separate GPU thread. The result of this hair rasterization step is a hair overlay that can be simply applied on top of the rest of the rendered image, which can be rendered based on the underlying polygonal geometry. In one embodiment, there is a single tile queue, and multiple tile processors collaboratively grab work from the tile queue. Only active tiles are in the tile queue, so we never touch inactive tiles. An active tile can be a tile with at least one active cluster. An active cluster is a cluster with at least one visible segment. In another implementation, there can be multiple tile queues, with each processor anchored to pull work from their respective tile queues. The hardware may implement it this way. Then, you can have the coarse rasterizer submit tiles to different queues as a load balancing mechanism.

[0129] Fig. 20 is a flow chart for rasterizing a tile having potentially visible hair according to one embodiment. In various implementations, the method may be performed by the processor 110, the graphics processor 116, or a combination of the processor 110 and the graphics processor 116. In one implementation, Fig. 20 The flowchart in Fig. 9 More details about step 908 in.

[0130] As shown, the method begins at step 1802, where the processor selects the first tile to be processed. As described above, the hair segments within the tile have been sorted into clusters by depth (e.g., see Fig.10 1008 in step 1008).

[0131] At step 2004, the processor selects the first active cluster to be processed in a given tile. Since hair is layered, it should be rendered front to back (from the camera's point of view) to achieve appropriate results. Figure 15-17As described in , each tile is decomposed into clusters by depth. Active clusters are those clusters within a tile that have overlapping hair segments. At step 2004, the first active cluster is selected as the next cluster in order from the camera's perspective, which next cluster includes visible hair segments. Considering that hair is layered, selecting the next active cluster (in order) provides appropriate rendering results through front-to-back rendering, as described above. A bit mask (e.g., "1100101001") can be used to track active clusters, and we can just run the "find first set" hardware instruction to get the next active cluster index. Whenever we retire a cluster, the bit for that cluster is turned off from 1 to 0.

[0132] At step 2006, the processor selects the first hair segment in the first active cluster. In one embodiment, each hair segment in the first active cluster is processed. The order in which the hair segments in the first active cluster are processed is not critical, because the hair segments in the first active cluster can be processed in any order. In one embodiment, each hair segment is processed by starting a separate GPU thread. In one implementation, the tile processor contains 256 threads, so we process 256 hair segments in parallel. There can be several processors, each of which works on its own tile. Thus, processing occurs in parallel.

[0133] Optionally, in some embodiments, at step 2006, the processor may further tessellate the selected first hair segment into sub-segments. In one embodiment, to perform tessellation, for each visible hair segment of the hair bundle (i.e., after coarse culling using conservative depth test), the visible hair segment may be decomposed into a number M of sub-segments. In one implementation, M=4 and each hair segment is decomposed (i.e., tessellated) into 4 sub-segments. Thus, in some embodiments, a tessellation may be performed on the sub-segments after tessellation. Fig. 20 Thus, depending on the implementation, the reference to a "hair segment" Fig. 20The remaining steps in can refer to the original hair segment (before refinement) or the sub-segments (after refinement). The curvature information of the hair segment is known from the two vertices of the hair segment and the tangents that make up the hair segment. This data allows us to "sample" the hair segment and subdivide it into finer sub-segments. The tangents are what give us the curve of the newly refined sub-segments, this is because they allow us to say what the "derivative" at a specific point should be, and this forces the new point to follow the curve. In one implementation, cubic splines can be used. Because the refinement is done on the chip at rasterization time in registers, we do not pay the additional memory overhead for the details. As a result, in some implementations, refinement can be performed adaptively. For example, when far away from the camera, no refinement is required. Also, in some implementations, if the hair segment is fairly straight (e.g., within a threshold), it does not need to be refined.

[0134] At step 2008, the processor determines the number of pixels in width and the number of pixels in height of the hair segment within the tile. In some embodiments, the processor determines the number of pixels to be rasterized for a given hair segment based on its orientation. Fig.21A is an example of the orientation of a light hair segment relative to the tile, and Fig.21B is an example of a steep hair segment oriented relative to a tile. As used herein, a shallow hair segment is a hair segment that spans more pixels in the x-direction than it does in the y-direction. As used herein, a steep hair segment is a hair segment that spans more pixels in the y-direction than it does in the x-direction.

[0135] exist Figures 21A-21B In the example in , the pixel tiles are 8×8 pixel tiles. Fig.21A The hair segment 1202 in has a vertex that falls outside the tile boundary. The hair segment 1202 is considered a shallow hair segment because it spans more pixels in the x direction (ie, 8 pixels) than it spans in the y direction (ie, 5 pixels). Fig.21B The hair segment 1204 in has a vertex that also falls outside the tile boundary. The hair segment 1204 is considered a steep hair segment because it spans more pixels in the y direction (ie, 8 pixels) than it spans in the x direction (ie, 5 pixels).

[0136] At step 2010, the processor determines the number of pixels to be rasterized for the first hair segment based on the number of pixels in width and the number of pixels in height. In one embodiment, the number of pixels to be rasterized for the first hair segment is determined as the maximum of the number of pixels in width and the number of pixels in height within the tile of the first hair segment. Fig.21A and Fig.21B In the example of , the number of pixels to be rasterized for both hair segments 1202, 1204 would be determined to be eight (8).

[0137] At step 2012, the processor generates a one-pixel wide line based on the number of pixels to be rasterized for the first hair segment. In some implementations, the hair geometry is thinner than the width of a single pixel. To generate the one-pixel wide line, the processor pads one pixel in the primary direction (i.e., the direction with greater tile coverage) and walks diagonally down the hair segment to match the number of pixels of coverage in the secondary direction (i.e., the direction with less tile coverage). Fig.21A In FIG. 1 , the colored pixels 1206 are the pixels selected for a one-pixel wide line. Fig.21A As shown in , eight (8) pixels are selected to be rasterized.

[0138] At step 2014, for each pixel of the one-pixel-wide line, the processor looks up in the bundle space shading for the color of the pixel. Figure 18-19 As described in , bundle space shading provides a shading storage buffer including color information for sparsely sampled positions along a hair bundle. For a given pixel, at step 2014, the processor searches the bundle space shading buffer for the hair bundle associated with the first hair segment being processed, and identifies the position of the pixel as being between two sparsely sampled shading positions. Each of the two adjacent sparsely sampled shading positions is associated with a color value in the shading storage. The processor then interpolates between the two color values ​​to determine the color of a given pixel for a line of one pixel. This process of searching and interpolating in the shading storage is repeated for each pixel of the line of one pixel to determine the color of each pixel for the line of one pixel. The result of completing step 2014 is that each pixel of the line of one pixel is associated with its own color value. In some embodiments, the depth in the z direction of each pixel of the one-pixel wide line is also stored based on the depth value of the hair segment at the corresponding pixel. In some optional implementations, the depth can be beneficial for things like camera depth of field blur or motion blur. If those effects are not needed, the storage depth can be omitted.

[0139] However, as shown, a one-pixel wide line can be a jagged line, so that if it were to be rasterized directly, the result would also be jagged. Therefore, embodiments of the present disclosure provide analytical anti-aliasing to smooth rasterization.

[0140] At step 2016, the processor converts each pixel of the one-pixel line into a two-pixel pair to generate a two-pixel wide line. In one embodiment, for each pixel of the one-pixel line, to determine which pixel should be selected as the pixel for the two-pixel pair, the processor determines which two pixel centers (e.g., vertically) the hair segment is between, and selects another pixel as the pixel for the two-pixel pair.

[0141] Fig. 22 is an example illustrating a two-pixel wide line according to one embodiment. Fig. 22 Involved Fig.21A The hair segment 1202 shown in FIG. Fig. 22 In the example, a line of one pixel (i.e., Fig.21A ) has been expanded into a pair of two pixels, forming a two-pixel wide line.

[0142] For pixel 1210A, pixel 1210B is selected as the other pixel for pixel pair 1212 because the hair segment passes between the pixel centers (in the vertical direction) of pixel 1210A and pixel 1210B.

[0143] In one embodiment, for each pixel of a line of pixels, the color value of the pixel is copied to the other pixel of the pair of two pixels. Fig. 22 As shown in , pixels 1210A and 1210B form a pixel pair 1212. The color value of pixel 1210A is determined by looking up and interpolating in the bundle space shading storage. The resulting color value is then copied to pixel 1210B. In some embodiments, the depth value of a given pixel of a one-pixel-wide line is also copied to the second pixel of the two-pixel pair.

[0144] To perform analytical anti-aliasing, in some embodiments, the processor may assign different opacities to pixels of a pixel pair even if the color of the two pixels of the pixel pair are the same.

[0145] At step 2016, for each pixel pair, the processor distributes opacity between the pixels of the pixel pair. Opacity is distributed between the two pixels of the pixel pair based on where the hair segment cuts between the two pixels of the pixel pair. In one embodiment, opacity is distributed based on the coverage of the hair segment between the two pixels of the pixel pair. For example, if the coverage of the hair segment between the two pixels in the pixel pair is distributed as 60% and 40%, then opacity will be distributed as 60% and 40% respectively. If the hair segment is entirely covered in one pixel of the pixel pair, then opacity can be distributed as 100% (covered pixel) and 0% (uncovered pixel). In another embodiment, opacity can be distributed based on how closely the hair segment passes between the pixel centers of the two pixels of the pixel pair. The result of performing this so-called analytical anti-aliasing is a two-pixel-wide line of pixels formed by the pair of two pixels to be rasterized, wherein the color of each pixel is the same for all two pixels of each pixel pair, but opacity is distributed between the pixels in each pixel pair. In one implementation, there is one thread mapped to one pixel pair. Therefore, with respect to the previous number of 256 threads, one implementation can process 256 pixel pairs in parallel per processor (and there are several processors in flight). Each thread independently looks up and interpolates color values. It is natural to copy the color to the second pixel of the pixel pair, since one thread is responsible for two pixels (i.e., pixel pairs). When we inject color values ​​into the slice, we can use synchronization primitives, since when we process these pixel pairs in parallel, multiple lines can "overlap" each other, since our group of 256 threads can be mapped on several line segments and they can cross each other. While we inject color information into the slice data structure, only pixels with conflicts are resolved.

[0146] At step 2020, the processor culls invisible pixels based on a per-pixel depth test. Each of the two-pixel wide lines of pixels is tested against the geometry of the render target to cull any pixels that are obscured by an opaque object. This culling removes any hair pixels that are in the two-pixel wide line that are at the edge and "behind" the opaque object from the camera's perspective. Performing this per-pixel culling is an operation that allows some embodiments to simply overlay the final hair color (e.g., hair cover layer) over the opaque scene, since we have already removed all pixels from the hair cover layer that would block the hair.

[0147] At step 2022, for each non-rejected pixel of the two-pixel wide line, the processor renders the pixel into one of the P slices for the pixels in the current cluster. In one embodiment, each cluster can be further subdivided into P slices for each pixel by depth. For example, a slice can be represented by a 6-bit number, resulting in P=64 slices per pixel per cluster. In one implementation, the P slices are evenly distributed along the depth of the cluster by depth. At step 2022, for each pixel that is not rejected by the depth test per pixel, the pixel is assigned to one of the P slices. In one implementation, the color value for the pixel is saved in a buffer that includes space for each slice. If a given pixel is assigned to a slice that has not yet had other pixels assigned to it (i.e., from other hair segments in the cluster that overlap with the pixel), then the color value and opacity value for the pixel are added to the buffer at a position corresponding to the slice. If a given pixel is assigned to a slice that has another pixel assigned to it, then a linked list containing the color value and opacity value for the pixel assigned to the slice can be formed. Once all pixels and all hair segments for a cluster have been processed, the color values ​​and opacity values ​​in the linked list for a slice (which has multiple pixels assigned to it) can be averaged together to give a single color value and a single opacity value for that slice for that pixel.

[0148] In another implementation, instead of averaging the color values ​​on the "collisions" where the linked list is performed, the list chain can be sorted in front-to-back order, which can give better results. However, this may be too much, because the cluster "distribution" is non-linear and there are 64 slices for each cluster, which gives us sufficient resolution. Thus, clusters along the depth provide "low effort" sorting. Moreover, since we process clusters one at a time, once we are done with the cluster, all intermediate memory for the cluster can be thrown away, and we can reuse the memory for the next cluster. This is a huge advantage, because the memory is transient. We completely complete the cluster before moving to the next cluster, so we do not need to allocate intermediate storage for all P slices of the entire rendering target (e.g., a 4K rendering target), but need to allocate intermediate storage for the total number of "processors" in flight in parallel. For example, if you have 12 processors in flight, then you only allocate storage for 12 P slices of the cluster. Even if your render target is 4K and has 32 clusters × 480 tiles in the x direction × 270 tiles in the Y using 8×8 tiles, this would be 4147200 cluster P slice memories (i.e., 32×480×270 = 4147200). However, the disclosed process of processing clusters front to back and completing one cluster before moving on to the next allows us to allocate only as much as we can process in parallel.

[0149] At step 2024, the processor determines if there are any more hair segments to process for a given cluster. If so, the method returns to step 2006 described above, and processes another hair segment in the cluster. If not, the method continues to step 2026. In one implementation, we have 256 threads per processor, so we can process 256 hair segments in parallel. Once we determine 256 different pixel values ​​(based on the orientation of the line), we can begin mapping the 256 threads in parallel on the pixels until we have consumed all the pixels belonging to the current set of 256 segments. Then, we grab 256 more segments (or grab fewer segments if we are at the end of the buffer for the current cluster).

[0150] At step 2026, the processor accumulates the color and opacity for each pixel of the tile. The color of a given pixel may be accumulated by averaging the color values ​​of the P slices for the pixel by averaging the color values ​​stored in the P slices for the pixel.

[0151] However, cumulative opacity is done in a sorted fashion over the P slices, since hair should be rendered front-to-back, as discussed above. Fig.2323 is a conceptual diagram illustrating how opacity is accumulated according to one embodiment. As described above, when rendering hair, one embodiment renders into the scene from camera position 2300 from front to back to account for the layering of hair. Fig.23 In the example in , there are four (4) hair segments that overlap with a given pixel for which opacity is accumulated, i.e., hair segments 2302, 2304, 2306, 2308. These hair segments have been rasterized into four separate slices within the cluster and correspond to the same pixel position. For each hair segment, color values ​​and opacity values ​​have been assigned to different corresponding slices based on depth. In one example, for ease of discussion, a 50% opacity value has been assigned to the pixels corresponding to each of the hair segments 2302, 2304, 2306, 2308.

[0152] To accumulate opacity, we start with 100% visibility (i.e., 0% opacity) for a pixel and proceed into the scene from camera position 2300. Each slice is checked for any pixels corresponding to a hair segment at that slice for that pixel. When a slice is encountered that includes opacity information (and color information), opacity is accumulated based on the opacity assigned to that slice. Fig.23 In the example in , the slice (pixel) corresponding to the hair segment 2302 is first encountered, which has 50% opacity. Therefore, the overall opacity is accumulated at 50% (i.e., 50% of 100% visibility = 50% opacity). Then, the next slice encountered is associated with the pixel corresponding to the hair segment 2304, which also has 50% opacity. Among the remaining 50% visibility, 50% more opacity is accumulated, thereby obtaining 25% visibility (i.e., 75% opacity). Then, the next slice encountered is associated with the pixel corresponding to the hair segment 2306, which also has 50% opacity. Among the remaining 25% visibility, 50% more opacity is accumulated, thereby obtaining 12.5% ​​visibility (i.e., 87.5% opacity). Continuing, the next (last) slice encountered is associated with the pixel corresponding to the hair segment 2308, which also has 50% opacity. Of the remaining 12.5% ​​visibility, 50% more opacity is accumulated, resulting in 6.25% visibility (ie, 93.75% opacity). Opacity may be accumulated in this manner for each pixel of the tile.

[0153] The result of completing step 2024 is a color value and an opacity value for each pixel of the tile. At step 2028, the processor determines whether the opacity of each pixel with potentially visible hair (i.e., hair that was not culled using conservative depth culling) has reached an opacity threshold. If so, the method terminates. If not, the method returns to step 2004, where the next active cluster for the given tile is selected and opacity is further accumulated with respect to the next active cluster. Thus, if we terminate a cluster early because the opacity of each pixel with potentially visible hair has reached the opacity threshold, then we discard all other clusters belonging to the tile, and we look for additional work on a different tile in the tile queue. If there are no tiles remaining in the queue, then the rasterizer is done processing.

[0154] In one implementation, the opacity threshold per pixel is 97.5%. The opacity threshold is configurable. Using the example opacity threshold of 97.5%, the pixels shown for the first cluster are processed Fig.23 The opacity in (i.e., 93.75% opacity) does not meet the opacity threshold, so according to Fig. 20 method to process the next cluster and further accumulate opacity with respect to the next active cluster.

[0155] If all active clusters have been processed and the opacity threshold has not yet been reached for each pixel with potentially visible hair in a given tile, the method terminates. In some implementations, this may occur in the case of individual "wisps" of hair extending from a character such that there are not enough strands of hair covering a given pixel to reach the opacity threshold. Thus, each cluster will be evaluated and the pixel will be rasterized at an opacity below the opacity threshold. As described above, terminating a cluster early because the opacity of each pixel with potentially visible hair has reached the opacity threshold gives a performance improvement.

[0156] Fig. 20 The method shown in can be repeated for each tile with potentially visible hair (i.e., hair that is not culled using conservative depth culling). Fig. 20 The result of the method is a rasterized hair overlay that can be applied on top of a rendered image (without hair) to render an overall image. Each pixel of the rasterized hair overlay will include a color value and an opacity value for the hair at that pixel.

[0157] Automatic LOD (Level of Detail)

[0158] In some embodiments, when rendering hair strands that end up contributing to a small portion of the screen space, the level of detail (LOD) can be reduced to maintain performance. In one implementation, when it is time to render the hair of a valuable person (e.g., a character), the processor determines the estimated "screen coverage" of the valuable person's hair. For example, the determination can be based on a sphere of the valuable person's head projected to the screen. This gives a heuristic for the percentage of the screen covered by the valuable person's hair.

[0159] Based on this estimated percentage of screen coverage, some of the hair bundles modeled for the valuable person are eliminated. Eliminating hair bundles is accomplished by randomly eliminating some of the hair bundles of the valuable person based on the percentage of screen coverage (i.e., a smaller percentage of screen coverage results in a higher percentage of eliminated hair bundles). Thus, a lower number of hair bundles are submitted to the rasterizer. Typically, randomly eliminating triangles in polygonal mesh geometry would not be possible without re-stitching the geometry to account for the eliminated triangles. However, with respect to hair, some embodiments may randomly eliminate hair bundles to perform LOD on the hair of the valuable person. Thus, the number of hair bundles to be submitted to the rasterizer is driven by a heuristic that depends on an estimate of how much screen area the valuable person's head covers. As an example, valuable people that are farther from the camera cover a smaller area on the screen, and therefore, more of the hair bundles for those valuable people may be randomly eliminated for rendering.

[0160] in conclusion

[0161] All references, including publications, patent applications, and patents, cited herein are hereby incorporated by reference to the same extent as if each reference were individually and specifically indicated to be incorporated by reference and were set forth in its entirety herein.

[0162] The use of the terms "one" and "an" and "the" and "at least one" and similar references in the context of describing the present invention (especially in the context of the appended claims) should be understood to cover both the singular and the plural, unless otherwise indicated herein or the context is clearly contradictory. The use of the term "at least one" (e.g., "at least one of A and B") followed by a list of one or more items should be understood to mean one item (A or B) selected from the listed items or any combination of two or more of the listed items (A and B), unless otherwise indicated herein or the context is clearly contradictory. The terms "consisting of," "having," "including," and "comprising" should be understood as open terms (i.e., meaning "including but not limited to"), unless otherwise indicated. The recording of a range of values ​​herein is intended only to serve as a shorthand method of referring to each individual value falling within the range, unless otherwise indicated herein, and each individual value is incorporated into the specification as if it were recorded separately herein.

[0163] All methods described herein can be performed in any suitable order, unless otherwise indicated herein or the context is otherwise clearly contradictory. The use of any and all examples or exemplary language (e.g., "such as") provided herein is intended only to better illustrate the present invention, and does not limit the scope of the present invention, unless otherwise claimed. The language in the specification should not be understood to indicate any unclaimed elements that are necessary for the practice of the present invention.

[0164] Preferred embodiments of the present invention are described herein. Variations of those preferred embodiments may become apparent to those skilled in the art upon reading the above description. The inventors expect those skilled in the art to adopt such variations when appropriate, and the inventors intend to practice the present invention in other ways except as specifically described herein. Accordingly, the present invention includes all modifications and equivalent substitutions of the subject matter recorded in the appended claims as permitted by applicable law. In addition, any combination of the elements described above in all possible variations thereof is encompassed by the present invention, unless otherwise indicated herein or the context otherwise clearly contradicts.

[0165] It should be understood that the original applicant determines in this article which technologies to use and / or productize based on their usefulness and relevance in the evolving field and what is best for it and its participants and users. Accordingly, it may be the case that the systems and methods described herein have not yet and / or will not be used and / or productized by the original applicant in the future. It should also be understood that the implementation and use (if any) of the systems and methods described herein by the original applicant is performed in accordance with its privacy policy. These policies are intended to respect and prioritize participant privacy and meet or exceed government and legal requirements in the corresponding jurisdictions. To the extent that such implementation or use of these systems and methods enables or requires the processing of user personal information, such processing is: (i) performed as outlined in the privacy policy; (ii) performed in accordance with effective legal mechanisms, including but not limited to providing adequate notice or obtaining the consent of the corresponding user when required; and (iii) performed in accordance with the privacy settings or preferences of the participants or users. It should also be understood that it is the intent of the Original Applicant that the systems and methods described herein, if implemented or used by other entities, comply with privacy policies and practices consistent with its purpose of respecting the privacy of participants and users.

Claims

1. A method for hair light rasterization, the method comprising: receiving, by one or more processors, hair data for a person of value, wherein the hair data includes one or more hair bundles associated with the person of value, and each hair bundle includes one or more hair segments; determining, by the one or more processors, a first set of hair segments that are not completely obscured by one or more opaque objects relative to a position of a camera configured to capture an image of a scene including the person of value; classifying, by the one or more processors, each hair segment in the first set of hair segments into one or more buckets corresponding to one or more tiles of pixels overlapped by the hair segment in screen space; for each bucket corresponding to a given tile of pixels, further classifying, by the one or more processors, each hair segment in the bucket for the given tile into clusters arranged by depth from the position of the camera; for each tile of pixels, rasterizing, by the one or more processors, hair segments included in a first cluster for the tile, the first cluster for the tile being a cluster closest to a location of the camera and including at least one hair segment, and accumulating, by the one or more processors, a color and an opacity for each pixel of the tile based on rasterizing the hair segments included in the first cluster; as well as combining, by the one or more processors, tiles comprising pixels of rasterized hair segments to generate a hair overlay layer, wherein the hair overlay layer is configured to be applied atop a rendered image of an object in the scene to add hair to the rendered image, Wherein determining a first set of hair segments whose positions relative to the camera are not completely obscured by one or more opaque objects comprises: for each pixel in screen space, determining a distance from the camera's position to the closest opaque surface covered by the pixel as a per-pixel distance for the pixel; as well as for each tile of pixels, accumulating per-pixel distances for pixels associated with the tile to determine a conservative depth value for the tile, wherein the conservative depth value is a value equal to a maximum per-pixel distance between pixels of the tile, and Wherein rasterizing the hair segments included in the first cluster for the tile includes culling invisible hair segments using the conservative depth value.

2. The method of claim 1 , wherein determining a first set of hair segments that are not completely obscured by one or more opaque objects relative to the camera further comprises: Based on determining that at least a portion of the hair segment is closer to the camera position than a conservative depth value for the tile corresponding to the portion of the hair segment, determining that the hair segment is included in the first set of hair segments that are not completely obscured by one or more opaque objects. 3 . The method of claim 1 , wherein for a first tile of pixels, a size of a cluster of pixels for the first tile in a depth direction relative to the position of the camera increases non-linearly with increasing distance from the position of the camera.

4. The method of claim 1 , wherein for a first cluster of a first tile, rasterizing hair segments associated with the first cluster comprises: determining a number of pixels to be rasterized for the hair segment; generating a one-pixel wide line for the hair segment based on the determined number of pixels to be rasterized for the hair segment; for each pixel of the one-pixel-wide line, performing a lookup in a bundle space shading store to determine a color value for the pixel; converting each pixel of the one-pixel wide line into a two-pixel pair to generate a two-pixel wide line for the hair segment, wherein for a given pixel of the one-pixel line, the determined color value for the given pixel is copied to the other pixel of the two-pixel pair for the given pixel; for each pair of pixels making up the two-pixel-wide line, distributing opacity between the two pixels of the two-pixel pair; as well as Any occluded pixels are culled by performing a per-pixel depth test against opaque objects in the scene.

5. A method according to claim 4, wherein a first pixel pair includes a first pixel and a second pixel, and distributing opacity between the first pixel and the second pixel in the first pixel pair is based on determining a relative coverage range between the first pixel and the second pixel of a first hair segment overlapping the first pixel and the second pixel.

6. The method of claim 4, further comprising generating the color values ​​stored in the bundle space shading storage, comprising: receiving hair clump data for a first hair clump, wherein the hair clump data includes a root color at a root of the first hair clump, a tip color at a tip of the first hair clump, and information related to how to interpolate color along the first hair clump from the root to the tip; Sampling the hair bundle at a number N of positions along the first hair bundle; culling sample positions corresponding to hair segments of the first hair bundle that are not included in a first set of hair segments that are not completely occluded by one or more opaque objects to generate a set of visible sample positions for the first hair bundle; performing shading at the visible sample positions; as well as The results of performing the shading are stored in the bundle space shading storage.

7. The method of claim 1 , wherein for a first pixel of a first tile, accumulating a color for the first pixel comprises: Color values ​​associated with pixels corresponding to rasterized hair segments included in a first cluster for the first tile that overlap a position of the first pixel in screen space are averaged.

8. The method of claim 1 , wherein for a first pixel of a first tile, accumulating opacity for the first pixel comprises: receiving a buffer of opacity values ​​corresponding to rasterized hair segments included in a first cluster for the first tile that overlap with a position of the first pixel in screen space, wherein the buffer of opacity values ​​is sorted in order based on a closest distance to a position of the camera; as well as The opacity for the first pixel is accumulated based on an order of opacity values ​​in the opacity value buffer.

9. A non-transitory computer-readable storage medium storing instructions that, when executed by one or more processors, cause a computing device to perform hair light rasterization by performing the following steps: receiving hair data for a person of value, wherein the hair data includes one or more hair bundles associated with the person of value, and each hair bundle includes one or more hair segments; determining a first set of hair segments that are not completely obscured by one or more opaque objects relative to a position of a camera configured to capture an image of a scene including the person of value; sorting each hair segment in the first set of hair segments into one or more buckets corresponding to one or more tiles of pixels overlapped by the hair segment in screen space; for each bucket corresponding to a given tile of pixels, further classifying each hair segment in the bucket for the given tile into clusters arranged by depth from the position of the camera; for each tile of pixels, rasterizing hair segments included in a first cluster for the tile, the first cluster for the tile being a cluster closest to a location of the camera that includes at least one hair segment, and accumulating a color and opacity for each pixel of the tile based on rasterizing the hair segments included in the first cluster; and combining tiles comprising pixels of rasterized hair segments to generate a hair overlay layer, wherein the hair overlay layer is configured to be applied on top of a rendered image of an object in the scene to add hair to the rendered image, Wherein determining a first set of hair segments whose positions relative to the camera are not completely obscured by one or more opaque objects comprises: for each pixel in screen space, determining a distance from the camera's position to the closest opaque surface covered by the pixel as a per-pixel distance for the pixel; as well as for each tile of pixels, accumulating per-pixel distances for pixels associated with the tile to determine a conservative depth value for the tile, wherein the conservative depth value is a value equal to a maximum per-pixel distance between pixels of the tile, and Wherein rasterizing the hair segments included in the first cluster for the tile includes culling invisible hair segments using the conservative depth value.

10. The computer-readable storage medium of claim 9, wherein determining a first set of hair segments that are not completely obscured by one or more opaque objects relative to the position of the camera further comprises: Based on determining that at least a portion of the hair segment is closer to the camera position than a conservative depth value for the tile corresponding to the portion of the hair segment, determining that the hair segment is included in the first set of hair segments that are not completely obscured by one or more opaque objects.

11. The computer-readable storage medium of claim 9, wherein for a first tile of pixels, a size of a cluster of pixels for the first tile in a depth direction relative to the position of the camera increases non-linearly with increasing distance from the position of the camera.

12. The computer-readable storage medium of claim 9, wherein for a first cluster of a first tile, rasterizing hair segments associated with the first cluster comprises: determining a number of pixels to be rasterized for the hair segment; generating a one-pixel wide line for the hair segment based on the determined number of pixels to be rasterized for the hair segment; for each pixel of the one-pixel-wide line, performing a lookup in a bundle space shading store to determine a color value for the pixel; converting each pixel of the one-pixel wide line into a two-pixel pair to generate a two-pixel wide line for the hair segment, wherein for a given pixel of the one-pixel line, the determined color value for the given pixel is copied to the other pixel of the two-pixel pair for the given pixel; for each pair of pixels making up the two-pixel-wide line, distributing opacity between the two pixels of the two-pixel pair; as well as Any occluded pixels are culled by performing a per-pixel depth test against opaque objects in the scene.

13. A computer-readable storage medium according to claim 12, wherein a first pixel pair includes a first pixel and a second pixel, and distributing opacity between the first pixel and the second pixel in the first pixel pair is based on determining a relative coverage of a first hair segment overlapping the first pixel and the second pixel between the first pixel and the second pixel.

14. The computer-readable storage medium of claim 12, wherein the step of generating the color values ​​stored in the bundle space shading storage comprises: receiving hair clump data for a first hair clump, wherein the hair clump data includes a root color at a root of the first hair clump, a tip color at a tip of the first hair clump, and information related to how to interpolate color along the first hair clump from the root to the tip; Sampling the hair bundle at a number N of positions along the first hair bundle; culling sample positions corresponding to hair segments of the first hair bundle that are not included in a first set of hair segments that are not completely occluded by one or more opaque objects to generate a set of visible sample positions for the first hair bundle; performing shading at the visible sample positions; as well as The results of performing the shading are stored in the bundle space shading storage.

15. The computer-readable storage medium of claim 9, wherein for a first pixel of a first tile, accumulating a color for the first pixel comprises: Color values ​​associated with pixels corresponding to rasterized hair segments included in a first cluster for the first tile that overlap a position of the first pixel in screen space are averaged.

16. The computer-readable storage medium of claim 9, wherein for a first pixel of a first tile, accumulating opacity for the first pixel comprises: receiving a buffer of opacity values ​​corresponding to rasterized hair segments included in a first cluster for the first tile that overlap with a position of the first pixel in screen space, wherein the buffer of opacity values ​​is sorted in order based on a closest distance to a position of the camera; as well as The opacity for the first pixel is accumulated based on an order of opacity values ​​in the opacity value buffer.

17. A device for rasterizing hair, the device comprising: a memory for storing instructions; as well as One or more processors configured to execute the instructions to cause the device to: receiving hair data for a person of value, wherein the hair data includes one or more hair bundles associated with the person of value, and each hair bundle includes one or more hair segments; determining a first set of hair segments that are not completely obscured by one or more opaque objects relative to a position of a camera configured to capture an image of a scene including the person of value; sorting each hair segment in the first set of hair segments into one or more buckets corresponding to one or more tiles of pixels overlapped by the hair segment in screen space; for each bucket corresponding to a given tile of pixels, further classifying each hair segment in the bucket for the given tile into clusters arranged by depth from the position of the camera; for each tile of pixels, rasterizing hair segments included in a first cluster for the tile, the first cluster for the tile being a cluster closest to a location of the camera that includes at least one hair segment, and accumulating a color and opacity for each pixel of the tile based on rasterizing the hair segments included in the first cluster; and combining tiles comprising pixels of rasterized hair segments to generate a hair overlay layer, wherein the hair overlay layer is configured to be applied on top of a rendered image of an object in the scene to add hair to the rendered image, Wherein determining a first set of hair segments whose positions relative to the camera are not completely obscured by one or more opaque objects comprises: for each pixel in screen space, determining a distance from the camera's position to the closest opaque surface covered by the pixel as a per-pixel distance for the pixel; as well as for each tile of pixels, accumulating per-pixel distances for pixels associated with the tile to determine a conservative depth value for the tile, wherein the conservative depth value is a value equal to a maximum per-pixel distance between pixels of the tile, and Wherein rasterizing the hair segments included in the first cluster for the tile includes culling invisible hair segments using the conservative depth value.

18. The apparatus of claim 17, wherein for a first cluster of a first tile, rasterizing hair segments associated with the first cluster comprises: determining a number of pixels to be rasterized for the hair segment; generating a one-pixel wide line for the hair segment based on the determined number of pixels to be rasterized for the hair segment; for each pixel of the one-pixel-wide line, performing a lookup in a bundle space shading store to determine a color value for the pixel; converting each pixel of the one-pixel wide line into a two-pixel pair to generate a two-pixel wide line for the hair segment, wherein for a given pixel of the one-pixel line, the determined color value for the given pixel is copied to the other pixel of the two-pixel pair for the given pixel; for each pair of pixels making up the two-pixel-wide line, distributing opacity between the two pixels of the two-pixel pair; as well as Any occluded pixels are culled by performing a per-pixel depth test against opaque objects in the scene.

19. A device according to claim 18, wherein a first pixel pair includes a first pixel and a second pixel, and distributing opacity between the first pixel and the second pixel in the first pixel pair is based on determining a relative coverage of a first hair segment overlapping the first pixel and the second pixel between the first pixel and the second pixel.

20. The apparatus of claim 18, wherein executing the instructions further causes the apparatus to generate a color value stored in the bundle space shading storage, wherein generating a color value comprises: receiving hair clump data for a first hair clump, wherein the hair clump data includes a root color at a root of the first hair clump, a tip color at a tip of the first hair clump, and information related to how to interpolate color along the first hair clump from the root to the tip; Sampling the hair bundle at a number N of positions along the first hair bundle; culling sample positions corresponding to hair segments of the first hair bundle that are not included in a first set of hair segments that are not completely occluded by one or more opaque objects to generate a set of visible sample positions for the first hair bundle; performing shading at the visible sample positions; as well as The results of performing the shading are stored in the bundle space shading storage.

Citation Information

Patent Citations

  • Method for drafting pelage-shaped pattern in profile region with accelerative GPU

    CN101281655A

  • Method for automatically generating three-dimensional head portrait

    CN103366400A

  • Infinite complexity deep-framebuffer rendering

    US20110102440A1

  • Bit-count texture format

    US20150054845A1

  • Culling objects from a 3-d graphics pipeline using hierarchical z buffers

    US20170372509A1