Virtual skill radiation area generation method and device, storage medium and electronic equipment
By generating depth maps to cull occluded areas and processing the view frustum, the problem of low accuracy of virtual skill radiation areas in existing technologies is solved, achieving high-precision rendering and enhanced realism in complex scenes, thus improving the user experience.
Patent Information
- Application Number
- CN202310253432.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-09
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2043-03-09
AI Technical Summary
In existing technologies, the rendering methods for skill radiation areas are not applicable to complex scenes and terrains, and cannot achieve rendering effects at different heights, resulting in low accuracy of virtual skill radiation areas.
By obtaining the virtual skill radiation range of the attacker's skill, a depth map is generated, occluded areas are removed, the initial skill radiation area is obtained, and the view frustum is processed by near clipping and the vertical field of view is expanded to determine the non-walkable area. Finally, the target skill radiation area is rendered.
It achieves high-precision rendering in complex scenes and terrains, improves the adaptability and realism of the virtual skill radiation area, provides a more referential virtual skill radiation range, and improves the user experience.
Smart Images

Figure CN116474364B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a virtual skill radiation area generation method, a virtual skill radiation area generation device, a computer readable storage medium and an electronic device. BACKGROUND
[0002] In a strategy game or a shooting game, it is usually required to display a radiation area of a skill, i.e., a virtual damage range of the skill. In a game scene, rendering of the skill radiation area often needs to consider occlusion relationships in the game scene, i.e., when rendering the skill radiation area, virtual occlusion bodies in the game scene need to be avoided.
[0003] In the related art, a virtual damage area of a skill is rendered onto a semi-transparent plane, and the virtual damage area is divided into multiple sectors according to occlusion relationships in the semi-transparent plane to form a radiation area of the virtual skill. Apparently, this method renders the damage area onto a plane, and cannot be applied to complex scenes and terrains, and cannot achieve rendering effects of different heights, so that the radiation area of the virtual skill generated has low accuracy. SUMMARY
[0004] The present disclosure provides a virtual skill radiation area generation method, a virtual skill radiation area generation device, a computer readable storage medium and an electronic device, thereby at least partially improving the problem of low accuracy of a virtual skill radiation area.
[0005] Other characteristics and advantages of the present disclosure will become apparent from the following detailed description, or will be learned by practice of the present disclosure.
[0006] According to a first aspect of the present disclosure, a virtual skill radiation area generation method is provided, including: obtaining a virtual skill radiation range of an attacker skill, and generating a depth map according to a grid model corresponding to a virtual occlusion body in the virtual skill radiation range; obtaining an occluded area in the virtual skill radiation range according to the depth map, and culling the occluded area in the virtual skill radiation range to obtain an initial skill radiation area of the attacker skill; obtaining a view frustum corresponding to the initial skill radiation area, performing near clipping plane processing and expanding vertical field of view angle processing on the view frustum, and obtaining an intermediate skill radiation area according to the processed view frustum; determining a non-walkable area in the intermediate skill radiation area according to a slope of a pixel point in the intermediate skill radiation area, and rendering the intermediate skill radiation area from which the non-walkable area is culled to obtain a target skill radiation area.
[0007] According to a second aspect of the present disclosure, a virtual skill radiation area generation apparatus is provided, comprising: a depth map generation module configured to obtain a virtual skill radiation range of an attacker skill, and generate a depth map according to a grid model corresponding to a virtual occlusion body in the virtual skill radiation range; an initial skill radiation area acquisition module configured to acquire an occluded area in the virtual skill radiation range according to the depth map, and cull the occluded area in the virtual skill radiation range to obtain an initial skill radiation area of the attacker skill; an intermediate skill radiation area acquisition module configured to obtain a view frustum corresponding to the initial skill radiation area, perform near clipping plane processing and expanded vertical field of view angle processing on the view frustum, and acquire an intermediate skill radiation area according to the processed view frustum; and a target skill radiation area acquisition module configured to determine a non-walkable area in the intermediate skill radiation area according to a slope of a pixel point in the intermediate skill radiation area, and render the intermediate skill radiation area from which the non-walkable area is culled to obtain a target skill radiation area.
[0008] According to a third aspect of the present disclosure, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the virtual skill radiation area generation method of the first aspect and possible implementation manners thereof.
[0009] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory configured to store executable instructions of the processor. The processor is configured to execute the executable instructions to perform the virtual skill radiation area generation method of the first aspect and possible implementation manners thereof.
[0010] The technical solution of the present disclosure has the following beneficial effects:
[0011] On the one hand, the occluded area in the virtual skill radiation area is culled according to the depth map to obtain an initial skill radiation area, a view frustum corresponding to the initial skill radiation area is obtained, near clipping plane processing and expanded field of view angle processing are performed on the view frustum to obtain an intermediate skill radiation area. Compared with the prior art of rendering a skill damage area to a plane, the present disclosure can be applied to complex scenes and terrains, and the rendering effect of skill radiation areas of different heights is realized, the accuracy of the virtual skill radiation area at any viewing angle is improved, and the adaptability of the virtual skill radiation area generation method is improved. On the other hand, the non-walkable area in the intermediate skill radiation area is determined according to the slope of a pixel point in the intermediate skill radiation area, the intermediate skill radiation area from which the non-walkable area is culled is rendered to obtain a target skill radiation area, the realism of the generated virtual skill radiation area is further improved, the virtual skill radiation range with more reference for players is provided, and the user experience is effectively improved.
[0012] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0013] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure. It is readily apparent to one skilled in the art that the following figures are merely some embodiments of the present disclosure and other figures can be obtained by one of ordinary skill in the art without any creative work under the premise that the following description of the figures is merely illustrative and explanatory.
[0014] Figure 1 A schematic diagram showing a radiation area of a virtual skill;
[0015] Figure 2 A schematic diagram showing a system operation architecture of the present exemplary embodiment;
[0016] Figure 3 A flowchart showing a method for generating a virtual skill radiation area in the present exemplary embodiment;
[0017] Figure 4 A schematic diagram showing an initial skill radiation area in the present exemplary embodiment;
[0018] Figure 5 A top view showing an initial skill radiation area in the present exemplary embodiment;
[0019] Figure 6 A flowchart showing a method for obtaining an occluded area in the present exemplary embodiment;
[0020] Figure 7 A schematic diagram showing a shadow distortion problem of a virtual skill radiation area;
[0021] Figure 8 A schematic diagram showing a virtual skill radiation area when an attacker and a target are at different heights;
[0022] Figure 9 A schematic diagram showing a frustum corresponding to an initial skill radiation area in the present exemplary embodiment;
[0023] Figure 10 A top view showing an intermediate skill radiation area in the present exemplary embodiment;
[0024] Figure 11 A schematic diagram showing an intersection line between a bottom frustum of a frustum after expanding a field of view angle and a virtual ground in the present exemplary embodiment;
[0025] Figure 12 A schematic diagram showing a complementary angle of a target vertical field of view in the present example embodiment.
[0026] Figure 13 A flow chart showing a process of obtaining a non-walkable area in the present example embodiment.
[0027] Figure 14 A flow chart showing a process of obtaining a cosine value of a pixel in the present example embodiment.
[0028] Figure 15A A schematic diagram showing an intermediate skill radiation area containing a non-walkable area in the present example embodiment.
[0029] Figure 15B A schematic diagram showing a target skill radiation area obtained by removing a non-walkable area in the present example embodiment.
[0030] Figure 16 A flow chart showing a process of generating a virtual skill radiation area in the present example embodiment.
[0031] Figure 17 A schematic diagram showing a structure of a virtual skill radiation area generation apparatus in the present example embodiment.
[0032] Figure 18 A schematic diagram showing a structure of an electronic device in the present example embodiment. DETAILED DESCRIPTION
[0033] Example embodiments now will be described more fully hereinafter with reference to the accompanying drawings. Example embodiments, however, can be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the example embodiments to those skilled in the art. The features, structures, or characteristics described in connection with the embodiments can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the embodiments of the disclosure can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth. In other instances, well-known structures, materials, or operations are not shown or described in detail in order to avoid obscuring aspects of the disclosure.
[0034] Further, the accompanying drawings are included to provide a thorough understanding of the present disclosure and are not intended to be exhaustive or to limit the present disclosure to a specific form. The same or similar reference numerals in different drawings denote the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams in the drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, or in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0035] In the related art, the damage range of a virtual skill is usually rendered to a semi-transparent two-dimensional plane, and a virtual occlusion in the damage range is projected in the two-dimensional plane to obtain an occlusion relationship in the damage range, and the damage range is divided into a plurality of small sectors based on the occlusion relationship to generate a radiation area of the virtual skill as shown in Figure 1 Obviously, the method renders the damage range to a two-dimensional plane, and cannot be applied to complex scenes and terrains, and cannot achieve damage range rendering effects of different heights, so that the generated radiation area of the virtual skill has low accuracy.
[0036] In view of one or more of the above problems, the present example embodiment first provides a virtual skill radiation area generation method. The system architecture of the running environment of the present example embodiment will be described below.
[0037] Referring to Figure 2 The system architecture 200 can include a terminal device 210 and a server 220. The terminal device 210 can be a notebook computer, a desktop computer, a tablet computer, or the like, and the terminal device 210 can be used to obtain a virtual skill radiation range. The server 220 generally refers to a background system that provides services related to generating a virtual skill radiation area in the present example embodiment, such as a server that implements a virtual skill radiation area generation method. The server 220 can be a server or a cluster formed by multiple servers, and the present disclosure does not limit this. The terminal device 210 and the server 220 can be connected through a wired or wireless communication link to exchange data.
[0038] The virtual skill radiation area generation method in the present example embodiment can be executed by the terminal device 210. For example, in a game scene, the terminal device 210 can be a computer running a game, the attacker skill can be a shooting or other skill released by a game character in the game, the virtual occlusion can be a virtual building in the game scene, and the virtual skill radiation range can be a damage range of a skill released by a game character. The terminal device 210 can determine a target skill radiation area in the virtual skill radiation range by executing the virtual skill radiation area generation method to obtain a virtual skill radiation area with high accuracy.
[0039] In an embodiment, the virtual skill radiation range and the depth map of the attacker skill can be acquired by the terminal device 210, and sent to the server 220. After receiving the virtual skill radiation range and the depth map, the server 220 can acquire the occluded area in the virtual skill radiation range according to the depth map, and cull the occluded area in the virtual skill radiation range to obtain an initial skill radiation area. Then, the server 220 can acquire the view frustum corresponding to the initial skill radiation area, and perform near clipping plane processing and vertical field of view angle expansion processing on the view frustum. Then, the server 220 can acquire an intermediate skill radiation area according to the processed view frustum. Finally, the server 220 can determine a non-walkable area in the intermediate skill radiation area according to the slope of the pixel points in the intermediate skill radiation area, and render the intermediate skill radiation area after the non-walkable area is culled to obtain a target skill radiation area.
[0040] As can be seen from the above, the virtual skill radiation area generation method in the present exemplary embodiment can be executed by the terminal device 210 or the server 220.
[0041] The virtual skill radiation area generation method will be described below. Figure 3 The virtual skill radiation area generation method will be described below. Figure 3 An exemplary flow of the virtual skill radiation area generation method is shown, which includes the following steps S310 to S340:
[0042] In step S310, the virtual skill radiation range of the attacker skill is acquired, and a depth map is generated according to the grid model corresponding to the virtual occlusion body in the virtual skill radiation range.
[0043] In step S320, the occluded area in the virtual skill radiation range is acquired according to the depth map, and the occluded area in the virtual skill radiation range is culled to obtain an initial skill radiation area of the attacker skill.
[0044] In step S330, the view frustum corresponding to the initial skill radiation area is acquired, near clipping plane processing and vertical field of view angle expansion processing are performed on the view frustum, and an intermediate skill radiation area is acquired according to the processed view frustum.
[0045] In step S340, a non-walkable area in the intermediate skill radiation area is determined according to the slope of the pixel points in the intermediate skill radiation area, and the intermediate skill radiation area after the non-walkable area is culled is rendered to obtain a target skill radiation area.
[0046] Based on the above method, on the one hand, according to the depth map, the occluded area in the virtual skill radiation area is removed to obtain an initial skill radiation area, and the corresponding view frustum of the initial skill radiation area is obtained, the near clipping plane processing and the expansion of the field of view angle processing are performed on the view frustum to obtain an intermediate skill radiation area. Compared with the prior art of rendering the skill damage area to a plane, the present disclosure can be applied to complex scenes and terrains, and the rendering effect of skill radiation areas of different heights is realized, the accuracy of the virtual skill radiation area at any viewing angle is improved, and the adaptability of the virtual skill radiation area generation method is improved. On the other hand, the non-walkable area of the intermediate skill radiation area is determined according to the slope of the pixel points in the intermediate skill radiation area, and the intermediate skill radiation area from which the non-walkable area is removed is rendered to obtain a target skill radiation area. Further improve the authenticity of the generated virtual skill radiation area, and provide the player with a more referable virtual skill radiation range, effectively improve the user experience.
[0047] The following will be specifically described. Figure 3
[0048] Reference Figure 3 In step S310, the virtual skill radiation range of the attacker skill is obtained, and a depth map is generated according to the grid model corresponding to the virtual occlusion body in the virtual skill radiation range.
[0049] Wherein, the attacker can be a skill releaser, for example, the attacker can be a game character in a game scene, or a virtual transmitter in other virtual scenes. The virtual skill radiation range can be a damage range of the skill, such as a circular damage range, a fan-shaped damage range, etc. The present disclosure does not make special limitation on the acquisition method of the virtual skill radiation range, for example, the virtual skill radiation range can be obtained by setting a preset damage range radius with the attacker position as the center. It should be noted that when obtaining the virtual skill radiation range, the occlusion of the virtual skill radiation range by the virtual occlusion body in the virtual skill radiation range is not considered, that is, the virtual skill radiation range can be a complete circle or a fan shape. The virtual occlusion body can be a collision body corresponding to a virtual model in a virtual scene, which is used to calculate the hit range of the virtual skill in the server. The virtual model can include virtual buildings, virtual characters, etc. in the virtual scene. For example, the virtual occlusion body can be a collision body corresponding to a virtual building in a game scene, which can completely wrap the virtual building. The grid model corresponding to the virtual occlusion body is an accurate matching visible virtual object generated according to the virtual occlusion body, which is used to render the depth map. The depth map is a two-dimensional image recording the distance from the attacker position to the surface of the virtual occlusion body, wherein the depth value of each pixel point of the depth map can represent the distance from the attacker position to the surface of the virtual occlusion body.
[0050] In the virtual scene, due to the fact that part of the skills cannot penetrate the virtual model in the virtual scene, such as a virtual wall, when the radiation range of the skill is obtained, the area blocked by the virtual model needs to be avoided in the virtual skill radiation range; when the blocked area is determined, the distance between the skill release position of the attacker and the virtual model can usually be calculated through the virtual blocking body corresponding to the virtual model to determine whether the virtual model is in the blocked area, and since the virtual blocking body is the data used by the server to calculate the virtual skill hit result and is not a visible virtual model; therefore, in one embodiment, before obtaining the virtual skill radiation range of the attacker skill and generating a depth map according to the grid model corresponding to the virtual blocking body in the virtual skill radiation range, the above method can further include: obtaining the grid model corresponding to all virtual blocking bodies in the virtual scene.
[0051] The grid model corresponding to all virtual blocking bodies in the virtual scene is obtained in advance to generate a depth map of the attacker's perspective according to the grid model of the virtual blocking body, so that the virtual skill radiation area is rendered according to the depth map, so that the virtual skill radiation area rendered by the client is consistent with the virtual skill hit range calculated by the server according to the virtual blocking body, thereby improving the matching accuracy of the rendering effect of the client and the hit result calculated by the server.
[0052] Since the shape of the virtual blocking body is relatively fixed, such as in the Unity engine, the virtual blocking body can be divided into a box collider (Box Collider), a sphere collider (Sphere Collider), a capsule collider (Capsule Collider), and a mesh collider (Mesh Collider); and the virtual model constitutes the virtual geometry of the virtual scene, such as a virtual wall, a virtual stone, a virtual building, etc.; therefore, the shape of the virtual blocking body and the virtual model is not completely matched, and in one embodiment, the above-mentioned obtaining the grid model corresponding to all virtual blocking bodies in the virtual scene can include the following steps:
[0053] In the case where the shape of the virtual blocking body completely matches the shape of the virtual model corresponding thereto, the grid model corresponding to the virtual blocking body is obtained according to the virtual model; otherwise, the grid model corresponding to the virtual blocking body is constructed according to the structure information of the virtual blocking body.
[0054] For example, the virtual model can be a virtual wall of a cuboid, and a virtual occlusion body that completely matches the virtual model can be generated by scaling the coordinate values of the Box Collider in three axial directions. Then, the virtual model can be copied as a mesh model of the virtual occlusion body. If the virtual model is a virtual stone with a concave-convex surface, a virtual occlusion body that completely matches the virtual stone cannot be generated by scaling the collision body. Therefore, the virtual occlusion body can be obtained by scaling the SphereCollider and the like, so that the virtual occlusion body can completely wrap the virtual stone. Since the generated virtual occlusion body cannot completely match the shape of the virtual stone, the virtual base geometry needs to be scaled according to the shape information of the virtual occlusion body, that is, the radius of the virtual sphere is scaled according to the shape of the virtual occlusion body, so as to construct the mesh model corresponding to the virtual occlusion body. If the virtual model is a virtual building with an irregular shape, the virtual occlusion body corresponding to the virtual model can be generated by non-uniform scaling of the Capsule Collider or the Mesh Collider. Therefore, the mesh model of the virtual occlusion body can be constructed according to the vertex information of the virtual occlusion body.
[0055] It should be noted that the mesh model of the virtual occlusion body is only used to generate a depth map, and therefore the virtual occlusion body is invisible to the user. In order to save performance overhead, the material of the mesh model of the virtual occlusion body can be set to a material with low performance consumption.
[0056] When the shape of the virtual occlusion body completely matches the shape of the virtual occlusion body corresponding thereto, the mesh model corresponding to the virtual occlusion body is obtained according to the virtual model, which saves performance overhead and is beneficial to improving the generation efficiency of the mesh model corresponding to the virtual occlusion body, and further improving the smoothness of game running.
[0057] After the mesh model corresponding to the virtual occlusion body is generated, in an embodiment, the above-mentioned generation of a depth map according to the mesh model corresponding to the virtual occlusion body in the virtual skill radiation range can include:
[0058] Selecting a target mesh model in the virtual skill radiation range from all mesh models, and obtaining a depth map of the attacker's perspective based on the position information and shape information of the target mesh model in the virtual scene, and the position information of the attacker.
[0059] For example, the target mesh model within the virtual skill radiation range can be selected from all mesh models by a view frustum culling technique, and a depth map of the attacker's perspective can be generated. The view frustum culling technique can only render the target mesh model within the view frustum range, and when rendering the mesh model, a depth map of the attacker's perspective can be generated according to the position information and shape information of the target mesh model in the virtual scene, and the position information of the attacker. Moreover, the depth map does not need to be generated with the change of the scene frame, and only when the radius or the sector angle of the virtual skill radiation range changes, or the position or shape of the virtual occlusion body within the virtual skill radiation range changes, the depth map needs to be updated.
[0060] The method of generating the depth map of the attacker's perspective based on the target mesh model can effectively improve the generation speed of the depth map, and is beneficial to improve the overall generation efficiency of the virtual skill radiation area.
[0061] In addition, in an embodiment, when generating the depth map, the shape of the mesh model corresponding to the virtual occlusion body can be rendered in batches to generate the depth map, that is, when rendering the depth map, the mesh models of the virtual occlusion bodies with the same shape in the virtual scene can be rendered in the same batch to improve the generation efficiency of the depth map.
[0062] After obtaining the depth map of the attacker's perspective, continue to refer to Figure 3 In step S320, the occluded area in the virtual skill radiation range can be obtained according to the depth map, and the occluded area in the virtual skill radiation range is removed to obtain the initial skill radiation area of the attacker's skill.
[0063] The initial skill radiation area is an area obtained by excluding the shielding effect of the virtual occlusion body in the virtual skill radiation range, for example, the initial skill radiation area corresponding to the fan-shaped virtual skill radiation range can be as shown in Figure 4 The top view of the initial skill radiation area corresponding to the circular virtual skill radiation range can be as shown in Figure 5
[0064] In an embodiment, the above-mentioned method of obtaining the occluded area in the virtual skill radiation range according to the depth map, as shown in Figure 6 includes steps S610-S630:
[0065] Firstly, in step S610, the pixel points in the virtual skill radiation range can be transformed into the attacker's perspective coordinate system with the attacker's perspective as the origin, and the first depth value of the pixel points can be obtained based on the position of the pixel points in the attacker's perspective coordinate system.
[0066] Secondly, in order to avoid the problem of Figure 7 In the shadow distortion (Shadow Acne) problem shown, in step S620, the height of the pixel point in the vertical direction is increased according to a preset height offset value, the target position of the pixel point after the height is increased in the attacker's perspective coordinate system is obtained, and sampling is performed in the depth map based on the target position to obtain a second depth value of the pixel point.
[0067] Finally, in step S630, it is determined that the pixel point belongs to the occluded area according to the comparison result of the first depth value and the second depth value.
[0068] The preset height offset value is the height value of the pixel point increased in the vertical direction, and the disclosure does not make special limitations on the acquisition method and specific value of the preset height offset value. For example, the height of the pixel point on the Y axis of the world coordinate can be dynamically adjusted through the Unity engine, and when the shadow distortion problem disappears, the preset height offset value can be obtained according to the current height of the pixel point. The vertical direction can represent the direction directly above the pixel point in the screen, for example, the direction of the Y axis of the world coordinate in the Unity engine, or the direction of the Z axis of the world coordinate in the Unreal Engine engine.
[0069] For example, after obtaining the first depth value and the second depth value of the pixel point, when the first depth value of the pixel point is greater than the second depth value, it is determined that the pixel point belongs to the occluded area. The occluded area in the virtual skill radiation range is set to be transparent to obtain the initial skill radiation area.
[0070] Based on the method, Figure 6 When sampling the depth value of the pixel point, the shadow distortion and shadow suspension problems are effectively avoided, and by comparing the depth values to determine whether the pixel point belongs to the occluded area, the complexity of the method is reduced, and the efficiency of obtaining the occluded area is effectively improved.
[0071] After obtaining the initial skill radiation area, with reference to Figure 3 In step S330, the initial skill radiation area corresponding to the frustum can be obtained, the frustum is processed by a near clipping plane and an expanded vertical field of view angle, and the intermediate skill radiation area is obtained according to the processed frustum.
[0072] The view pyramid is a space visible to the camera, shaped like a pyramid with the top cut off, including a near clipping plane, a far clipping plane, and four pyramid planes. For example, the view pyramid corresponding to the initial skill radiation area can be regarded as the visible space obtained when the camera is located at the attacker.
[0073] In an embodiment, the view pyramid corresponding to the initial skill radiation area can include the following steps:
[0074] When the horizontal field of view of the initial skill radiation area is greater than the preset horizontal field of view threshold, the initial skill radiation area is divided into N view pyramids with equal horizontal fields of view according to the horizontal field of view of the initial skill radiation area.
[0075] The preset horizontal field of view threshold is the basis for dividing the view pyramids. The specific value of the preset horizontal field of view threshold is not particularly limited in the present disclosure. For example, the preset horizontal field of view threshold can be 120 degrees, 180 degrees, etc.
[0076] For example, if the preset horizontal field of view threshold is 120 degrees, when the horizontal field of view of the initial skill radiation area is 360 degrees, the initial skill radiation area can be equally divided into three view pyramids with a horizontal field of view of 120 degrees, and the three view pyramids are spliced to form the intermediate skill radiation area. If the preset horizontal field of view threshold is 90 degrees, when the horizontal field of view of the initial skill radiation area is 180 degrees, the initial skill radiation area can be equally divided into two view pyramids with a horizontal field of view of 90 degrees. If the preset horizontal field of view threshold is 180 degrees, when the horizontal field of view of the initial skill radiation area is 180 degrees, the view pyramid corresponding to the current initial skill radiation area can be obtained.
[0077] The method of dividing the initial skill radiation area into N view pyramids with equal horizontal fields of view can improve the accuracy of the virtual skill radiation area, making the generated virtual skill radiation area more referable.
[0078] Since the attacker and the hit target are not at the same height, the view pyramids corresponding to the initial skill radiation area obtained by the attacker and the hit target are different. Figure 8As shown, due to the limitation of the original vertical field of view of the view frustum, a portion of the area directly below the attacker cannot be within the skill's radiation range. Therefore, to further improve the accuracy of the virtual skill radiation area from any viewing angle, the view frustum can be clipped and its vertical field of view expanded. In one embodiment, the above-mentioned clipping and vertical field of view expansion processing of the view frustum may include the following steps:
[0079] Set the near-cut surface of the visual cone to a spherical arc surface with the same curvature, obtain the target vertical field of view, and expand the original vertical field of view of the visual cone to the target vertical field of view.
[0080] The original vertical field of view is the angle of the field of view of the frustum in the vertical direction. This disclosure does not specifically limit the exact angle of the original vertical field of view. For example, the original vertical field of view can be set to any angle less than 180 degrees, such as 120 degrees. Setting the original vertical field of view eliminates the need to further subdivide the frustum in the vertical direction, reducing performance overhead. The target vertical field of view is the target angle for expanding the original vertical field of view of the frustum.
[0081] It should be noted that this disclosure does not impose any special restrictions on the order in which the near-cut surface of the visual cone is set to a spherical arc surface with the same curvature, the order in which the target vertical field of view is obtained, and the order in which the original vertical field of view of the visual cone is expanded to the target vertical field of view.
[0082] To ensure that the virtual skill radiation areas have the same angle in the horizontal direction, in one embodiment, setting the near-clipping surface of the visual cone as a spherical arc surface with the same curvature may include the following steps:
[0083] The distance between each pixel in the near clipping plane of the visual cone and the attacker is adjusted according to the preset radius of the spherical arc surface, so that the near clipping plane is set as a spherical arc surface with the same curvature.
[0084] The preset spherical arc radius is the basis for setting the near-cut surface as a spherical arc surface with the same curvature. This disclosure does not impose any special limitation on the specific value of the preset spherical arc radius. For example, the preset spherical arc radius can be determined according to the specific virtual skill released by the attacker.
[0085] For example, such as Figure 9 As shown, angle β is smaller than the vertical field of view angle. However, to ensure that the virtual skill radiation area has the same subtended angle in the horizontal direction, soft clipping can be used to adjust the distance between each pixel in the near clipping plane of the view frustum and the attacker according to the preset spherical arc radius. This ensures that the distance between each pixel in the near clipping plane and the attacker is the same, thus setting the near clipping plane of the view frustum as a spherical arc surface with the same curvature, forming a shape like... Figure 10 The intermediate skill radiation area shown. Figure 10A top view of an intermediate skill radiation area is shown as Figure 10 The near clipping plane of the intermediate skill radiation area is a spherical arc surface with the same curvature, as shown. Setting the near clipping plane of the view frustum as a spherical arc surface with the same curvature can ensure that the virtual skill radiation area has the same opening angle in the horizontal direction, further improving the accuracy and authenticity of the virtual skill radiation area.
[0086] Considering that the virtual skill radiation area cannot include the position information of the hit target due to the height difference between the attacker and the hit target, the virtual skill radiation area can be expanded by expanding the vertical field of view angle. In an embodiment, the above-mentioned target vertical field of view angle can include the following steps:
[0087] The target vertical field of view angle is calculated based on the tangent value of the supplementary angle of the original vertical field of view angle, and the target vertical field of view angle is obtained according to the target vertical field of view angle.
[0088] For example, as shown in Figure 11 , Figure 11 The dashed line in the above-mentioned is two perpendicular segments. According to the three-center unity property of an equilateral triangle, the intersection line of the bottom frustum surface of the view frustum after expanding the field of view angle and the virtual ground is half of the intersection line of the bottom frustum surface of the current view frustum and the virtual ground. Therefore, as shown in Figure 12 , the target vertical field of view angle can be calculated based on the intersection line of the bottom frustum surface of the view frustum after expanding the field of view angle and the virtual ground, and the target vertical field of view angle can be calculated according to the following formulas (1) to (4):
[0089]
[0090]
[0091]
[0092]
[0093] wherein θ is half of the supplementary angle of the original vertical field of view angle fov1, and θ is half of the supplementary angle of the target vertical field of view angle fov2.
[0094] After expanding the vertical field of view angle of the view frustum to the target vertical field of view angle, the problem that the virtual skill radiation area cannot include the position information of the hit target due to the height difference between the attacker and the hit target can be improved to some extent. At the same time, the intermediate virtual skill radiation area with an expanded vertical field of view angle can realize the rendering effect of skill radiation areas with different heights, further improving the accuracy of the virtual skill radiation area, so that the virtual skill radiation area can be applied to complex scenes and terrains.
[0095] Continuing to refer toFigure 3 Since the virtual occlusion body on the virtual ground in the virtual scene is not a walkable area on each face, in step S340, the non-walkable area in the intermediate skill radiation area can be determined according to the slope of the pixel point in the intermediate skill radiation area, and the intermediate skill radiation area after excluding the non-walkable area is rendered to obtain the target skill radiation area.
[0096] The non-walkable area can be an area in which a virtual object in the virtual scene cannot walk, for example, the non-walkable area can include the side of the virtual occlusion body on the virtual ground in the virtual scene. The target skill radiation area is the actual radiation area of the attacker's skill in the virtual scene.
[0097] In an embodiment, the above-mentioned determination of the non-walkable area in the intermediate skill radiation area according to the slope of the pixel point in the intermediate skill radiation area can include steps S1310-S1320 as shown in the following table: Figure 13
[0098] In step S1310, the cosine value of the pixel point in the world coordinate in the intermediate skill radiation area is obtained, and the slope of the pixel point is determined based on the cosine value of the pixel point.
[0099] In an embodiment, the above-mentioned obtaining of the cosine value of the pixel point in the world coordinate in the intermediate skill radiation area can include steps S1410-S1420 as shown in the following table: Figure 14
[0100] In step S1410, the normal of the pixel point is obtained according to the cross product of the partial derivatives of the world coordinates of the pixel point.
[0101] In step S1420, the cosine value of the pixel point is determined based on the dot product result of the normal of the pixel point and the Y-axis direction of the world coordinate axis.
[0102] For example, the partial derivative of the x-coordinate of the world coordinate of the pixel point and the partial derivative of the y-coordinate of the world coordinate of the pixel point can be obtained by using the ddx function and the ddy function in the game engine, respectively, the normal direction of the pixel point is obtained according to the cross product of the partial derivative of the x-coordinate of the world coordinate of the pixel point and the partial derivative of the y-coordinate of the world coordinate of the pixel point, the cosine value of the pixel point is obtained based on the dot product result of the normal direction of the pixel point and the Y-axis direction of the world coordinate axis, and finally the slope of the pixel point is obtained according to the inverse cosine function and the cosine value of the pixel point.
[0103] Based on the method of Figure 14 , the cosine value of the pixel point can be obtained by the product of the coordinate points, which reduces the complexity of the algorithm, effectively improves the speed of obtaining the cosine value of the pixel point, and is beneficial to improve the overall operation efficiency.
[0104] After the slope of the pixel point is obtained, in step S1320, it can be determined that the pixel point belongs to the non-walkable region according to the comparison result of the slope of the pixel point and the preset slope threshold.
[0105] The preset slope threshold can be a basis for judging whether the pixel point belongs to the non-walkable region, and the specific value of the preset slope threshold is not specially limited in the present disclosure. For example, the preset slope threshold can be 36.87 degrees.
[0106] For example, Figure 15A may be part of the intermediate skill radiation area, and the pixel points in Figure 15A are calculated to obtain the slope of the pixel points in the black dashed box in Figure 15A If the slope of the pixel points in the black dashed box in Figure 15A is greater than the preset slope threshold, it can be determined that the black dashed box region in Figure 15A belongs to the non-walkable region. By removing the non-walkable region in the intermediate skill radiation area, the target skill radiation area shown in Figure 15B can be obtained.
[0107] Based on the method of Figure 13 , the non-walkable region is determined in the intermediate skill radiation area according to the comparison result of the slope of the pixel point and the preset slope threshold, which improves the acquisition efficiency of the non-walkable region, thereby facilitating the generation efficiency of the virtual skill radiation area.
[0108] The virtual skill radiation area generated based on the above method not only can be applied to complex scenes and terrains, realizes the rendering effect of skill radiation areas of different heights, but also improves the accuracy of the virtual skill radiation area at any viewing angle, enhances the realism of the virtual skill radiation area, and makes the generated virtual skill radiation area more referable.
[0109] In an embodiment, the virtual skill radiation area generation method of the present disclosure can be executed in the Unity engine. An exemplary flow of the virtual skill radiation area generation method of the present disclosure is shown in Figure 16 , which can generate a virtual skill radiation area according to steps S1601-S1612.
[0110] In step S1601, the shape information of the virtual model in the virtual scene and the shape information of the corresponding virtual occlusion body are obtained.
[0111] In step S1602, whether the shape of the virtual occlusion body completely matches the shape of the corresponding virtual model. If yes, go to step S1604, otherwise, go to step S1603.
[0112] In step S1603, the grid model corresponding to the virtual occlusion body is obtained according to the structure information of the virtual occlusion body.
[0113] Step S1604, a virtual model is copied as a mesh model corresponding to the virtual occlusion body;
[0114] Step S1605, the material of the mesh model corresponding to the virtual occlusion body is modified to a material with lower energy consumption;
[0115] Step S1606, the target mesh model in the virtual skill radiation range is selected from all mesh models by using the frustum culling technique, and the depth map of the attacker's perspective is generated according to the target mesh model;
[0116] Step S1607, the first depth value of the pixel point is obtained based on the position of the pixel point in the attacker's perspective coordinate system;
[0117] Step S1608, the height of the pixel point in the Y-axis direction of the world coordinate is increased according to the preset height offset value, the target position of the pixel point in the attacker's perspective coordinate system after the height is increased is obtained, and the target position is sampled in the depth map to obtain the second depth value of the pixel point;
[0118] Step S1609, the pixel point belongs to the occluded area is determined according to the comparison result of the first depth value and the second depth value of the pixel point;
[0119] Step S1610, the pixel points in the occluded area in the virtual skill radiation range are set to be transparent to obtain an initial skill radiation area;
[0120] Step S1611, the frustum corresponding to the initial skill radiation area is obtained, the frustum is processed by near clipping plane and expanded vertical field of view angle, and the processed frustum is merged to obtain an intermediate skill radiation area;
[0121] Step S1612, the non-walkable area in the intermediate skill radiation area is determined according to the slope of the pixel points in the intermediate skill radiation area, and the intermediate skill radiation area after the non-walkable area is removed is rendered to obtain a target skill radiation area.
[0122] Based on the method of Figure 16 generating a virtual skill radiation area, the accuracy and realism of the virtual skill radiation area are improved.
[0123] The exemplary embodiments of the present disclosure also provide a virtual skill radiation area generation device. As shown in Figure 17 , the virtual skill radiation area generation device 1700 can include:
[0124] The depth map generation module 1710 is configured to obtain a virtual skill radiation range of an attacker's skill, and generate a depth map according to the mesh model corresponding to the virtual occlusion body in the virtual skill radiation range;
[0125] The initial skill radiation area acquisition module 1720 is configured to acquire an occluded area in the virtual skill radiation range according to the depth map, and to cull the occluded area in the virtual skill radiation range to obtain an initial skill radiation area of the attacker skill.
[0126] The intermediate skill radiation area acquisition module 1730 is configured to acquire a view frustum corresponding to the initial skill radiation area, to perform near clipping plane processing and expanded vertical field of view angle processing on the view frustum, and to acquire an intermediate skill radiation area according to the processed view frustum.
[0127] The target skill radiation area acquisition module 1740 is configured to determine a non-walkable area in the intermediate skill radiation area according to a slope of a pixel point in the intermediate skill radiation area, and to render the intermediate skill radiation area after the non-walkable area is culled to obtain a target skill radiation area.
[0128] In an implementation, before acquiring the virtual skill radiation range of the attacker skill and generating the depth map according to the grid model corresponding to the virtual occluded body in the virtual skill radiation range, the apparatus can further include:
[0129] Acquiring the grid model corresponding to all virtual occluded bodies in the virtual scene.
[0130] In an implementation, the depth map generated according to the grid model corresponding to the virtual occluded body in the virtual skill radiation range can include:
[0131] Selecting a target grid model in all grid models and being in the virtual skill radiation range, and acquiring the depth map of the attacker perspective based on position information and shape information of the target grid model in the virtual scene and position information of the attacker.
[0132] In an implementation, the virtual skill radiation range according to the depth map can include:
[0133] Transforming a pixel point in the virtual skill radiation range into an attacker perspective coordinate system with the attacker perspective as an origin, and acquiring a first depth value of the pixel point based on a position of the pixel point in the attacker perspective coordinate system;
[0134] Increasing a height of the pixel point in a vertical direction according to a preset height offset value, acquiring a target position of the pixel point after the height is increased in the attacker perspective coordinate system, and sampling in the depth map based on the target position to obtain a second depth value of the pixel point;
[0135] Determining that the pixel point belongs to the occluded area according to a comparison result of the first depth value and the second depth value.
[0136] In an embodiment, the acquiring the view pyramid corresponding to the initial skill radiation region can include:
[0137] In a case where the horizontal field of view angle of the initial skill radiation region is greater than a preset horizontal field of view angle threshold, the initial skill radiation region is divided into N view pyramids having equal horizontal field of view angles according to the horizontal field of view angle of the initial skill radiation region.
[0138] In an embodiment, the performing the near clipping plane processing and the vertical field of view angle expansion processing on the view pyramid can include:
[0139] The near clipping plane of the view pyramid is set as a spherical arc surface having the same curvature, a target vertical field of view angle is acquired, and the original vertical field of view angle of the view pyramid is expanded to the target vertical field of view angle.
[0140] In an embodiment, the setting the near clipping plane of the view pyramid as the spherical arc surface having the same curvature can include:
[0141] The distance between each pixel point in the near clipping plane of the view pyramid and the attacker is adjusted according to a preset spherical arc surface radius, so as to set the near clipping plane as the spherical arc surface having the same curvature.
[0142] In an embodiment, the acquiring the target vertical field of view angle can include:
[0143] A complementary angle of the target vertical field of view angle is calculated based on the tangent value of the complementary angle of the original vertical field of view angle, and the target vertical field of view angle is acquired according to the complementary angle of the target vertical field of view angle.
[0144] In an embodiment, the determining the non-walkable region in the intermediate skill radiation region according to the slope of the pixel point in the intermediate skill radiation region can include:
[0145] A cosine value of the pixel point in the world coordinate in the intermediate skill radiation region is acquired, and the slope of the pixel point is determined based on the cosine value of the pixel point;
[0146] The pixel point is determined to belong to the non-walkable region according to a comparison result of the slope of the pixel point and a preset slope threshold.
[0147] In an embodiment, the acquiring the cosine value of the pixel point in the world coordinate in the intermediate skill radiation region can include:
[0148] A normal line of the pixel point is acquired according to a cross product of partial derivatives of the world coordinate of the pixel point;
[0149] The cosine value of the pixel point is determined based on a dot product result of the normal line of the pixel point and a Y-axis direction of the world coordinate axis.
[0150] The specific details of each part in the above device have been described in detail in the method embodiment, and thus will not be repeated here.
[0151] An exemplary embodiment of the present disclosure also provides a computer readable storage medium, which can be implemented in the form of a program product, and includes program codes for causing an electronic device to perform the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of the present specification when the program product is run on the electronic device. In an alternative embodiment, the program product can be implemented in the form of a portable compact disc read-only memory (CD-ROM) and includes program codes, and can be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in the present document, the readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus or device.
[0152] The program product can employ any combination of one or more readable media. The readable media can be a readable signal medium or a readable storage medium. The readable storage medium, for example, can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0153] The computer readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave, in which the readable program codes are carried. Such propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The readable signal medium can also be any readable medium other than the readable storage medium, which can send, propagate or transmit the program for use by or in conjunction with an instruction execution system, apparatus or device.
[0154] The program codes contained on the readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0155] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0156] Exemplary embodiments of this disclosure also provide an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions for the processor, such as program code. The processor executes the executable instructions to perform the methods of this exemplary embodiment.
[0157] The following is for reference. Figure 18 The electronic device is illustrated by way of a general-purpose computing device. It should be understood that... Figure 18 The electronic device 1800 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0158] like Figure 18 As shown, the electronic device 1800 may include: a processor 1810, a memory 1820, a bus 1830, an I / O (input / output) interface 1840, and a network adapter 1850.
[0159] The processor 1810 can include one or more processing units, for example: the processor 1810 can include a central processing unit (CPU), an application processor (AP), a modem processor, a display processor (DPU), a graphics processing unit (GPU), an image signal processor (ISP), a controller, an encoder, a decoder, a digital signal processor (DSP), a baseband processor, an artificial intelligence processor, etc. In an implementation, a virtual skill radiation range of an attacker skill can be obtained by the CPU, and a depth map is generated according to a grid model corresponding to a virtual occlusion body in the virtual skill radiation range; an occluded area in the virtual skill radiation range is obtained according to the depth map, the occluded area in the virtual skill radiation range is culled, to obtain an initial skill radiation area of the attacker skill; a view frustum corresponding to the initial skill radiation area is obtained, near clipping plane processing and vertical field of view angle expansion processing are performed on the view frustum, an intermediate skill radiation area is obtained according to the processed view frustum; finally, a non-walkable area in the intermediate skill radiation area is determined according to a slope of a pixel point in the intermediate skill radiation area, and the intermediate skill radiation area from which the non-walkable area is culled is rendered, to obtain a target skill radiation area.
[0160] The memory 1820 can include a volatile memory, such as a RAM 1821, a cache unit 1822, and can also include a non-volatile memory, such as a ROM 1823. The memory 1820 can also include one or more program modules 1824, such as an operating system, one or more application programs, other program modules, and program data, each of which or a combination can include implementation of a network environment. For example, the program modules 1824 can include the modules in the apparatus 1700 described above.
[0161] The bus 1830 is used to realize the connection between different components of the electronic device 1800, and can include a data bus, an address bus, and a control bus.
[0162] The electronic device 1800 can communicate with one or more external devices 1900 (such as a keyboard, a mouse, an external controller, etc.) through the I / O interface 1840.
[0163] The electronic device 1800 can communicate with one or more networks through the network adapter 1850, for example, the network adapter 1850 can provide a mobile communication solution such as 3G / 4G / 5G, or provide a wireless communication solution such as a wireless local area network, Bluetooth, near field communication, etc. The network adapter 1850 can communicate with other modules of the electronic device 1800 through the bus 1830.
[0164] Although Figure 18 Other hardware and / or software modules can also be employed in the electronic device 1800, including but not limited to a display, microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc. are not shown in the electronic device 1800.
[0165] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, such a division is not mandatory. Indeed, according to exemplary embodiments of the present disclosure, features and functionalities of two or more modules or units described above can be embodied in one module or unit. Conversely, features and functionalities of one module or unit described above can be further divided into embodied by multiple modules or units.
[0166] Those skilled in the art can understand that various aspects of the present disclosure can be implemented as a system, a method or a program product. Therefore, various aspects of the present disclosure can be embodied as a whole hardware embodiment, a whole software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects, which can be collectively referred to as "circuitry", "module" or "system". Those skilled in the art will easily conceive other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or conventional technical means in the art that are not disclosed by the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are indicated by the claims.
[0167] It should be understood that the present disclosure is not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is only limited by the appended claims.
Claims
1. A method for generating a virtual skill radiation area, characterized in that, The method comprises the following steps: obtaining a virtual skill radiation range of an attacker skill, and generating a depth map according to a grid model corresponding to a virtual occlusion body in the virtual skill radiation range; obtaining an occluded area in the virtual skill radiation range according to the depth map, and performing occlusion removal on the occluded area in the virtual skill radiation range to obtain an initial skill radiation area of the attacker skill; obtaining a view frustum corresponding to the initial skill radiation area, performing near clipping plane processing and expanding vertical field of view angle processing on the view frustum, and obtaining an intermediate skill radiation area according to the processed view frustum; determining a non-walkable area in the intermediate skill radiation area according to the slope of a pixel point in the intermediate skill radiation area, and rendering the intermediate skill radiation area after removing the non-walkable area to obtain a target skill radiation area.
2. The method of claim 1, wherein, Before the step of obtaining a virtual skill radiation range of an attacker skill, and generating a depth map according to a grid model corresponding to a virtual occlusion body in the virtual skill radiation range, the method further comprises: obtaining a grid model corresponding to all virtual occlusion bodies in a virtual scene.
3. The method of claim 1, wherein, The step of generating a depth map according to a grid model corresponding to a virtual occlusion body in the virtual skill radiation range comprises: selecting a target grid model in all grid models and located in the virtual skill radiation range, and obtaining a depth map of an attacker's perspective based on position information and shape information of the target grid model in the virtual scene and position information of the attacker.
4. The method of claim 1, wherein, The step of obtaining an occluded area in the virtual skill radiation range according to the depth map comprises: transforming a pixel point in the virtual skill radiation range into an attacker perspective coordinate system with the attacker's perspective as the origin, obtaining a first depth value of the pixel point based on the position of the pixel point in the attacker perspective coordinate system; increasing the height of the pixel point in the vertical direction according to a preset height offset value, obtaining a target position of the pixel point after increasing the height in the attacker perspective coordinate system, and sampling in the depth map based on the target position to obtain a second depth value of the pixel point; determining that the pixel point belongs to the occluded area according to the comparison result of the first depth value and the second depth value.
5. The method of claim 1, wherein, The step of obtaining a view frustum corresponding to the initial skill radiation area comprises: in the case that the horizontal field of view angle of the initial skill radiation area is greater than a preset horizontal field of view angle threshold, dividing the initial skill radiation area into N view frustums with equal horizontal field of view angles according to the horizontal field of view angle of the initial skill radiation area.
6. The method of claim 1, wherein, The step of performing near clipping plane processing and expanding vertical field of view angle processing on the view frustum comprises: setting the near clipping plane of the view frustum as a spherical arc surface with the same curvature, obtaining a target vertical field of view angle, and expanding the original vertical field of view angle of the view frustum to the target vertical field of view angle.
7. The method of claim 6, wherein, The step of setting the near clipping plane of the view frustum as a spherical arc surface with the same curvature comprises: adjusting the distance between each pixel point in the near clipping plane of the view frustum and the attacker according to a preset spherical arc surface radius to set the near clipping plane as a spherical arc surface with the same curvature.
8. The method of claim 6, wherein, The target vertical field of view angle is obtained, comprising: The target vertical field of view angle is obtained based on the tangent value of the supplementary angle of the original vertical field of view angle, and the supplementary angle of the target vertical field of view angle is calculated.
9. The method of claim 1, wherein, The non-walkable area in the intermediate skill radiation area is determined according to the slope of the pixel point in the intermediate skill radiation area, comprising: The cosine value of the pixel point in the intermediate skill radiation area in the world coordinate is obtained, and the slope of the pixel point is determined based on the cosine value of the pixel point; The pixel point belongs to the non-walkable area according to the comparison result of the slope of the pixel point and the preset slope threshold.
10. The method of claim 9, wherein, The cosine value of the pixel point in the world coordinate in the intermediate skill radiation area is obtained, comprising: The normal of the pixel point is obtained according to the cross product of the partial derivative of the world coordinate of the pixel point; The cosine value of the pixel point is determined based on the dot product result of the normal of the pixel point and the vertical direction.
11. A virtual skill radiation area generation apparatus characterized by comprising: Comprising: A depth map generation module configured to obtain a virtual skill radiation range of an attacker skill, and generate a depth map according to a grid model corresponding to a virtual occlusion body in the virtual skill radiation range; An initial skill radiation area acquisition module configured to obtain an occluded area in the virtual skill radiation range according to the depth map, and cull the occluded area in the virtual skill radiation range to obtain an initial skill radiation area of the attacker skill; An intermediate skill radiation area acquisition module configured to obtain a view pyramid corresponding to the initial skill radiation area, perform near clipping plane processing and expand vertical field of view angle processing on the view pyramid, and obtain an intermediate skill radiation area according to the processed view pyramid; A target skill radiation area acquisition module configured to determine a non-walkable area in the intermediate skill radiation area according to the slope of a pixel point in the intermediate skill radiation area, and render the intermediate skill radiation area after the non-walkable area is culled to obtain a target skill radiation area.
12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the method of any one of claims 1-10.
13. An electronic device, comprising: Comprising: A processor; A memory for storing executable instructions of the processor; Wherein the processor is configured to execute the method of any one of claims 1-10 by executing the executable instructions.
Citation Information
Patent Citations
Method and device for displaying aiming region of game weapon and electronic equipment
CN109731326A
Game control method and device, electronic equipment and storage medium
CN115487499A