Game program, game system, game processing method, and game device
Patent Information
- Application Number
- JP2023149297
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-09-14
- Publication Date
- 2024-09-09
- Estimated Expiration
- 2043-09-14
AI Technical Summary
Existing methods for expressing shadows in game processing are not suitable for orthographic projection, which is used in 2D-style games, leading to unsuitable shadow representation.
A configuration that includes controlling player character objects and virtual cameras in a virtual space, using SSAO-based occlusion determination, depth testing, and adjusting depth values and normal vectors to draw 2D-like shadows, while employing SSAO processing to enhance shadow clarity and ignore depth differences.
Enables the drawing of 2D game-like shadows in orthographically projected images, providing a more uniform and immersive 2D game appearance without character immersion issues.
Abstract
Description
[Technical Field]
[0001] The present disclosure relates to image processing in game processing. [Background technology]
[0002] Shadows have been represented in virtual three-dimensional spaces in game processing, etc. Among these, a method of representing shadows using a shadow volume technique is also known (for example, Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Application Laid-Open No. 2004-280596 Summary of the Invention [Problem to be solved by the invention]
[0004] The above technology was designed to use perspective projection, so it was not suitable for games that use orthographic projection, such as 2D games. [Means for solving the problem]
[0005] In view of the above, the following configuration example can be given.
[0006] (Configuration 1) In the configuration 1, a computer of an information processing device controls at least a player character object and a virtual camera in a virtual space in which at least a player character object and a rear object located behind the player character object are disposed, and renders the virtual space in a frame buffer by orthogonal projection and performing a depth test. The computer also determines the degree of occlusion for each pixel based on an occlusion determination method based on SSAO, which compares, for each pixel, the depth values of multiple sample points set around a position in the virtual space corresponding to the pixel with the depth of the corresponding position in the depth buffer by adding a first offset in a predetermined direction to the position of the sample point. The computer then renders a shadow at a pixel in the frame buffer corresponding to a portion determined to be highly occluded.
[0007] According to the above configuration example, when drawing the shadow of the player character object on the rear object, it is possible to draw a 2D-style shadow.
[0008] (Configuration 2) In configuration 2, in configuration 1, the rear objects may be arranged in multiple layers in the virtual space at positions with different depths, and the occlusion determination method may be an occlusion determination method that does not attenuate the degree of occlusion based on the difference in depth in the comparison.
[0009] According to the above configuration example, even if a rear object is placed at a depth (depth position) that differs from the appearance in orthogonal projection, a shadow that does not look strange when playing a 2D game can be drawn.
[0010] (Configuration 3) In configuration 3, in configuration 2, a background object may be placed further back than the rear object in the virtual space. The computer may then be caused to draw the shadow while excluding pixels corresponding to the background object.
[0011] According to the above configuration example, it is possible to prevent a shadow from being drawn on a background object that is farther away than a rear object, and to express the rear object and the background object in a manner that makes them distinguishable from each other.
[0012] (Configuration 4) Configuration 4, in the above configuration 1, may further cause the computer to perform drawing of a predetermined object in a frame buffer of the virtual space by deforming the normal vector of the predetermined object so as to approach a direction facing a position of the virtual camera.
[0013] According to the above configuration example, not only the shadow but also the object itself can be rendered in a 2D style, which allows for a consistent appearance.
[0014] (Configuration 5) In configuration 5, in configuration 4, the computer may scale the depth component of the normal vector by a predetermined magnification and then normalize the length of the normal vector, thereby deforming it so that it approaches the direction in which the virtual camera faces a certain position.
[0015] According to the above configuration example, the normal vector can be transformed using a simple calculation method, so that the processing load can be reduced.
[0016] (Configuration 6) Configuration 6, in the above configuration 2, may further cause the computer to add a second offset to a plurality of character objects, including a player character object, placed in the virtual space when drawing them in the frame buffer so that each character object has a different depth value.
[0017] According to the above configuration example, even when multiple character objects are arranged on the same axis in virtual space, it is possible to prevent the character objects from appearing to sink into each other during rendering. Furthermore, because the degree of occlusion is not attenuated depending on the depth difference, different depth values do not affect the method of rendering the shadows. [Effects of the Invention]
[0018] According to the present disclosure, in a game that uses images based on orthogonal projection, shadows can be rendered in a style similar to that of a 2D game. [Brief explanation of the drawings]
[0019] [Figure 1] A block diagram showing the hardware configuration of the game device 2. [Figure 2] A diagram to explain the imposed expression of a 3D model [Figure 3] A diagram to explain the imposed expression of a 3D model [Figure 4] A diagram to explain the imposed expression of a 3D model [Figure 5] A diagram to explain the imposed expression of a 3D model [Figure 6] A diagram to explain the imposed expression of a 3D model [Figure 7] A diagram explaining how to adjust the depth value of a character [Figure 8] A diagram explaining how to adjust the depth value of a character [Figure 9] A diagram explaining how to adjust the depth value of a character [Figure 10] Diagram explaining SSAO-related processing [Figure 11] Diagram explaining SSAO-related processing [Figure 12] Diagram explaining SSAO-related processing [Figure 13] Diagram explaining SSAO-related processing [Figure 14]Diagram explaining SSAO-related processing [Figure 15] Diagram explaining SSAO-related processing [Figure 16] Diagram explaining SSAO-related processing [Figure 17] Diagram explaining SSAO-related processing [Figure 18] Diagram explaining SSAO-related processing [Figure 19] Diagram explaining SSAO-related processing [Figure 20] Diagram explaining SSAO-related processing [Figure 21] Diagram explaining SSAO-related processing [Figure 22] A memory map showing an example of various data stored in the storage unit 22 of the game device 2. [Figure 23] Flowchart showing details of drawing processing [Figure 24] Flowchart showing pixel shader processing details [Figure 25] A flowchart detailing post-processing [Figure 26] A flowchart detailing the SSAO process DETAILED DESCRIPTION OF THE INVENTION
[0020] An embodiment of the present invention will be described below.
[0021] [Hardware configuration of game device 2] FIG. 1 is a block diagram showing an example of the hardware configuration of a game device 2 according to this embodiment. In FIG. 1, the game device 2 includes a processor 21. The processor 21 is an information processing unit that executes various types of information processing executed in the game device 2. In this embodiment, the processor 21 is configured as a system-on-a-chip (SoC) that includes at least a central processing unit (CPU) function and a graphics processing unit (GPU) function. In other embodiments, the CPU and the GPU may be separate components. The present disclosure is also applicable to a configuration in which graphics processing is performed by the CPU without a GPU. The processor 21 executes various types of information processing by executing an information processing program (e.g., a game program) stored in a storage unit 22. The storage unit 22 may be an internal storage medium such as a flash memory or a dynamic random access memory (DRAM), or may be configured to use an external storage medium inserted into a slot (not shown).
[0022] The game device 2 also includes a communication unit 23 for communicating with other game devices and a predetermined server.
[0023] The game device 2 also includes a controller communication unit 24 for the game device 2 to communicate with the controller 26 via wired or wireless communication.
[0024] Furthermore, a display unit 27 (e.g., a television or the like) is connected to the game device 2 via an image and audio output unit 25. The processor 21 outputs, for example, images and sounds generated by executing the above-described information processing to the display unit 27 via the image and audio output unit 25.
[0025] [Processing assumed in this embodiment] Next, an overview of the processing assumed in this embodiment will be described. In this embodiment, a game using game images captured by orthogonal projection of a virtual space is assumed. For example, a so-called side-view game is assumed. In this game, the player can move the player character using the controller 26. The virtual camera is also controlled to move so that the screen scrolls horizontally (or vertically) as the player character moves. In this embodiment, various improvements are made to the rendering process to create a 2D game-like appearance in such orthogonal projection game images. In other words, the rendering itself is performed using a 3DCG technique, but improvements are made to create a more 2D game-like appearance. A 2D game-like appearance is, for example, a way of presenting a 3D model character with less three-dimensionality and depth than when rendered using normal processing. Specifically, in this embodiment, the following processing improvements are made. The synergistic effect of these processes can create a more 2D game-like appearance. (1) Imposing a 3D model (2) Adjusting the character depth value in the depth test (3) SSAO-related processing for character shadow expression Below, an overview of each process will be explained.
[0026] [3D model imposition expression] In this embodiment, each character is created as a 3D model. Therefore, if drawn without any special ingenuity, an image with shading based on the unevenness of the model is created, resulting in a three-dimensional representation. In this regard, in this embodiment, the vertex shader process deforms the vertex normals to represent the 3D model as if it were pressed against the screen. FIG. 2 shows an example of a portion of a 3D model before and after vertex normal deformation. In FIG. 2, the left side shows the example before deformation, and the right side shows the example after deformation. FIG. 2 is a schematic diagram of a bird's-eye view of the virtual space, showing a part of the 3D model that has a curved surface in a cross section horizontal to the Z axis. In FIG. 2, the vertex normals on the surface facing the virtual camera (the front side as viewed from the viewpoint) are oriented in a substantially radial pattern. In this embodiment, the vertex shader process deforms the direction of each vertex normal so that it approaches the direction facing the virtual camera position (an orientation horizontal to the front direction of the virtual camera), as shown in FIG. 2. More specifically, the Z-axis component is scaled by a predetermined factor and the length is normalized. For example, consider a normal vector as shown in FIG. 3. The Z-axis component is doubled, as shown in FIG. 4, and the length is normalized as shown in FIG. 5. By transforming the vertex normal in this way, the direction of the normal vector is moved closer to the virtual camera. This reduces shading even when lighting is performed, resulting in a more flat appearance. Furthermore, in this case, when viewed from the virtual camera, the 3D model appears as if it has a flat shape, as shown in FIG. 6. Note that this normal transformation may be applied to the entire 3D model or only to a portion of it. For example, normal transformation may be performed on the head of a 3D model but not on the torso. This example is useful when using a relatively small 3D model and you want to make facial expressions easier to see, so you do not want to add much shading to the head.
[0027] [Adjusting the character's depth value (Z coordinate) in the depth test] As described above, in the game of this embodiment, the three-dimensional virtual space is represented by orthogonal projection. Therefore, if models arranged on the same depth axis in the virtual space are drawn as is, there is a possibility that a portion of one model will appear to be embedded in another model. For example, consider a multiplayer game with four players. As shown in FIG. 7, four player characters are positioned at the same coordinate on the Z axis, which is the depth direction (the imaging direction of the virtual camera), and are arranged close together on the left-right axis (the X axis in FIG. 7). In this case, there is a possibility that a portion of one player character will appear to be embedded in another player character (see, for example, FIG. 8). Therefore, in this example, during a so-called depth test (also called a Z test), an offset value is added so that the depth values (Z coordinates) of the player characters are different, and the offset value is written to the depth buffer (also called a Z buffer). In the following description, the offset value used during the depth test will be referred to as a "depth test offset value." As a result, as shown in Figure 9, pixel rendering processing is performed after establishing a positional relationship in which the positions of each player character on the Z axis do not overlap, preventing the occurrence of the above-mentioned sunken effect. Note that game processing such as collision detection processing is performed based on the Z-axis position in virtual space before the offset is added. In other words, the main game processing is performed based on the actual Z-axis position in virtual space, and when drawing the game image resulting from that game processing, the above-mentioned offset value is added to change the depth value before drawing.
[0028] Furthermore, the depth test offset value may be used not only for the player character but also for other character objects. For example, depth test offset values that have different depth values may be set in advance for all character objects that appear in the game. Then, during a depth test, the depth test offset value set for each character may be used to write data into the depth buffer.
[0029] [SSAO-related processing for character shadow representation] Next, we will provide an overview of the SSAO (Screen Space Ambient Occlusion) processing used in this embodiment. Because SSAO itself is a known technique, a detailed description will be omitted. However, this is a technique for calculating ambient occlusion (AO), which indicates the degree to which ambient light is attenuated by surrounding occlusions around a given point of interest, limited to screen space (the screen area). In other words, this technique approximately calculates the degree of occlusion in the surrounding environment for a position in virtual space corresponding to each pixel. While several specific SSAO algorithms are known, the basic algorithm is as follows: First, SSAO is performed as a post-processing step. As a preliminary step, depth information (depth buffer or depth map) is created when rendering a given scene. In SSAO processing, the following process is performed for each pixel: First, a pixel is selected as the point of interest, and its surrounding positions are randomly sampled. The number of samples is optional; however, the greater the number of samples, the higher the accuracy but the greater the computational load. Next, the depth value of the sampling point is calculated. For example, the position in the clipping space onto which the position of the sampling point is projected is calculated. Then, the depth value of the sampling point is compared with the depth value of the coordinate corresponding to the sampling point in the depth information that has been created. This comparison makes it possible to determine whether the sampling point is in an occluded position. For example, if the depth value of the sampling point is smaller than the depth value in the depth information, the sampling point can be considered not to be occluded. This comparison is performed for each sampling point, and an "occlusion coefficient" is determined based on the proportion of occluded sampling points. Then, based on the occlusion coefficient, it is determined whether to draw a shadow at the point of interest and the strength of the shadow at the point of interest.
[0030] In this embodiment, for example, a positional relationship such as that shown in Fig. 10 is assumed, and a case where the shadow of the player character is drawn on a rear object behind the player character is considered. When expressing the shadow of the player character in such a case, the SSAO processing described above is further controlled as follows to draw a shadow in a 2D game style. (A) Sampling point offset control (B) Control that ignores light attenuation due to distance in the depth direction
[0031] [Sampling point offset control] In this embodiment, after sampling points are obtained around the point of interest, a predetermined offset value is added to the position of the sampling point before comparing it with the depth value of the depth information. Hereinafter, the offset value used in the SSAO process is referred to as the "SSAO offset value." For example, assume that sampling points are determined at the positions shown in FIG. 11. FIG. 11 is a diagram that schematically illustrates the positional relationship between the point of interest, the sampling points, and the light source in virtual space. In FIG. 11, the Z axis corresponds to the depth direction of the screen. In this embodiment, an SSAO offset value is added to the sampling points toward the light source, as shown in FIG. 12. Then, the depth value of the depth information is compared based on the offset sampling points. Therefore, in the example of FIG. 12, as a result of offsetting the sampling points, the sampling points are compared as being closer to an obstructing object (e.g., the player character in FIG. 10). As a result, a higher proportion of sampling points are considered "obstructed" than in the case of FIG. 11. This makes it possible to render shadows for points of interest (pixels) that would not be rendered with normal SSAO processing. In particular, assuming the above-described positional relationship between the player character and the rear object, the occlusion coefficient can be set higher for the focal point, which would normally be set low in conventional SSAO processing. As a result, the player character's shadow reflected by the rear object can be made more pronounced, resulting in a 2D game-like shadow. For example, assume that conventional SSAO processing results in a player character shadow as shown in FIG. 13. FIG. 13 shows an example of the player character's shadow, with an enlarged view of the head area in the upper left. As shown in the enlarged view, in the example of FIG. 13, no shadow is drawn at the pixel serving as the focal point. In contrast, by offsetting the sampling point and performing SSAO processing as in this embodiment, it is possible to create a shadow as shown in FIG. 14. In FIG. 14, a shadow is drawn at the pixel serving as the focal point.This is because the sampling points related to the point of interest were judged to be highly occluded, and as a result, the occlusion coefficient for this point of interest was set high. This processing makes it possible to create a shadow that appears thicker than shadows created using normal rendering techniques, giving the player character a more 2D game-like appearance.
[0032] [Control to ignore attenuation of occlusion due to distance in the depth direction] Next, control that ignores the attenuation of the degree of occlusion due to distance in the depth direction will be described. As described above, in this embodiment, a three-dimensional space is rendered using orthogonal projection, so game images are expressed without perspective. Therefore, for example, even if images appear to be overlapping on the screen at the same depth position as in FIG. 15, when viewed from above in the virtual space, they may be positioned at different positions on the depth (image capture) direction axis as in FIG. 16. The same applies to images in which two rear objects appear to be lined up side by side. For example, for ease of game development (efficiency of level design and map design, etc.) or convenience of game processing, a virtual space with a rear object arrangement as in FIG. 16 may be used as the configuration of a virtual space for a game that assumes orthogonal projection.
[0033] Here, for example, assume that two player characters exist in the virtual space with a positional relationship as shown in FIG. 17. In FIG. 17, player character B and rear object B are close to each other in the depth direction, with rear object B located directly behind player character B. On the other hand, player character A and rear object A are located far apart in the depth direction. In this positional relationship, if a normal rendering process (normal SSAO process) is performed using orthogonal projection, the shadow of the player character may be expressed as shown in FIG. 18, for example. That is, the shadow of player character B is expressed as being cast on rear object B located directly behind it. In other words, a portion of rear object B is treated as being highly occluded by player character B. On the other hand, player character A is located at a distance from rear object A in the depth direction. In normal SSAO processing, if there is a large difference in depth between the sample point and the occluding object, the degree of occlusion is attenuated to make it less susceptible to the influence of occlusion by objects that are farther away, so background object A is treated as not being occluded by player character B. As a result, the image shows that the shadow of player character A is not drawn on background object A. In other words, in normal SSAO processing, the difference in depth between the position of the occluding object and the position of the shadow of that occluding object is taken into consideration, and the degree of occlusion is attenuated to represent the shadow.
[0034] In this embodiment, the SSAO process is performed without attenuating the degree of occlusion based on the depth difference. In other words, the depth difference is ignored. As a result, a shadow such as that shown in FIG. 19 can be rendered. FIG. 19 shows that the shadow of player character A is rendered on rear object A regardless of the actual depth difference in the virtual space. Note that FIG. 19 also shows the result after adding the offset to the sampling point. This makes it possible to render a shadow that does not look unnatural when considered as a 2D game. Furthermore, multiple rear objects may be placed in the virtual space so as to form multiple layers (so that their positions in the depth direction are different). Even in this case, a shadow can be rendered on each rear object, making it appear as if these multiple rear objects are on the same layer.
[0035] In this embodiment, with respect to the SSAO-based shadow rendering, further processing is performed to limit the objects on which the shadow is rendered. For example, assume a case in which a player character, a rear object, and a background object are positioned as shown in FIG. 20 . In this case, it is desired to make the rear object appear to be directly behind the player character, while making the background object appear to be in the distance, rather than directly behind the player character. In this case, a shadow (of the player character) is rendered on the rear object, but this shadow is not rendered on the background object, thereby achieving this sense of perspective. Taking this case as an example, simply ignoring the depth difference results in a shadow being rendered on the background object as well. Therefore, in this embodiment, further control is performed to exclude pixels corresponding to the background object from the objects on which the SSAO-based shadow is rendered. In this embodiment, this control is performed by "masking" pixels on which no shadow should be rendered. That is, a mask image is prepared that covers all areas except for pixels on which a shadow should be rendered (pixels on which the rear object is rendered in the case of FIG. 20 ). Then, when drawing a shadow determined based on SSAO, this mask image is used so that the shadow is not drawn in the masked portion. Figure 21 shows an example of a screen where a shadow is not drawn in the background portion. Figure 21 shows that the shadow of the player object is drawn on the back object (the corresponding pixels), but not on the background object (the corresponding pixels).
[0036] [Details of the processing in this embodiment] Next, the drawing process in this embodiment will be described in more detail with reference to FIGS.
[0037] [About data usage] First, various data used in the processing of this embodiment will be described. Fig. 22 is a memory map showing an example of various data stored in the storage unit 22 of the game device 2. The storage unit 22 stores a game program 601 and object data 602. The game program 601 is a program for executing game processing including image processing according to this embodiment. The object data 602 is data on various objects that appear in the game, such as the player character, rear object, background object, etc. For example, the object data 602 includes data on 3D models of each object.
[0038] The storage unit 22 also includes a frame buffer 603 used as a memory area dedicated to image processing. The frame buffer 603 may store a primary buffer 604, a back buffer 605, a depth buffer 606, a stencil buffer 607, and the like. The primary buffer 604 stores an image that will ultimately be output as a game image. The back buffer 605 stores a game image during the rendering process (rendering pipeline). That is, when a scene is rendered, an image is written to the back buffer 605 during the rendering process, and the completed image in the back buffer 605 is transferred to the primary buffer 604 and output as a game image. The depth buffer 606 is a temporary memory area for storing depth data for each pixel of the game image. The depth buffer 606 can also be used as depth information representing the distance from the virtual camera for each pixel. The stencil buffer 607 is a temporary memory area for storing data corresponding to the mask image used to identify pixels for rendering or not rendering a character shadow based on the SSAO described above.
[0039] Next, the details of the processing in this embodiment will be described. Here, the description will mainly focus on the rendering processing as described above, and details of other game processing will be omitted. Note that in this embodiment, the flowchart shown below is realized by one or more processors reading and executing a program stored in one or more memories. Also, this flowchart is merely an example of the processing process. Therefore, the processing order of each step may be changed as long as the same results are obtained. Also, the values of variables and thresholds used in the determination steps are merely examples, and other values may be used as necessary.
[0040] 23 is a flowchart showing the details of the rendering process according to this embodiment. This process is for rendering an image of a virtual space in which various objects are placed, captured by a virtual camera, and is repeated multiple times per second depending on the frame rate.
[0041] First, in step S1, processor 21 executes vertex shader processing. This processing includes coordinate transformation processing (in this example, an orthogonal projection matrix is used) to determine the position of each vertex of a polygon in the game image, processing to determine the color of each vertex (lighting processing), processing to determine the position of a texture to be applied, and the like. In this embodiment, the vertex shader processing also includes processing to transform vertex normals for a predetermined object, as described above with reference to FIGS. 2 to 6. That is, processing to scale and normalize the Z components of the vertex normals for a predetermined object is performed. Note that lighting processing is also performed in the vertex shader processing, but at this point, lighting processing is performed using the original depth values to which the depth test offset value has not been added.
[0042] Next, in step S2, the processor 21 executes rasterizer processing. Since the rasterizer processing is a known process, a detailed description will be omitted. However, the rasterizer processing generates triangles that make up polygons from the processed vertex data passed from the vertex shader, and fills them with pixels.
[0043] Next, in step S3, the processor 21 executes pixel shader processing. FIG. 24 is a flowchart showing details of the pixel shader processing. In FIG. 24, first, in step S11, the processor 21 executes depth test processing. In this processing, processing is performed to prevent pixels hidden in the shadows of other pixels from being drawn based on a depth value (depth value) set for each pixel. Then, in the depth test processing, processing is performed to write the depth value of the pixel to the depth buffer 606 to determine whether or not the pixel is hidden. At this time, in this embodiment, control is performed such that the depth test offset value is added to the depth value of the character object before writing it to the depth buffer 606, as described above with reference to FIGS. 7 to 9.
[0044] Next, in step S12, the processor 21 executes other pixel shader processes. For example, the processor 21 executes various pixel shader processes such as texture mapping, alpha test, etc. Thereafter, the processor 21 ends the pixel shader process.
[0045] Returning to Fig. 23, next, in step S4, the processor 21 executes post-processing. In the post-processing, various image effects are applied to the image generated as a result of the pixel shader processing. Fig. 25 is a flowchart showing the details of the post-processing.
[0046] In Fig. 25, first, in step S21, the processor 21 executes SSAO processing. As described above, there are several known types of SSAO algorithms, but in this embodiment, an example of processing based on a technique called Alchemy AO is shown as an example. Fig. 26 is a flowchart showing the details of the SSAO processing. In Fig. 26, first, in step S31, the processor 21 determines a pixel to be used as a point of interest.
[0047] Next, in step S32, processor 21 determines a plurality of sampling points based on the point of interest. For example, considering a hemisphere in the normal direction of the point of interest, positions randomly selected within this hemisphere are determined as sampling points. Note that the sampling points are determined within world space (or clipping space).
[0048] Next, in step S33, the processor 21 projects each of the determined sampling points using the depth buffer 606 (i.e., depth information) generated by the processing of the pixel shader, thereby determining the position of the sampling point in the screen space.
[0049] Next, in step S34, processor 21 adds the SSAO offset value toward the light source direction to each sampling point in screen space. The specific value of the SSAO offset value may be any value. For example, it may be a predetermined value, or it may be a value automatically calculated each time using a predetermined formula.
[0050] Next, in step S35, the processor 21 calculates a vector A from the point of interest to each sampling point.
[0051] Next, in step S36, the processor 21 calculates the inner product of the normal vector B of the target point and each of the calculated vectors A.
[0052] Next, in step S37, the processor 21 calculates the average value of the calculated inner products, and then determines the shielding coefficient based on the average value.
[0053] In normal SSAO processing, when determining the occlusion coefficient based on the above dot product, a calculation of "dividing by the length of vector A" is also performed to take into account the attenuation of the degree of occlusion (attenuation of light intensity) due to distance in the depth direction. However, in this embodiment, as explained above with reference to FIGS. 15 to 19, it is desired to draw the character's shadow without attenuating the degree of occlusion based on differences in depth. For this reason, after calculating the above dot product, the calculation of "dividing by the length of vector A" is not performed, and the average value is calculated directly.
[0054] Next, in step S38, processor 21 determines the density (strength) of the shadow for the point of interest based on the determined occlusion coefficient. Note that in this embodiment, the density of the shadow determined based on the SSAO processing is assumed to be constant. That is, in this example, the result is a simple either-or decision: whether to cast a shadow or not.
[0055] Next, in step S39, processor 21 generates an SSAO shadow image, which is a texture image showing an image of the shadow determined by the SSAO processing (hereinafter referred to as the SSAO shadow). When drawing a shadow for a point of interest, the texel corresponding to the point of interest is drawn in black. Therefore, in the SSAO shadow image, for example, a texture image is created in which only the part where the SSAO shadow is cast is painted black.
[0056] Next, in step S40, processor 21 determines whether or not the processes of steps S31 to S39 have been performed for all pixels. If there are still unprocessed pixels (NO in step S40), the process returns to step S31 and is repeated. If the processes have been completed for all pixels (YES in step S40), processor 21 ends the SSAO process.
[0057] 25 , next, in step S22, processor 21 generates stencil buffer 607 with contents that mask everything except the rear object. Then, in step S23, processor 21 composites the SSAO shadow image with the image generated as a result of the pixel shader. At this time, the SSAO shadow image is composited using stencil buffer 607. As a result, for example, an image can be generated in which an SSAO shadow is drawn on the rear object but no SSAO shadow is drawn on the background object.
[0058] Next, in step S24, the processor 21 executes various processes related to other post-processing (processing for applying various effects). For example, the processor 21 appropriately executes processing for applying depth of field, anti-aliasing, blooming, etc. to the image generated as a result of the pixel shader. Thereafter, the processor 21 ends the post-processing.
[0059] Returning to FIG. 23, next, in step S5, the processor 21 transfers the final rendered image (stored in the back buffer 605 in this example) generated as a result of the above post-processing to the primary buffer 604.
[0060] Next, in step S6, processor 21 outputs the image in primary buffer 604 to display unit 27.
[0061] After that, the processor 21 ends the drawing process.
[0062] This concludes the detailed description of the drawing process of this embodiment.
[0063] In this way, in this embodiment, when performing SSAO processing, the sampling point is offset toward the light source and the depth value is compared. Furthermore, in this embodiment, control is performed to ignore the attenuation of the degree of occlusion based on the depth difference. As a result, when drawing the player character's shadow on the rear object, the range in which the shadow cast on the rear object is drawn is expanded, making it possible to express shadows in a 2D game style.
[0064] In this embodiment, the vertex shader deforms certain parts of the 3D model character so that the vertex normals point toward the light source. This allows the deformed parts to appear more planar. Combined with the character shadow representation achieved through the SSAO process, this allows the 3D model character and its shadow to appear unified as a 2D game-like image.
[0065] In addition, in this embodiment, during a depth test, the depth test offset value is added so that each character object has a different depth value, and the result is written to the depth buffer. As described above, the SSAO process renders shadows while ignoring differences in the depth direction. Therefore, even if the depth value is changed during the depth test, the character's shadow is rendered without being affected by the change. This allows for orthogonal projection games to render game images that have a 2D game-like appearance without causing characters to appear to be embedded in each other, resulting in a greater synergistic effect.
[0066] [Variations] In the above embodiment, an example of SSAO processing is based on Alchemy AO. However, the present invention is not limited to this, and processing such as offsetting sampling points and then comparing depth values as described above may be performed in SSAO using other algorithms.
[0067] In another embodiment, instead of directly offsetting the sampling points, the point of interest itself may be offset, and sampling points determined based on the offset point of interest may be used.
[0068] In the above embodiment, the drawing process is executed by a single game device 2. In other embodiments, these processes may be executed in an information processing system consisting of multiple information processing terminals. For example, in an information processing system including a terminal device and a server device capable of communicating with the terminal device via a network, some of the drawing processes may be executed by the server device. In the above information processing system, the server system may be composed of multiple information processing terminals, and the processes to be executed on the server side may be shared and executed by the multiple information processing terminals. [Explanation of symbols]
[0069] 2. Game devices 21 processors 22 Memory section 26 Controller 27 Display section
Claims
1. The computer of the information processing device controlling at least a player character object and a virtual camera in a virtual space in which at least a player character object and a rear object are disposed on the back side of the player character object; Rendering the virtual space into a frame buffer by orthogonal projection and using a depth test; a method for determining the degree of occlusion for each pixel based on SSAO (Screen Space Ambient Occlusion), the method being such that, when comparing, for each pixel, depth values of a plurality of sample points set around a position in the virtual space corresponding to the pixel with a depth at a position in a corresponding depth buffer, a first offset in a predetermined direction is added to the position of the sample point; further rendering a shadow on the pixel in the frame buffer corresponding to the portion determined to be highly occluded; Game program.
2. In the virtual space, the rear objects are arranged in multiple layers at positions with different depths, The game program according to claim 1 , wherein the occlusion determination method is a method of determining occlusion that does not attenuate the degree of occlusion based on the difference in depth in the comparison.
3. a background object is placed further back than the rear object in the virtual space; The computer, 3. The game program according to claim 2, wherein the shadow is drawn while excluding pixels corresponding to the background object.
4. The computer further comprises:
2. The game program according to claim 1, wherein, in drawing the virtual space in the frame buffer, a predetermined object is drawn by deforming its normal vector so as to approach a direction in which the normal vector faces a position of the virtual camera.
5. The computer, 5. The game program according to claim 4, wherein the normal vector is deformed so as to approach the direction in which the virtual camera is pointing by scaling the depth direction component of the normal vector by a predetermined factor and then normalizing the length of the normal vector.
6. The computer further comprises:
3. The game program according to claim 2, wherein when drawing a plurality of character objects, including the player character object, placed in the virtual space into the frame buffer, a second offset is added so that each character object has a different depth value.
7. A gaming system including a computer, The computer controlling at least a player character object and a virtual camera in a virtual space in which at least a player character object and a rear object located further back than the player character object are disposed; Rendering the virtual space to a frame buffer by orthogonal projection and using a depth test; a method for determining an occlusion degree for each pixel based on SSAO (Screen Space Ambient Occlusion), the method being such that, when comparing, for each pixel, depth values of a plurality of sample points set around a position in the virtual space corresponding to the pixel with a depth at a position in a depth buffer corresponding to the pixel, a first offset in a predetermined direction is added to the position of the sample point; further drawing a shadow on pixels in the frame buffer corresponding to the portion determined to be highly occluded; Game system.
8. In the virtual space, the rear objects are arranged in multiple layers at positions with different depths, The game system according to claim 7 , wherein the occlusion determination method is a method of determining occlusion that does not attenuate the degree of occlusion based on the difference in depth in the comparison.
9. a background object is placed further back than the rear object in the virtual space; The computer 9. The game system according to claim 8, wherein the shadow is drawn while excluding pixels corresponding to the background object.
10. The computer further comprises:
8. A game system according to claim 7, wherein, in drawing the virtual space in the frame buffer, predetermined objects are drawn by deforming their normal vectors so as to approach a direction in which the normal vector faces a position of the virtual camera.
11. The computer The game system according to claim 10, wherein the normal vector is deformed so as to approach the direction in which the virtual camera is facing by scaling the depth direction component by a predetermined factor and then normalizing the length of the normal vector.
12. The computer further comprises:
9. A game system according to claim 8, wherein when drawing a plurality of character objects, including the player character object, arranged in the virtual space into the frame buffer, a second offset is added so that each character object has a different depth value.
13. A game processing method executed by a computer of an information processing device, comprising: The computer, controlling at least a player character object and a virtual camera in a virtual space in which at least a player character object and a rear object are disposed on the back side of the player character object; Rendering the virtual space into a frame buffer by orthogonal projection and using a depth test; a method for determining the degree of occlusion for each pixel based on SSAO (Screen Space Ambient Occlusion), the method being such that, when comparing, for each pixel, depth values of a plurality of sample points set around a position in the virtual space corresponding to the pixel with a depth at a position in a corresponding depth buffer, a first offset in a predetermined direction is added to the position of the sample point; further rendering a shadow on the pixel in the frame buffer corresponding to the portion determined to be highly occluded; Game processing method.
14. In the virtual space, the rear objects are arranged in multiple layers at positions with different depths, The game processing method according to claim 13 , wherein the occlusion determination method is a occlusion determination method that does not attenuate the degree of occlusion based on the difference in depth in the comparison.
15. a background object is placed further back than the rear object in the virtual space; The computer, 15. A game processing method according to claim 14, wherein the shadow is drawn without targeting pixels corresponding to the background object.
16. The computer further comprises:
14. A game processing method according to claim 13, wherein, in drawing the virtual space in the frame buffer, a predetermined object is drawn by deforming its normal vector so as to approach a direction in which the normal vector faces a position of the virtual camera.
17. The computer, 17. A game processing method according to claim 16, wherein the depth direction component of the normal vector is scaled by a predetermined factor and the length of the normal vector is normalized to deform the normal vector so as to approach the direction in which the virtual camera is facing toward a position thereof.
18. The computer further comprises:
15. A game program according to claim 14, wherein when drawing a plurality of character objects, including the player character object, placed in the virtual space into the frame buffer, a second offset is added so that each character object has a different depth value.
19. A gaming device equipped with a computer, The computer controlling at least a player character object and a virtual camera in a virtual space in which at least a player character object and a rear object located further back than the player character object are disposed; Rendering the virtual space to a frame buffer by orthogonal projection and using a depth test; a method for determining an occlusion degree for each pixel based on SSAO (Screen Space Ambient Occlusion), the method being such that, when comparing, for each pixel, depth values of a plurality of sample points set around a position in the virtual space corresponding to the pixel with a depth at a position in a depth buffer corresponding to the pixel, a first offset in a predetermined direction is added to the position of the sample point; further drawing a shadow on pixels in the frame buffer corresponding to the portion determined to be highly occluded; Game device.
20. In the virtual space, the rear objects are arranged in multiple layers at positions with different depths, 20. The game device according to claim 19, wherein the occlusion determination method is a method of determining occlusion that does not attenuate the degree of occlusion based on the difference in depth in the comparison.
21. a background object is placed further back than the rear object in the virtual space; The computer 21. The game device according to claim 20, wherein the shadow is drawn while excluding pixels corresponding to the background object.
22. The computer further comprises:
20. The game device according to claim 19, wherein, in drawing the virtual space in the frame buffer, a predetermined object is drawn by deforming the normal vector thereof so as to approach a direction in which the normal vector faces a position of the virtual camera.
23. The computer 23. The game device according to claim 22, wherein the normal vector is deformed so as to approach the direction in which the virtual camera faces by scaling the depth direction component by a predetermined factor and then normalizing the length of the normal vector.
24. The computer further comprises:
21. A game device according to claim 20, wherein when drawing a plurality of character objects including the player character object arranged in the virtual space to the frame buffer, a second offset is added so that each character object has a different depth value.
