A picture rendering method and apparatus, a computer device, and a storage medium
By creating model patches and effect textures when virtual characters interact with objects, and combining them with masking textures to control the area where effects are displayed, the problem of lack of dynamism in game scenes is solved, and rich special effects are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-09
- Publication Date
- 2026-03-20
AI Technical Summary
Virtual characters in game scenes lack dynamism when interacting with objects, and existing technologies struggle to enrich the scene's special effects during character movement.
When the position of the virtual character relative to the virtual object meets the conditions, a model patch is created and fitted with an effect texture. The effect display area is controlled by a mask texture, and the target effect data is generated and rendered.
It enables the presentation of special effects in the scene during the movement of virtual characters, enhancing the dynamism of the game scene and the display of special effects.
Smart Images

Figure CN115953519B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and in particular, to a picture rendering method and device, a computer device, and a storage medium. BACKGROUND
[0002] A game scene generally includes a game background, various virtual characters, and virtual objects. In a game process, the main presentation is generally the interaction between various virtual characters and the interactive operation of virtual characters on virtual objects.
[0003] In a game interaction process, various interactive control operations and related special effects of virtual characters are generally presented, such as various skill release operations and related special effects in a battle process. The game scene thus presented is relatively thin, lacks changes in the scene content outside the characters, and lacks flexibility. SUMMARY
[0004] Embodiments of the present disclosure provide at least a picture rendering method and device, a computer device, and a storage medium.
[0005] In a first aspect, the embodiments of the present disclosure provide a picture rendering method, which includes: in response to a position of a target virtual character relative to a target virtual object satisfying a preset condition, creating a model patch for carrying special effect data of the target virtual character in a region associated with the target virtual object; obtaining at least one special effect map for being attached to the model patch, and determining spatial coordinate information corresponding to each special effect map respectively; the spatial coordinate information is used to indicate coordinate information of each pixel point on the special effect map relative to the model patch; generating target special effect data based on a set mask map and the spatial coordinate information of the special effect map; the mask map is used to control a special effect display area of the special effect map; and rendering a picture based on the target special effect data.
[0006] In an optional implementation, the step of creating a model patch for carrying special effect data of the target virtual character in a region associated with the target virtual object in response to a position of a target virtual character relative to a target virtual object satisfying a preset condition includes: creating the model patch in response to the target virtual character passing through the target virtual object; and the model patch is used to display the special effect map in a portion that is blocked by the target virtual object.
[0007] In an optional implementation, the step of determining spatial coordinate information corresponding to each special effect map respectively includes: determining spatial coordinate information corresponding to at least one special effect map for being attached to the model patch based on normal information of the model patch and a shooting parameter of a virtual camera.
[0008] In an optional implementation, the generating the target special effect data based on the set mask map and the spatial coordinate information of the special effect map comprises: determining, based on the transparency coefficients of different regions indicated by the mask map, transparency information of different regions of the special effect map in the target special effect data; the different regions include an edge region, a center region, and a transition region between the edge region and the center region, and the transparency of the transition region is between the transparency of the edge region and the transparency of the center region.
[0009] In an optional implementation, the generating the target special effect data based on the set mask map and the spatial coordinate information of the special effect map comprises: determining, based on the depth coefficients of different position points indicated by the mask map, depth information in the spatial coordinate information of the special effect map in the target special effect data.
[0010] In an optional implementation, the depth coefficients of different position points indicated by the mask map are determined according to the following steps: a plurality of drawing channels are configured for the mask map based on the number of the special effect maps; and the depth coefficients of different position points indicated by the mask map are determined based on the channel depth coefficients corresponding to the plurality of drawing channels respectively and the initial depth coefficients of different position points indicated by the mask map.
[0011] In an optional implementation, the initial depth coefficients of different position points indicated by the mask map are set according to the following steps: the initial depth coefficients of different position points indicated by the mask map are set according to preset curvature information, so that a curve formed by the initial depth coefficients conforms to the preset curvature information.
[0012] In an optional implementation, the generating the target special effect data based on the set mask map and the spatial coordinate information of the special effect map comprises: synchronously moving the position of the mask map during movement of the target virtual character; and generating dynamic target special effect data based on the spatial coordinate information of the mask map at the moved position and the special effect map.
[0013] In a second aspect, the embodiments of the present disclosure further provide a picture rendering device, comprising: a creating unit configured to, in response to a position of a target virtual character relative to a target virtual object satisfying a preset condition, create a model patch for carrying special effect data of the target virtual character in a region associated with the target virtual object; a determining unit configured to acquire at least one special effect map for being attached to the model patch, and determine spatial coordinate information corresponding to each of the special effect maps; the spatial coordinate information is used to indicate coordinate information of each pixel point on the special effect map relative to the model patch; a generating unit configured to generate target special effect data based on a set mask map and the spatial coordinate information of the special effect map; the mask map is used to control a special effect display area of the special effect map; and a rendering unit configured to render a picture based on the target special effect data.
[0014] In a third aspect, the embodiments of the present disclosure further provide a computer device, comprising: a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the computer device is running, the processor and the memory communicate through the bus, and the machine readable instructions are executed by the processor to perform the steps of the first aspect or any possible implementation manner of the first aspect.
[0015] In a fourth aspect, the embodiments of the present disclosure further provide a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to perform the steps of the first aspect or any possible implementation manner of the first aspect.
[0016] In the above embodiments, the model patch can be created in the region associated with the target virtual object when the position of the target virtual character relative to the target virtual object satisfies the preset condition, and the target special effect data can be generated based on the model patch, the special effect map attached to the model patch and the set mask map. The embodiments of the present disclosure increase the special effect presentation of scene content during the movement of the virtual character. For example, the model patch and the special effect map of the embodiments of the present disclosure can be used to present the special effect of the spatial effect in the associated region (the surface of the wall) of the virtual object (such as the wall) when the virtual character passes through the virtual object, and the special effect display area can be controlled in real time through the mask, so that the special effect effect changing with the movement can be presented during the movement of the virtual character. Thus, the embodiments of the present disclosure realize the special presentation of the scene content effect during the movement of the virtual character, and make the presentation of the game scene more flexible.
[0017] In order to make the above objectives, characteristics and advantages of the present disclosure more apparent and easy to understand, the following preferred embodiments are described in detail below, and the accompanying drawings are described as follows. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required to be used in the embodiments will be briefly introduced below. The drawings incorporated into the description and form a part of the description, which show the embodiments consistent with the present disclosure, and are used to explain the technical solutions of the present disclosure together with the description. It should be understood that the following drawings only show some of the embodiments of the present disclosure, and therefore should not be considered as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained from these drawings without creative labor.
[0019] Figure 1 A flow chart of a picture rendering method provided by some embodiments of the present disclosure is shown;
[0020] Figure 2 A schematic diagram of a created model patch provided by some embodiments of the present disclosure is shown;
[0021] Figure 3 A flow chart of determining spatial coordinate information corresponding to a plurality of special effect maps respectively provided by some embodiments of the present disclosure is shown;
[0022] Figure 4 An effect diagram of controlling a special effect display area based on a set mask map provided by some embodiments of the present disclosure is shown;
[0023] FIG. 5(a) shows a display diagram of target special effect data provided by an embodiment of the present disclosure;
[0024] FIG. 5(b) shows a picture rendering diagram provided by some embodiments of the present disclosure;
[0025] Figure 6 A schematic diagram of a picture rendering device provided by an embodiment of the present disclosure is shown;
[0026] Figure 7 A schematic diagram of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0027] In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the following will be combined with the accompanying drawings of the embodiments of the present disclosure to make a clear and complete description of the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, but not all the embodiments. The components of the embodiments of the present disclosure generally described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed present disclosure, but only represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0028] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0029] The term "and / or" herein is only to describe an association relationship, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B and C can mean including any one or more elements selected from the set consisting of A, B and C.
[0030] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type of personal information involved in the present disclosure, the use range, the use scenario and the like should be informed to the user and the authorization of the user should be obtained in a proper manner according to relevant laws and regulations.
[0031] It is found through research that a game scene generally includes a game background, various virtual characters and virtual objects. Generally, in the game process, the main display is the interaction between various virtual characters and the interactive operation of virtual characters using or acting on virtual objects.
[0032] In the game interaction process, the general presentation is various interactive control operations and related special effects of virtual characters, such as various skill release operations and related special effects in the battle process. The game scene thus presented is relatively thin, lacking changes in the scene content outside the characters, and lacking flexibility.
[0033] Based on the above research, the present disclosure provides a picture rendering method, device, computer equipment and storage medium. In the above embodiments, the model patch can be created in the region associated with the target virtual object when the position of the target virtual character relative to the target virtual object meets the preset condition, and the target special effect data can be generated based on the model patch, the special effect map attached to the model patch and the set mask map. The present disclosure increases the special effect presentation of the scene content during the movement of the virtual character. For example, by using the model patch and the special effect map of the present disclosure, the special effect of the space effect can be presented in the associated region of the virtual object (the surface of the wall) when the virtual character passes through the virtual object (such as the wall), and by using the mask, the special effect display area can be controlled in real time, so that the special effect effect changing with the movement can be presented during the movement of the virtual character. Therefore, the present disclosure realizes the special presentation of the scene content special effect during the movement of the virtual character, and makes the presentation of the game scene more flexible.
[0034] In order to facilitate the understanding of the present embodiment, first, a picture rendering method disclosed by the present disclosure is introduced in detail. The execution subject of the picture rendering method provided by the present disclosure is generally a computer device with certain computing power.
[0035] Referring to Figure 1 The flowchart of the picture rendering method provided by the present disclosure is shown in FIG. 1. The method comprises steps S101-S107, wherein:
[0036] S101: In response to the position of the target virtual character relative to the target virtual object meeting the preset condition, a model patch for carrying special effect data of the target virtual character is created in a region associated with the target virtual object.
[0037] Here, the target virtual character can be understood as a game character in the game. At this time, the target virtual character can be a female character or a male character in gender, and can be a marksman character or an assassin character in occupation, etc.
[0038] Here, the target virtual object can be understood as an obstacle in the game. For example, the target virtual object can be a wall, an object, a tree, etc. In addition, the target virtual object can also be an object that can be passed through in the game, for example, the target virtual object can be grass, etc. The present disclosure does not limit the type of the target virtual object.
[0039] In the embodiments of the present disclosure, the preset condition can be understood as that the position of the target virtual role and the position of the target virtual object have an intersection, and in this case, the relationship between the target virtual role and the target virtual object can be understood as that the target virtual role passes through the target virtual object, or can also be understood as that the target virtual role moves in the target virtual object, etc., when the position of the target virtual role relative to the target virtual object satisfies the preset condition.
[0040] In specific implementation, after the target virtual role releases a related skill (such as a passing skill), it can be detected whether the position of the target virtual role relative to the target virtual object satisfies the preset condition, and if so, the process of creating the model patch is executed. For example, assuming that the target virtual role is role A, the target skill is a 1 skill corresponding to the role A, and the target virtual object is a wall. Then, the model patch for carrying the special effect data of the role A can be created in the region associated with the wall, when it is determined that the role A releases the 1 skill and the position of the role A relative to the wall satisfies the preset condition (for example, the role A passes through the wall, or the role A moves in the wall, etc.). In addition, the role A can be accelerated when it passes through the wall or moves in the wall.
[0041] It should be noted that the number of target virtual objects having an intersection with the position of the target virtual role can be one or more, and in the case of multiple target virtual objects, the types of the multiple target virtual objects can be the same or different.
[0042] In the embodiments of the present disclosure, the region associated with the target virtual object can indicate the region where the intersection of the target virtual object and the target virtual role is located. For example, in the case that the intersection of the target virtual object and the target virtual role is a wall, the position associated with the target virtual object can be the position of the wall, and in this case, the position of the wall can indicate the position between the ground and the wall in the game scene. In this case, the model patch carrying the special effect data of the target virtual role can be created at the associated position.
[0043] Specifically, the target virtual role can be bound to a particle emitter, so that the target virtual role emits the model patch in the region associated with the target virtual object through the particle emitter, to obtain the model patch carrying the special effect data of the target virtual role.
[0044] S103: Obtain at least one special effect map for fitting on the model patch, and determine spatial coordinate information corresponding to each special effect map respectively; the spatial coordinate information is used to indicate coordinate information of each pixel point on the special effect map relative to the model patch;
[0045] In the embodiments of the present disclosure, the number of special effect maps attached to the model patch can be one or multiple. In this case, the map content of the special effect map can be starry sky, universe, flowers, geometric figures, or the like. The present disclosure does not make specific limitation on the map content of the special effect map, and the actual needs shall prevail.
[0046] In the embodiments of the present disclosure, in the case where the number of special effect maps for attaching to the model patch is multiple, the map content of the multiple special effect maps can be the same or different.
[0047] In the embodiments of the present disclosure, after obtaining the at least one special effect map, the spatial coordinate information of each special effect map can be determined.
[0048] In the implementation, the UV texture map coordinates corresponding to each pixel point in each special effect map can be determined first, and then the depth information corresponding to each pixel point in each special effect map is determined, so as to obtain the spatial coordinate information of each special effect map.
[0049] S105: generating target special effect data based on the set mask map and the spatial coordinate information of the special effect map. The mask map is used to control the special effect display area of the special effect map.
[0050] In the embodiments of the present disclosure, the size information of the mask map can be set to be the same as the size information of the model patch created above. In this case, the mask map can be combined with the model patch, so that the special effect display area of the special effect map attached to the model patch can be controlled based on the mask map.
[0051] In the embodiments of the present disclosure, after generating the target special effect data based on the set mask map and the spatial coordinate information of the special effect map, the target special effect data can be displayed in the special effect display area.
[0052] S107: rendering the picture based on the target special effect data.
[0053] The picture can be understood as a game scene picture or a game operation picture in the game process.
[0054] In the embodiments of the present disclosure, in the case where the position of the target virtual character relative to the target virtual object meets the preset condition, the model patch can be created, and the at least one special effect map attached to the model patch can be obtained. Then, the spatial coordinate information of each special effect map can be determined, and the special effect map can be attached to the model patch according to the spatial coordinate information of the special effect map. The special effect display area of the special effect map in the model patch can be controlled based on the set mask map, so as to generate the target special effect data.
[0055] In the above embodiments, the model patch can be created in the region associated with the target virtual object when the position of the target virtual character relative to the target virtual object meets the preset condition, and the target special effect data can be generated based on the model patch, the special effect map attached to the model patch, and the set mask map. In the virtual character moving process, the special effect presentation of the scene content is increased, for example, in the form of the model patch and the special effect map of the present disclosure, the special effect of the space effect can be presented in the associated region (the surface of the wall) of the virtual object when the virtual character passes through the virtual object (such as the wall), and through the form of the mask, the special effect display region can be controlled in real time, so that the special effect effect changing with the movement can be presented in the virtual character moving process. Therefore, the present disclosure realizes the special presentation of the scene content special effect in the virtual character moving process, and makes the presentation of the game scene more flexible.
[0056] In an optional embodiment, for S101: in response to the position of the target virtual character relative to the target virtual object meeting the preset condition, a model patch for carrying special effect data of the target virtual character is created in a region associated with the target virtual object, specifically including the following processes:
[0057] In response to the target virtual character passing through the target virtual object, the model patch is created between the ground in the current game scene and the target virtual object; the model patch is used to display the special effect map in the part that is blocked by the target virtual object.
[0058] In the present disclosure, after detecting that the target virtual character passes through the target virtual object, the model patch can be created by calling the Greater method in the depth test ZTest, so that the model patch created can display the special effect map in the part that is blocked by the target virtual object.
[0059] For example, as shown in the game scene Figure 2 In the game scene Figure 2 , the target virtual object is a wall and grass, at this time, the model patch created between the ground in the game scene and the target virtual object is as shown in Figure 2 , and the model patch is displayed only in the part that is blocked by the target virtual object.
[0060] In the above embodiments, the model patch can be created between the ground in the game scene and the target virtual object when it is detected that the target virtual character passes through the target virtual object, so that the special effect map can be displayed in the part that is blocked by the target virtual object based on the model patch, to realize the display of the special effect map inside the target virtual object, and further make the display of the special effect map more novel and interesting, and improve the display effect of the special effect map.
[0061] In an optional implementation, for S103, determining the spatial coordinate information corresponding to each of the special effect maps, specifically includes the following process:
[0062] Based on the normal information of the model patch and the shooting parameter of the virtual camera, determine the spatial coordinate information corresponding to at least one special effect map for fitting on the model patch.
[0063] In the embodiments of the present disclosure, the virtual camera can be understood as a virtual camera corresponding to a client to which the target virtual character belongs, which is used to determine the observation angle of the client to which the target virtual character belongs.
[0064] In the embodiments of the present disclosure, the shooting parameter of the virtual camera can include the shooting angle information of the virtual camera, at this time, as shown in the following formula (1), the UV texture map coordinates of each pixel point in each special effect map can be determined based on the normal information of the model patch and the shooting angle information of the virtual camera. Figure 3
[0065] Specifically, the direction vector of each pixel point in each special effect map to the model patch can be determined by calling the dot function, at this time, the calculation process of the direction vector can be: n dot v, wherein n indicates the normal information of the model patch (i.e. the normal vector of the model patch), and v indicates the shooting angle information of the virtual camera (and the shooting direction vector of the virtual camera).
[0066] Then, the UV texture map coordinates of each pixel point in each special effect map to the model patch can be determined based on the calculated direction vector.
[0067] After obtaining the UV texture map coordinates of each pixel point in each special effect map, the initial depth information corresponding to each special effect map can be set, and based on the initial depth information and the UV texture map coordinates of each pixel point in the special effect map, the model space coordinate information corresponding to each pixel point on each special effect map can be determined.
[0068] Then, the matrix conversion algorithm (for example, unity_ObjectToWorld algorithm and unity_WorldToObject algorithm in unity) can be used to convert the model space coordinate information corresponding to each pixel point on each special effect map to world space coordinate information, at this time, the world space coordinate information is the spatial coordinate information corresponding to each pixel point on each special effect map.
[0069] In the embodiments of the present disclosure, through the matrix conversion algorithm, the spatial coordinate information corresponding to each pixel point on each special effect map can be obtained by consuming low memory resources and computing resources, thereby saving resources, improving the calculation speed, and optimizing the performance of the picture rendering method.
[0070] As can be known from the above description, in the case that the observation angles of the clients to which the target virtual role belongs are different, the shooting parameters of the virtual camera are also different, and then the UV texture map coordinates corresponding to each pixel point in the special effect map determined based on the shooting parameters of the virtual camera are also different, so that the special effect map can change following the change of the shooting parameters of the virtual camera, a certain parallax effect is formed, and the display effect of the special effect map can be further improved.
[0071] In an optional implementation, for S105: generating target special effect data based on the set mask map and the spatial coordinate information of the special effect map, the following process is specifically included:
[0072] Based on the transparency coefficients of different regions indicated by the mask map, the transparency information of different regions of the special effect map in the target special effect data is determined; the different regions include an edge region, a center region, and a transition region between the edge region and the center region, and the transparency of the transition region is between the transparency of the edge region and the transparency of the center region.
[0073] In the embodiments of the present disclosure, the pixel values of each pixel point in the mask map can indicate the transparency coefficients of different regions, and at this time, the pixel values of each pixel point in the mask map are values between 0 and 1.
[0074] At this time, the pixel values of each pixel point in the edge region in the mask map can be 0, and at this time, the transparency coefficient of the edge region is 0. The pixel values of each pixel point in the center region can be 1, and at this time, the transparency coefficient of the edge region is 1. The pixel values of each pixel point in the transition region are values between 0 and 1.
[0075] In the embodiments of the present disclosure, based on the transparency coefficients of different regions indicated by the mask map, the transparency of different regions in the model patch can be controlled, and then the transparency of different regions of at least one special effect map attached to the model patch is controlled, so as to realize the transparency information of different regions of the special effect map in the target special effect data.
[0076] Specifically, the transparency coefficients of different regions indicated by the mask map can be used to control the display of the model patch. For example, the entire display of the model patch corresponding to the center region of the mask map, the gradual display of the model patch corresponding to the transition region of the mask map, and the non-display of the model patch corresponding to the edge region of the mask map. After the at least one special effect map is attached to the model patch, the data in the special effect map corresponding to the center region of the mask map is displayed, the data in the special effect map corresponding to the transition region of the mask map is gradually displayed, and the data in the special effect map corresponding to the edge region of the mask map is not displayed.
[0077] For example, for the game scene as shown in FIG. 1A, the transparency information of different regions of the special effect map can be controlled based on the mask map as shown in FIG. 1B. Figure 2 Figure 3 For example, for the game scene as shown in FIG. 1A, the transparency information of different regions of the special effect map can be controlled based on the mask map as shown in FIG. 1B. Figure 2 Figure 4 For example, for the game scene as shown in FIG. 1A, the transparency information of different regions of the special effect map can be controlled based on the mask map as shown in FIG. 1B.
[0078] In the above embodiments, the display region and display effect of the special effect map in the target special effect data can be controlled by the transparency coefficients indicated by the mask map, so that the display region of the special effect map in the target special effect data is more natural, and the special effect map in the target special effect data can be more smoothly and naturally transitioned to the game scene, thereby improving the picture quality of the game scene.
[0079] In an optional embodiment, for S105: generating target special effect data based on the set mask map and the spatial coordinate information of the special effect map, the process further includes the following steps:
[0080] Based on the depth coefficients of different position points indicated by the mask map, the depth information in the spatial coordinate information of the special effect map in the target special effect data is determined.
[0081] In the embodiments of the present disclosure, the pixel value of each pixel point in the mask map is a value between 0 and 1, and the pixel value of each pixel point in the mask map can also indicate the depth coefficient of the different position points.
[0082] For example, when the pixel value of a pixel point in the mask map is 1, the depth coefficient of the pixel point corresponding to the pixel point in the special effect map is 1, and the depth information in the spatial coordinate information of the special effect map determined based on the depth coefficient is the initial depth information set above.
[0083] In a case where the pixel value of the pixel point in the mask map is 0, the depth coefficient of the pixel point at the corresponding position in the special effect map is 0, and in this case, the depth information in the spatial coordinate information of the special effect map determined based on the depth coefficient is 0.
[0084] In a case where the pixel value of the pixel point in the mask map is 0.5, the depth coefficient of the pixel point at the corresponding position in the special effect map is 0.5, and in this case, the depth information in the spatial coordinate information of the special effect map determined based on the depth coefficient is half of the initial depth information set above.
[0085] In the embodiments of the present disclosure, the depth coefficients of different position points indicated by the mask map can be determined, so that the initial information in the spatial coordinate information of the special effect map can be adjusted to obtain adjusted depth information.
[0086] In the above embodiments, the depth information in the spatial coordinate information of the special effect map in the target special effect data can be determined by the depth coefficients of different position points indicated by the mask map, so that different pixel points in the target special effect data can correspond to different depth information, so that the special effect map in the target special effect data can be more three-dimensional and vivid, and the display effect of the special effect map in the target special effect data can be improved.
[0087] In an optional embodiment, the depth coefficients of different position points indicated by the mask map can be determined according to the following steps:
[0088] Step S11: configuring a plurality of drawing channels for the mask map based on the number of special effect maps;
[0089] Step S12: determining the depth coefficients of different position points indicated by the mask map based on the channel depth coefficients corresponding to the plurality of drawing channels respectively and the initial depth coefficients of different position points indicated by the mask map.
[0090] In the embodiments of the present disclosure, in a case where the number of special effect maps is multiple, a plurality of drawing channels can be configured for the mask map, and in this case, the number of drawing channels corresponding to the mask map can be greater than or equal to the number of special effect maps. For example, in a case where the number of special effect maps is 3, 3 drawing channels can be configured for the mask map, and in this case, each special effect map corresponds to a drawing channel.
[0091] In this case, different channel depth coefficients can be set for different drawing channels of the mask map. For example, in a case where the number of drawing channels of the mask map is 3, the channel depth coefficient of the first drawing channel can be set to 0.5, the channel depth coefficient of the second drawing channel can be set to 0.3, and the channel depth coefficient of the third drawing channel can be set to 0.2.
[0092] At this point, the depth coefficients of different positions indicated by the mask map can be determined based on the channel depth coefficients corresponding to multiple drawing channels. Thus, the depth information in the spatial coordinate information corresponding to different effect maps can be divided by the channel depth coefficients, so that different effect maps in the target effect data can display different depth effects.
[0093] In this embodiment of the disclosure, the depth coefficient of different position points indicated by the mask map is also associated with the initial depth coefficient of different position points indicated by the mask map, wherein the initial depth coefficient can be used to control the degree of concavity of the effect map in the target effect data.
[0094] Specifically, the initial depth coefficients for different locations indicated by the mask map can be set according to the following procedure:
[0095] According to the preset curvature information, the initial depth coefficients of different position points indicated by the mask texture are set so that the curves formed by each initial depth coefficient conform to the preset curvature information.
[0096] The preset curvature information can indicate a curvature function, such as the pow function. This disclosure does not specifically limit the curvature function, but only requires that it be achievable.
[0097] In this embodiment of the disclosure, the tree pool depth coefficient at different locations in the mask texture can be set using the preset curvature information, thereby enabling the mask texture to control the special effects texture in the target special effects data to form a curve that conforms to the preset curvature information based on the initial depth coefficient.
[0098] In this embodiment of the disclosure, when there is only one effect texture, the depth coefficient of the different position points indicated by the mask texture can be determined directly based on the coefficient corresponding to the pixel value of each pixel in the mask texture and the initial depth coefficient of the mask texture at different position points set according to the preset curvature information. Thus, based on the depth coefficient of the different position points indicated by the mask texture, the depth information in the spatial coordinate information of the effect texture in the target effect data can be determined.
[0099] In this embodiment of the disclosure, it is assumed that three effect textures are obtained for attaching to the model surface, as follows: Figure 3 The shown universe effects and starry sky effects Figure 1 And starry sky effects Figure 2 Therefore, the depth information of these three effect maps, determined according to the steps described above, can be used as follows: Figure 3 As shown. By Figure 3 It can be seen that the starry sky effect Figure 1 The depth information is the least, followed by starry sky effects.Figure 2 Finally, there is the cosmic special effects image, in which the depth information of the cosmic special effects is the greatest.
[0100] At this time, as Figure 3 As shown, the display area of the three effect maps can be controlled based on the set mask map (i.e., Figure 3 The black areas corresponding to the mask textures shown are not displayed, while the white areas are fully displayed, and the transition area between the white and black areas is gradually displayed. Then, based on the spatial coordinate information corresponding to each effect texture, these three effect textures can be applied to the model facets to generate target effect data. At this point, the generated target effect data can be as shown in Figure 5(a).
[0101] In an optional implementation, regarding S105 above: generating target effect data based on the spatial coordinate information of the set mask texture and the effect texture, the method further includes the following steps:
[0102] Step S21: During the movement of the target virtual character, the position of the mask texture is moved synchronously;
[0103] Step S22: Based on the spatial coordinate information of the mask texture and the effect texture of the moving position, generate dynamically changing target effect data.
[0104] In this embodiment of the disclosure, when the target virtual character moves and the position of the target virtual character relative to the target virtual object meets the preset conditions, the particle emitter bound to the target virtual character can continuously emit model patches and make the mask texture correspond to the position of the model patch, thereby realizing the synchronous movement of the mask texture position.
[0105] At this point, target effect data can be generated in real time based on the spatial coordinate information of the moving mask texture and effect texture, thus generating dynamically changing target effect data.
[0106] In this embodiment, the duration of each model patch (or mask texture) can be set, and after the preset duration has elapsed, the model patch (or mask texture) and the target effect data within it are controlled to disappear, thereby giving the generated target effect data a trailing effect. The preset duration can be 0.2 seconds, 0.05 seconds, etc., and this disclosure does not limit the preset duration; the achievable one shall prevail.
[0107] In the embodiments of the present disclosure, in a case where the target virtual character does not move, the last model patch (or the mask map) generated at the current time can be controlled to disappear after the duration of the last model patch (or the mask map) ends.
[0108] In the embodiments of the present disclosure, in a case where the target virtual character passes through the target virtual object, a situation that part of the target virtual character is located in the target virtual object and another part of the target virtual character is located outside the target virtual object can occur. In this case, the target virtual character can be controlled to show different effects. For example, as shown in FIG. 5(b), the part of the target virtual character located in the target virtual object can be controlled to have a lower transparency, and the part of the target virtual character located outside the target virtual object can be controlled to have a higher transparency.
[0109] In another possible implementation, the screen rendering method provided by the embodiments of the present disclosure can also create a first model patch for carrying special effect data at a position associated with the target virtual character in response to the position of the target virtual character relative to the target virtual object satisfying a preset condition. Then, at least one special effect map for being attached to the first model patch can be obtained, and spatial coordinate information corresponding to each special effect map can be determined. Subsequently, target special effect data can be generated based on the spatial coordinate information of the set mask map and the special effect map, so that the target special effect data can be displayed at the position associated with the target virtual character, thereby making the display of the target virtual character more interesting and diverse.
[0110] At this time, the at least one special effect map for being attached to the first model patch can be the same as or different from the at least one special effect map for being attached to the model patch.
[0111] Alternatively, at least one second model patch can be created at a position associated with the target virtual character and / or the target virtual object in response to the position of the target virtual character relative to the target virtual object satisfying a preset condition based on the screen rendering method provided by the embodiments of the present disclosure. At this time, at least one special effect map for being attached to the at least one second model patch can be obtained, and spatial coordinate information corresponding to each special effect map can be determined. Subsequently, target special effect data corresponding to each second model patch can be generated based on the spatial coordinate information of the set mask map and the special effect map.
[0112] In a possible implementation, in a case where the target special effect data is displayed in the game scene, the target special effect data can be visible only to virtual characters within a visual range of the target virtual character, and invisible to other virtual characters in the game scene. It should be noted that the disclosure does not limit the visible range of the target special effect data, and the implementation is as required.
[0113] The application scenarios of the picture rendering method provided by the embodiments of the disclosure will be described below.
[0114] In a first application scenario, after determining that the position of the target virtual character relative to the target virtual object satisfies the preset condition at any time of the game session, the target special effect data can be generated based on the picture rendering method described above, and the target special effect data can be displayed in the special effect display area.
[0115] In a second application scenario, after determining that the target virtual character releases the target skill in the game, and the position of the target virtual character relative to the target virtual object satisfies the preset condition, the target special effect data can be generated based on the picture rendering method described above, and the target special effect data can be displayed in the special effect display area.
[0116] For example, assuming that the target virtual character is character A, the target skill is a 1 skill corresponding to the character A, and the target virtual object is a wall and grass. Then, after determining that the character A releases the 1 skill, and determining that the position of the character A relative to the target virtual object (i.e., the wall and the grass) satisfies the preset condition (for example, the character A passes through the wall, or the character A moves in the wall, etc.), the target special effect data can be generated according to the special effect generation method described above, and the target special effect data can be displayed in the special effect display area. The display duration of the target special effect data in the special effect display area can be associated with the skill duration of the 1 skill corresponding to the character A.
[0117] At this time, after determining that the skill duration of the target skill released by the target virtual character ends, the character state of the target virtual character can be detected, and at this time, the character state can indicate whether the position of the target virtual character relative to the target virtual object satisfies the preset condition. After determining that the position of the target virtual character relative to the target virtual object satisfies the preset condition based on the character state of the target virtual character, the target virtual character can be controlled to move to the nearest standable point closest to the target virtual character.
[0118] The disclosure does not limit the application scenarios of the picture rendering method described above, and the implementation is as required.
[0119] Those skilled in the art can understand that, in the above method of the specific embodiment, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process, and the specific execution order of each step should be determined according to its function and possible internal logic.
[0120] Based on the same inventive concept, the present embodiment also provides a picture rendering device corresponding to the picture rendering method. Since the principle of solving problems of the device in the present embodiment is similar to the picture rendering method in the present embodiment, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described here.
[0121] Referring to Figure 6 Fig. 1 shows a schematic diagram of a picture rendering device provided by the present embodiment, which comprises a creating unit 61, a determining unit 62, a generating unit 63, and a rendering unit 64.
[0122] The creating unit 61 is configured to, in response to the position of a target virtual role relative to a target virtual object satisfying a preset condition, create a model patch for carrying special effect data of the target virtual role in a region associated with the target virtual object.
[0123] The determining unit 62 is configured to obtain at least one special effect map for being attached to the model patch, and determine spatial coordinate information corresponding to each special effect map respectively; the spatial coordinate information is used to indicate coordinate information of each pixel point on the special effect map relative to the model patch.
[0124] The generating unit 63 is configured to generate target special effect data based on a set mask map and the spatial coordinate information of the special effect map; the mask map is used to control a special effect display area of the special effect map.
[0125] The rendering unit 64 is configured to render a picture based on the target special effect data.
[0126] In the above embodiments, the model patch can be created in the region associated with the target virtual object when the position of the target virtual character relative to the target virtual object meets the preset condition, and the target special effect data can be generated based on the model patch, the special effect map attached to the model patch, and the mask map. In the process of moving the virtual character, the present embodiment increases the special effect presentation of the scene content. For example, in the form of the model patch and the special effect map of the present embodiment, the special effect of the spatial effect can be presented in the associated region (the surface of the wall) of the virtual object when the virtual character passes through the virtual object (such as a wall), and through the form of the mask, the special effect display region can be controlled in real time, so that the special effect effect changing with the movement of the virtual character can be presented. Therefore, the present embodiment realizes the special presentation of the scene content special effect in the process of moving the virtual character, so that the presentation of the game scene is more flexible.
[0127] In a possible implementation, the creating unit 61 is further configured to: create the model patch in response to the target virtual character passing through the target virtual object; and the model patch is used to display the special effect map in a portion that is blocked by the target virtual object.
[0128] In a possible implementation, the determining unit 62 is further configured to: determine, based on the normal information of the model patch and the shooting parameter of the virtual camera, spatial coordinate information corresponding to at least one special effect map attached to the model patch.
[0129] In a possible implementation, the generating unit 63 is further configured to: determine, in the target special effect data, transparency information of different regions of the special effect map based on the transparency coefficients of the different regions indicated by the mask map; the different regions include an edge region, a center region, and a transition region between the edge region and the center region, and the transparency of the transition region is between the transparency of the edge region and the transparency of the center region.
[0130] In a possible implementation, the generating unit 63 is further configured to: determine, in the target special effect data, depth information in the spatial coordinate information of the special effect map based on the depth coefficients of different position points indicated by the mask map.
[0131] In a possible implementation, the generating unit 63 is further configured to: configure a plurality of drawing channels for the mask map based on the number of the special effect maps; and determine the depth coefficients of the different position points indicated by the mask map based on the channel depth coefficients corresponding to the plurality of drawing channels respectively and the initial depth coefficients of the different position points indicated by the mask map.
[0132] In a possible implementation, the generating unit 63 is further configured to set initial depth coefficients of different position points indicated by the mask map according to preset curvature information, so that a curve formed by the initial depth coefficients conforms to the preset curvature information.
[0133] In a possible implementation, the generating unit 63 is further configured to: during movement of the target virtual character, synchronously move the position of the mask map; and based on the mask map at the moved position and the spatial coordinate information of the special effect map, generate target special effect data that dynamically changes.
[0134] The processing procedure of each module in the device and the interaction procedure between the modules can refer to the related descriptions in the method embodiments, and will not be described in detail here.
[0135] Corresponding to the picture rendering method in Figure 1 , the embodiments of the present disclosure further provide a computer device 700, as shown in Figure 7 , a structural schematic diagram of the computer device 700 provided by the embodiments of the present disclosure, which comprises:
[0136] a processor 71, a memory 72, and a bus 73; the memory 72 is configured to store execution instructions, including an internal memory 721 and an external memory 722; the internal memory 721 is also referred to as an internal storage, and is configured to temporarily store operation data in the processor 71 and exchange data with the external memory 722 such as a hard disk; the processor 71 exchanges data with the external memory 722 through the internal memory 721; when the computer device 700 is running, the processor 71 and the memory 72 communicate through the bus 73, so that the processor 71 executes the following instructions:
[0137] in response to the position of the target virtual character relative to the target virtual object satisfying a preset condition, creating a model patch for carrying special effect data of the target virtual character in a region associated with the target virtual object;
[0138] obtaining at least one special effect map for being attached to the model patch, and determining spatial coordinate information corresponding to each special effect map respectively; the spatial coordinate information is configured to indicate coordinate information of each pixel point on the special effect map relative to the model patch;
[0139] generating target special effect data based on the set mask map and the spatial coordinate information of the special effect map; the mask map is configured to control a special effect display area of the special effect map;
[0140] rendering a picture based on the target special effect data.
[0141] The embodiment of the present disclosure further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is run by a processor, steps of the picture rendering method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer readable storage medium.
[0142] The embodiment of the present disclosure further provides a computer program product, and the computer program product carries a program code. The program code includes instructions that can be used to execute steps of the picture rendering method described in the above method embodiment. For details, refer to the above method embodiment, which will not be described here.
[0143] The computer program product can be specifically implemented by means of hardware, software or a combination thereof. In an optional embodiment, the computer program product is specifically embodied as a computer storage medium. In another optional embodiment, the computer program product is specifically embodied as a software product, such as a software development kit (SDK) and the like.
[0144] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system and device can refer to the corresponding process in the above method embodiment, which will not be described here. In several embodiments provided by the present disclosure, it should be understood that the disclosed system, device and method can be implemented by other means. The above-described device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interface, device or unit, which can be electrical, mechanical or other forms.
[0145] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment.
[0146] In addition, each functional unit in each embodiment of the present disclosure can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.
[0147] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a nonvolatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present disclosure essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0148] Finally, it should be noted that: the above-described embodiments are only specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, and not to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art who is familiar with the technology in the art can still make modifications or easily think of changes to the technical solutions described in the foregoing embodiments, or make equivalent replacements to some of the technical features; and these modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. A method for rendering images, characterized in that, include: In response to the target virtual character's position relative to the target virtual object satisfying a preset condition, a model patch for carrying the special effects data of the target virtual character is created within the area associated with the target virtual object; Obtain at least one special effect texture for attaching to the model surface, and determine the spatial coordinate information corresponding to each special effect texture; The spatial coordinate information is used to indicate the coordinate information of each pixel on the special effects texture relative to the model surface; Based on the set mask texture and the spatial coordinate information of the special effect texture, target special effect data is generated; the mask texture is used to control the special effect display area of the special effect texture; The image is rendered based on the target special effects data.
2. The method according to claim 1, characterized in that, In response to the target virtual character's position relative to the target virtual object satisfying a preset condition, a model patch for carrying the special effects data of the target virtual character is created within the area associated with the target virtual object, including: In response to a target virtual character passing through the target virtual object, the model patch is created; the model patch is used to display the effect texture in the portion occluded by the target virtual object.
3. The method according to claim 1, characterized in that, The step of determining the spatial coordinate information corresponding to each of the special effects textures includes: Based on the normal information of the model facet and the shooting parameters of the virtual camera, determine the spatial coordinate information corresponding to at least one special effects texture used to fit the model facet.
4. The method according to claim 1, characterized in that, The target effect data is generated based on the spatial coordinate information of the set mask texture and the effect texture, including: Based on the transparency coefficients of different regions indicated by the mask texture, the transparency information of different regions of the effect texture in the target effect data is determined; the different regions include edge regions, center regions, and transition regions located between the edge regions and the center regions, and the transparency of the transition regions is between the transparency of the edge regions and the transparency of the center regions.
5. The method according to claim 1, characterized in that, The target effect data is generated based on the spatial coordinate information of the set mask texture and the effect texture, including: Based on the depth coefficients of different location points indicated by the mask texture, the depth information in the spatial coordinate information of the effect texture in the target effect data is determined.
6. The method according to claim 5, characterized in that, The depth coefficients of different locations indicated by the mask map are determined according to the following steps: Based on the number of effect textures, multiple drawing channels are configured for the mask texture; Based on the channel depth coefficients corresponding to the multiple drawing channels and the initial depth coefficients of the different position points indicated by the mask map, the depth coefficients of the different position points indicated by the mask map are determined.
7. The method according to claim 6, characterized in that, Set the initial depth coefficients for different locations indicated by the mask map according to the following steps: According to the preset curvature information, the initial depth coefficients of different position points indicated by the mask texture are set so that the curves formed by each initial depth coefficient conform to the preset curvature information.
8. The method according to claim 1, characterized in that, The target effect data is generated based on the spatial coordinate information of the set mask texture and the effect texture, including: During the movement of the target virtual character, the position of the mask texture is moved synchronously; Based on the spatial coordinate information of the mask texture and the effect texture, dynamically changing target effect data is generated.
9. A screen rendering device, characterized in that, include: A creation unit is used to create a model patch for carrying the special effects data of the target virtual character within an area associated with the target virtual object, in response to the target virtual character's position relative to the target virtual object meeting preset conditions. A determining unit is used to acquire at least one special effect texture for attaching to the model surface, and to determine the spatial coordinate information corresponding to each special effect texture. The spatial coordinate information is used to indicate the coordinate information of each pixel on the special effects texture relative to the model surface; The generation unit is used to generate target special effect data based on the set mask texture and the spatial coordinate information of the special effect texture; The mask texture is used to control the display area of the special effects texture; The rendering unit is used to render the image based on the target effect data.
10. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the screen rendering method as described in any one of claims 1 to 8 are performed.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the screen rendering method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Animation effect simulation method and device
CN112489171A
Special effect graph generation method and device, equipment and storage medium
CN115358958A