CN112090084B - Object rendering method and device, storage medium and electronic equipment - Google Patents

Object rendering method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112090084B
CN112090084B CN202011317132.9A CN202011317132A CN112090084B CN 112090084 B CN112090084 B CN 112090084B CN 202011317132 A CN202011317132 A CN 202011317132A CN 112090084 B CN112090084 B CN 112090084B
Authority
CN
China
Prior art keywords
target
spraying
height
map
paint
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011317132.9A
Other languages
Chinese (zh)
Other versions
CN112090084A (en
Inventor
车征
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Perfect World Network Technology Co Ltd
Original Assignee
Chengdu Perfect World Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Perfect World Network Technology Co Ltd filed Critical Chengdu Perfect World Network Technology Co Ltd
Priority to CN202011317132.9A priority Critical patent/CN112090084B/en
Publication of CN112090084A publication Critical patent/CN112090084A/en
Application granted granted Critical
Publication of CN112090084B publication Critical patent/CN112090084B/en
Priority to PCT/CN2021/121095 priority patent/WO2022105436A1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application provides a rendering method and device of an object, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring a first height map corresponding to the target spraying object, wherein the first height map is used for representing height values of spraying paint on various positions of the target spraying object before the first spraying paint is sprayed; acquiring a second height map corresponding to the first spraying paint, wherein the second height map is used for representing height values of the first spraying paint sprayed on each position of the target spraying object; mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of the spraying paint at various positions of the target spraying object after the first spraying paint is sprayed; and rendering the target spraying object according to the target height map and the target surface map, wherein the target surface map is the surface map of the target spraying object.

Description

Object rendering method and device, storage medium and electronic equipment
Technical Field
The present application relates to the field of data processing, and in particular, to a method and an apparatus for rendering an object, a storage medium, and an electronic device.
Background
For multiplayer online battle games (e.g., shooting and fighting games) that are themed with paint and graffiti, the player can operate the virtual character to control the spray of paint (or other paint) around the spray props (e.g., prop guns, rides, etc.), where the paint is sprayed, and where it can travel; however, when paint sprayed by enemies is stepped on, the steps are difficult to carry out, and finally the number of spraying areas of each party at the end of the game is taken as a winning standard.
In the related art, paint spraying in the game can be realized in a surface map color mixing mode. Surface mapping color mixing refers to: the Surface map of an object that allows paint spraying is replaced with a render texture of a completely uniform size and content, and any area is painted with color by a Blit function for drawing one image (Surface, object) over another image.
However, the above-mentioned way of spraying the paint in the game scene needs to keep an original map if the original color of the object is to be restored. Therefore, in the related art, the pigment spraying mode in the game scene has the problem of overlarge memory resource occupation caused by the need of reserving an original map.
Disclosure of Invention
The application provides an object rendering method and device, a storage medium and electronic equipment, which are used for at least solving the problem that memory resources are excessively occupied due to the fact that an original map needs to be reserved in a pigment spraying mode in a game scene in the related art.
According to an aspect of an embodiment of the present application, there is provided an object rendering method, including: acquiring a first height map corresponding to a target spraying object, wherein the first height map is used for representing height values of spraying pigments at various positions of the target spraying object before spraying the first spraying pigment; acquiring a second height map corresponding to the first spraying paint, wherein the second height map is used for representing height values sprayed by the first spraying paint at various positions of the target spraying object; mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of spraying paint on each position of the target spraying object after the first spraying paint is sprayed; and rendering the target spraying object according to the target height map and the target surface map, wherein the target surface map is the surface map of the target spraying object.
Optionally, rendering the target spray object according to the target height map and the target surface map comprises: rendering a first spraying area of the target spraying object according to the target surface map, wherein the first spraying area is an area where the height value of the spraying pigment on the target spraying object is smaller than a target height threshold value, and the first spraying area is rendered to be a color corresponding to the target surface map; and rendering a second spraying area of the target spraying object according to the target height map, wherein the second spraying area is an area in which the height of the spraying pigment on the target spraying object is greater than or equal to the target height threshold, and the second spraying area is rendered into a color corresponding to the spraying pigment sprayed by the second spraying area.
Optionally, rendering the second spray area of the target spray object according to the target height map includes: rendering a first sub-region of the second spray region as a first color, wherein the first sub-region is a region of the second spray region where a height value of spray paint belonging to a first participant is greater than or equal to the target height threshold, the first participant is a participant to which the first spray paint belongs among a plurality of participants of a target event, and the first color is a color corresponding to the first participant; rendering a second sub-region of the second painted region as a second color, wherein the second sub-region is a region of the second painted region other than the first sub-region.
Optionally, before rendering the second spray area of the target spray object according to the target height map, the method further includes: adjusting a height value of a second spray paint within a third sub-area of the second spray area to be less than the target height threshold, wherein the second spray paint belongs to a second participant of the plurality of participants, the third sub-area being an area in which the height value of the spray paint belonging to the first participant is greater than or equal to the target height threshold in a fourth sub-area of the second spray area to which the second spray paint is sprayed.
Optionally, adjusting the height value of the second spray paint within the third sub-region of the second spray area to be less than the target height threshold comprises: reversing the height value of the sprayed paint belonging to the first party in the fourth sub-area with the target height threshold as an axis; determining a minimum value of the reversed height value and the height value of the spray paint belonging to the second party in the fourth sub-area as the height value of the spray paint belonging to the second party.
Optionally, rendering the second spray area of the target spray object according to the target height map includes: determining an area with the height value larger than the height value of the corresponding position on the target noise map as the second spraying area; rendering the second spray area to a color corresponding to the spray paint sprayed by the second spray area.
Optionally, after obtaining a target height map corresponding to the target spraying object, the method further includes: dynamically generating a first normal map corresponding to the spraying paint on the target spraying object according to the target height map; generating a diffuse reflection shadow for spray paint on the target spray object using the first normal map.
Optionally, after generating a diffuse reflection shadow for the spray paint on the target spray object using the first normal map, the method further comprises: and generating reflective bright spots for the spraying pigment sprayed on the target spraying object by using the target bright spot map.
Optionally, after dynamically generating a first normal map corresponding to the spraying paint on the target spraying object according to the target height map, the method further includes: and rendering by using the first normal map and the second normal map of the target spraying object so as to control and generate an animation that the first normal of the sprayed paint sprayed on the target spraying object and the second normal of the target spraying object alternately appear.
Optionally, obtaining a second height map corresponding to the first sprayed paint comprises: and under the condition that the first spraying pigment is detected to be sprayed on the target spraying object, acquiring the second height map corresponding to the first spraying pigment, wherein the first spraying pigment is the spraying pigment sprayed by the target virtual character.
Optionally, after detecting that the first spray paint is sprayed onto the target spray object, the method further comprises: determining a collision parameter of a target paint charge carrying the first paint color with the target paint object, wherein the collision parameter comprises: collision point, collision force and collision direction; and controlling to spray the first spraying pigment on the target spraying object by taking the collision point as an anchor point according to the collision force and the collision direction.
According to another aspect of an embodiment of the present application, there is provided an apparatus for rendering an object, including: a first acquisition unit configured to acquire a first height map corresponding to a target spray object, wherein the first height map is used to represent height values of spray paint at respective positions of the target spray object before spraying of the first spray paint; a second obtaining unit, configured to obtain a second height map corresponding to the first spraying color, where the second height map is used to represent height values of the first spraying color sprayed at various positions of the target spraying object; a mixing unit, configured to mix the first height map and the second height map to obtain a target height map, where the target height map is used to represent height values of the spray paint at various positions of the target spray object after the first spray paint is sprayed; and the first rendering unit is used for rendering the target spraying object according to the target height map and a target surface map, wherein the target surface map is the surface map of the target spraying object.
Optionally, the first rendering unit includes: a first rendering module, configured to render a first spraying area of the target spraying object according to the target surface map, where the first spraying area is an area where a height value of a spraying pigment on the target spraying object is smaller than a target height threshold, and the first spraying area is rendered as a color corresponding to the target surface map; and the second rendering module is used for rendering a second spraying area of the target spraying object according to the target height map, wherein the second spraying area is an area where the height of the pigment sprayed on the target spraying object is greater than or equal to the target height threshold, and the second spraying area is rendered into a color corresponding to the pigment sprayed on the second spraying area.
Optionally, the second rendering module comprises: a first rendering sub-module, configured to render a first sub-area of the second spraying area as a first color, where the first sub-area is an area in the second spraying area where a height value of a spraying pigment belonging to a first participant is greater than or equal to the target height threshold, the first participant is a participant to which the first spraying pigment belongs among multiple participants of a target event, and the first color is a color corresponding to the first participant; and the second rendering submodule is used for rendering a second sub-area of the second spraying area into a second color, wherein the second sub-area is the other area except the first sub-area in the second spraying area.
Optionally, the apparatus further comprises: and an adjusting unit, configured to, before rendering a second spraying region of the target spraying object according to the target height map, adjust a height value of a second spraying pigment in a third sub-region of the second spraying region to be smaller than the target height threshold, where the second spraying pigment belongs to a second participant of the multiple participants, and the third sub-region is a region where, in a fourth sub-region of the second spraying region where the second spraying pigment is sprayed, a height value of a spraying pigment belonging to the first participant is greater than or equal to the target height threshold.
Optionally, the adjusting unit includes: the reversing module is used for reversing the height value of the spraying pigment belonging to the first party in the fourth sub-area by taking the target height threshold value as an axis; and the determining module is used for determining the minimum value of the reversed height value and the height value of the spraying pigment belonging to the second party in the fourth sub-area as the height value of the spraying pigment belonging to the second party.
Optionally, the second rendering module comprises: the determining submodule is used for determining an area, with the height value larger than that of a corresponding position on the target noise map, of the target height map as the second spraying area; and the third rendering submodule is used for rendering the second spraying area into a color corresponding to the spraying pigment sprayed by the second spraying area.
Optionally, the apparatus further comprises: the first generating unit is used for dynamically generating a first normal map corresponding to the spraying pigment on the target spraying object according to the target height map after the target height map corresponding to the target spraying object is obtained; a second generating unit for generating a diffuse reflection shadow for the spray paint on the target spray object using the first normal map.
Optionally, the apparatus further comprises: and the third generating unit is used for generating a light-reflecting bright spot for the spraying pigment sprayed on the target spraying object by using the target bright spot map after the first normal map is used for generating a diffuse reflection shadow for the spraying pigment on the target spraying object.
Optionally, the apparatus further comprises: and the second rendering unit is used for rendering by using the first normal map and the second normal map of the target spraying object after dynamically generating the first normal map corresponding to the spraying paint on the target spraying object according to the target height map so as to control and generate an animation in which the first normal of the spraying paint sprayed on the target spraying object and the second normal of the target spraying object alternately appear.
Optionally, the second obtaining unit includes: an obtaining module, configured to obtain the second height map corresponding to the first spraying pigment when it is detected that the first spraying pigment is sprayed onto the target spraying object, where the first spraying pigment is a spraying pigment sprayed by a target avatar.
Optionally, the apparatus further comprises: a determining unit for determining a collision parameter of target spray ammunition carrying the first spray paint with the target spray object after the detection that the first spray paint is sprayed onto the target spray object, wherein the collision parameter includes: collision point, collision force and collision direction; and the control unit is used for controlling the first spraying pigment to be sprayed on the target spraying object by taking the collision point as an anchor point according to the collision force and the collision direction.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein the memory is used for storing the computer program; a processor for performing the method steps in any of the above embodiments by running the computer program stored on the memory.
According to a further aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to perform the method steps of any of the above embodiments when the computer program is executed.
In the embodiment of the application, a first height map corresponding to a target spraying object is obtained by combining a height map and a surface map, wherein the first height map is used for representing height values of spraying paint at various positions of the target spraying object before the first spraying paint is sprayed; acquiring a second height map corresponding to the first spraying paint, wherein the second height map is used for representing height values of the first spraying paint sprayed on each position of the target spraying object; mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of the spraying paint at various positions of the target spraying object after the first spraying paint is sprayed; the method comprises the steps of rendering a target spraying object according to a target height map and a target surface map, wherein the target surface map is the surface map of the target spraying object, rendering the spraying object according to the height map and the surface map, and the surface map is not actually modified, so that the purpose of paint spraying can be achieved without saving a copy of an original map, the rendering quality is not changed, the technical effect of reducing memory overhead can be achieved while the rendering quality is not reduced, and the problem that memory resources are excessively occupied due to the fact that one original map needs to be reserved in a paint spraying mode in a game scene in the related art is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a schematic diagram of a hardware environment for an alternative method of rendering objects according to an embodiment of the present application;
FIG. 2 is a flow chart diagram illustrating a method for rendering an optional object according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of an alternative height map superimposed with a noise map in accordance with an embodiment of the present application;
FIG. 4 is a schematic diagram of an alternative height map superimposed with a noise map according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an alternative renderer for color rendering according to an embodiment of the application;
FIG. 6 is a schematic illustration of an alternative paint color rendering result according to an embodiment of the present application;
FIG. 7 is a schematic illustration of an alternative spray paint overlay display in accordance with embodiments of the present application;
FIG. 8 is a schematic diagram of an alternative normal map generated from a height map in accordance with an embodiment of the present application;
FIG. 9 is a schematic diagram of an alternative highlight map according to an embodiment of the present application;
FIG. 10 is a schematic diagram of an alternative normal fusion according to an embodiment of the present application;
FIG. 11 is a flow chart illustrating an alternative object rendering method according to an embodiment of the present application;
FIG. 12 is a block diagram of an alternative object rendering apparatus according to an embodiment of the present application;
fig. 13 is a block diagram of an alternative electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of an embodiment of the present application, there is provided a method of rendering an object. Alternatively, in the present embodiment, the rendering method of the object may be applied to a hardware environment formed by the terminal 102 and the server 104 as shown in fig. 1. As shown in fig. 1, the server 104 is connected to the terminal 102 through a network, which may be used to provide services (such as game services, application services, etc.) for the terminal or a client (e.g., game client) installed on the terminal, may be provided with a database on the server or independent from the server, may be used to provide data storage services for the server 104, and may be used to handle cloud services, and the network includes but is not limited to: the terminal 102 is not limited to a PC (Personal Computer), a mobile phone, a tablet Computer, and the like. The rendering method of the object in the embodiment of the present application may be executed by the server 104, may be executed by the terminal 102, or may be executed by both the server 104 and the terminal 102. The terminal 102 may perform the rendering method of the object according to the embodiment of the present application, or may perform the rendering method by a client (e.g., a client of a target game) installed thereon.
Taking the method for rendering an object in this embodiment executed by the server 104 as an example, fig. 2 is a schematic flowchart of an optional method for rendering an object according to an embodiment of the present application, and as shown in fig. 2, the flowchart of the method may include the following steps:
in step S202, a first height map corresponding to the target spraying object is acquired, where the first height map is used to represent height values of the spraying color at various positions of the target spraying object before the first spraying color is sprayed.
The rendering method of the object in this embodiment may be applied to a scene in which paint is sprayed on the spraying object in an event scene, where the event scene may be a game scene, or another scene in which paint needs to be sprayed on the spraying object in the scene.
The game scene may be a game scene (e.g., a three-dimensional game scene) of a target game. The target game can be a single-player game or a multi-player game; it can be a match-up game (for example, a multiplayer online match-up game with paint and graffiti as a theme) or a non-match-up game (for example, a commercial game); can be used for end-play or hand-play. For example, the target game may be an MMO (Massive Multiplayer Online) game, an AR (Augmented Reality) game, a VR (Virtual Reality) game, or another type of game, and the game type is not limited in this embodiment.
Taking a multiplayer competitive game as an example, the target game may be NVN (e.g., 1V1, 4V4, 5V5, etc.) multiplayer battle game, and the multiplayer battle may have at least two battle parties, and two battle parties are exemplified in this embodiment. The target game may have one or more modes, different game modes may correspond to one or more play difficulties (e.g., simple, standard, difficult, etc.), and the number of players permitted for each mode may be the same or different.
The target game may have one or more game scenarios, each game scenario may correspond to one or more game modes and may also correspond to one or more battle difficulties. The game scene can be divided into a plurality of fighting routes which can be criss-cross, so that the players can conveniently control the virtual characters in the game scene to carry out flexible fighting.
It should be noted that, in the present embodiment, the description is given by taking an example in which the server executes the rendering method of the object, and the rendering method of the object in the present embodiment is also applicable to a case in which the server and the client execute the rendering method of the object together or the client executes the rendering method of the object separately.
The client of the battle game application can be run on the terminal equipment of the user (corresponding to an object), and the client can be in communication connection with the server, and the server is a background server of the battle game. The user can log in to the client running on the terminal equipment of the user in the modes of account number, password, dynamic password, associated application (third-party application) login and the like, and enter a one-play battle game by operating the client.
In one-play battle games, different players can control different virtual characters to execute game operations in a game scene through clients of battle games running on terminal devices of the players, and thus multi-player battles are conducted. The player can control the virtual character in the battle game to spray the spraying paint on the spraying object by using the spraying prop. The paint may be paint or other paint that can distinguish different participants, the spraying prop may be an instrument prop, a virtual object prop (e.g., a seat or a ride), and the spraying object may be a ground surface, an object surface in a game scene, and the like, which is not limited in this embodiment.
In the process of fighting games, when the virtual character controlled by the player enters the pigment sprayed by the player or the player, the virtual character can have the advantages of acceleration of movement, ammunition recovery, hidden state, rock climbing operation and the like, so that the playability of the games is improved.
In a battle game, if it is determined that the first spray paint is sprayed on the target spray object, the server may first obtain a height map of the target spray object before spraying the first spray paint, i.e., a first height map, which may be used to indicate height values of the spray paint at various positions of the target spray object before spraying the first spray paint (indicating which spray paint is present and which spray paint is absent).
The target painted object may be a target painted surface, for example, a particular surface in a target game scene, such as a floor, a wall, a surface of a target object (e.g., a box) in the scene, and so on. The first spray paint is a spray paint that is sprayed during a certain spray.
The first height map may indicate the height of the paint of each participant, and the height may be a specific height of the paint, or may indicate the presence or absence of the paint and the participant to which the paint belongs, by different marks. The first height map may be pre-stored in a specific storage space, such as a memory, a cache, and the like, which is not limited in this embodiment.
The same type of paint, e.g., paint of the same color, may be used by the avatars of the same participant, thereby facilitating each participant to distinguish paint painted by the same participant from paint painted by different participants.
It should be noted that, in the present embodiment, the height map may be an RG map, and the R channel and the G channel respectively correspond to different parties, and are used to represent height values of the sprayed paint of different parties.
Step S204, a second height map corresponding to the first spraying paint is obtained, wherein the second height map is used for representing height values of the first spraying paint sprayed on each position of the target spraying object.
After spraying the first spray paint, the server may calculate a height value of the first spray paint sprayed at each position of the target spray object, that is, a second height map, for example, from the spray position and the spray amount of the first spray paint.
Step S206, mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of the spraying paint on each position of the target spraying object after the first spraying paint is sprayed.
After obtaining the first height map and the second height map, the server may blend the first height map and the second height map to obtain a target height map. The different height maps may be mixed by simple superposition, or by overlaying, offsetting, etc. as described above.
The paint of the same party can have a superimposed effect (height value increased from the original) or a maintained effect (height value kept constant). The height values of the spray paint of different participants may have a covering effect (new spray paint may cover the spray paint of other participants), may have a counteracting effect (new spray paint may counteract the spray paint of other participants by a certain height value), and may also have a coexisting effect (the same location may be sprayed simultaneously by the spray paint of different participants).
For example, the target object may be painted in a location that is allowed to be covered by paint from only one participant, and new paint may either cancel (existing paint disappears) or cover (new paint remains) existing enemy paint. This location may also allow for coverage by multiple participants' paint sprays, and the new paint spray may offset some of the existing enemy paint or offset all of the existing enemy paint spray and retain some of the new paint.
And S208, rendering the target spraying object according to the target height map and the target surface map, wherein the target surface map is the surface map of the target spraying object.
A renderer (Shader) on the server may render the target spray object based on the target height map and the target surface map, which is a surface map of the target spray object representing the original color of the target spray object.
Optionally, in this embodiment, when performing rendering, based on the target height map, if two height values (corresponding to different channels, e.g., R channel, G channel) of a location (pixel point) are both smaller than a threshold value, indicating that the location is not covered by the paint of any one of the participants, the original color of the target paint object at the location is displayed at the location; if only one of the two height values of a position (pixel point) is higher than a threshold value, the position is covered by the spraying paint of a certain participant, and the corresponding color is displayed at the position.
Alternatively, when it is determined whether two height values of a certain pixel satisfy a height condition (higher than a threshold) in order of priority, for example, the R channel is determined preferentially, and if both the R channel and the G channel satisfy the height condition, the color of the R channel is displayed due to the preferential determination of the R channel.
For a game scene, the rendered game pictures can be synchronized to the clients of the players participating in the battle game so as to synchronously display the same game pictures.
Through the above steps S202 to S208, a first height map corresponding to the target spraying object is obtained, where the first height map is used to represent height values of the spraying pigments at various positions of the target spraying object before the first spraying pigment is sprayed; acquiring a second height map corresponding to the first spraying paint, wherein the second height map is used for representing height values of the first spraying paint sprayed on each position of the target spraying object; mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of the spraying paint at various positions of the target spraying object after the first spraying paint is sprayed; the method comprises the steps of rendering a target spraying object according to a target height map and a target surface map, wherein the target surface map is the surface map of the target spraying object, solving the problem that the memory resource occupation is overlarge due to the fact that an original map needs to be reserved in a pigment spraying mode in a game scene in the prior art, and reducing the memory resource occupation while not reducing the rendering quality.
As an alternative embodiment, obtaining a second height map corresponding to the first sprayed paint comprises:
s11, when it is detected that the first spray paint is sprayed onto the target spray object, acquiring a second height map corresponding to the first spray paint, wherein the first spray paint is the spray paint sprayed by the target virtual character.
Obtaining the second height map corresponding to the first spray paint may be performed after the server detects that the first spray paint is sprayed onto the target spray object, the first spray paint being the spray paint sprayed by the target avatar.
The target object (corresponding to the target player) may control the target virtual character to perform a game operation, for example, to spray a first spray paint onto the target spray object. The target virtual character may be a virtual character belonging to the first participant.
The first spraying pigment may be carried by a target bullet and sprayed on the target spraying object in a manner of scattering after explosion after colliding with the target spraying object, or thrown onto the target spraying object in a manner of throwing, which is not limited in this embodiment.
The server may detect a game operation performed by a virtual character in the battle game, for example, detect that the first paint is sprayed onto the target paint object, the first paint being paint sprayed by the target virtual character.
By the embodiment, the height map of the sprayed object after spraying is triggered and acquired by detecting the operation of the virtual object in the event scene, so that the accuracy of acquiring the height map can be improved.
As an alternative embodiment, after detecting that the first spray paint is sprayed onto the target spray object, the method further includes:
and S21, determining collision parameters of the target spraying ammunition carrying the first spraying pigment and the target spraying object, wherein the collision parameters comprise: collision point, collision force and collision direction;
and S22, controlling the first spraying pigment to be sprayed on the target spraying object by taking the collision point as an anchor point according to the collision strength and the collision direction.
If the first sprayed color is sprayed onto the target sprayed object, the effect of displaying the first sprayed color sprayed onto the sprayed object can be controlled to enhance the realism of the color spraying.
Alternatively, in this embodiment, the collision parameters of the target paint powder carrying the first paint pigment with the target paint object may be determined first, and the collision parameters may include: the collision point, the collision strength and the collision direction can also comprise the spraying amount of the first spraying pigment.
According to the collision strength and the collision direction, the first spraying paint can be sprayed on the target spraying object under the control of taking the collision point as an anchor point, for example, in order to express the effect of the fluid spreading in the air, the displacement of each vertex along with the time can be calculated according to a parabolic formula for each vertex of the first spraying paint, so that the spraying effect of the first spraying paint on the target spraying object is controlled and displayed, and the spraying area of the first spraying paint is determined.
Through this embodiment, according to collision dynamics and collision direction, use the collision point as anchor point control with spraying pigment to spraying object on, can strengthen the sense of reality of pigment spraying.
As an alternative embodiment, rendering the target spray object according to the target height map and the target surface map comprises:
s31, rendering a first spraying area of the target spraying object according to the target surface map, wherein the first spraying area is an area where the height value of the spraying pigment on the target spraying object is smaller than a target height threshold value, and the first spraying area is rendered into a color corresponding to the target surface map;
and S32, rendering a second spraying area of the target spraying object according to the target height map, wherein the second spraying area is an area where the height of the spraying pigment on the target spraying object is greater than or equal to the target height threshold, and the second spraying area is rendered into a color corresponding to the spraying pigment sprayed by the second spraying area.
When rendering the target spray object, the rendered area may be divided by a target height threshold, for example, an area where the height value of the spray paint on the target spray object is smaller than the target height threshold may be divided into a first spray area, and an area where the height value of the spray paint on the target spray object is greater than or equal to the target height threshold may be divided into a second spray area.
The target height threshold may be a height threshold for one of the sprayed paint and the height thresholds for different sprayed paints may be the same. If the spraying pigment on one pixel point is one, the height value of the spraying pigment is smaller than the target height threshold value, the pixel point belongs to a first spraying area, and otherwise, the pixel point belongs to a second spraying area. If the spraying pigment on one pixel point is multiple, if the height value of each spraying pigment is smaller than the target height threshold value, the area belongs to a first spraying area, and if not, the pixel point belongs to a second spraying area.
For a pixel point belonging to the first spraying area, since the pixel point is not covered by the spraying pigment, or the height value of the spraying pigment covering the pixel point is too small, the pixel point can be rendered according to the target surface mapping, for example, the pixel point can be rendered as the color of the pixel point in the target surface mapping.
For the pixel point belonging to the second spraying area, because the height value of the spraying pigment covering the pixel point meets the height condition, the pixel point can be rendered into the color corresponding to the spraying pigment covering the pixel point.
The rendering of the whole target spraying object can be completed by rendering different areas or different pixel points on the target spraying object.
By the embodiment, the rendering of the spraying object is controlled by configuring the threshold value of the height value of the spraying pigment, and the rationality of object spraying can be improved.
As an alternative embodiment, rendering the second painting region of the target painting object according to the target height map includes:
s41, determining the area with the height value larger than the height value of the corresponding position on the target noise map as a second spraying area;
and S42, rendering the second spraying area into a color corresponding to the spraying pigment sprayed by the second spraying area.
In order to embody the flow properties of the pigments, the height map can be adjusted by superimposing (mixing) a noise map on the height map. The mode of superposition may be: and superposing the target height map and the first noise map to obtain the superposed target height map.
For example, as shown in fig. 3, the contour of the height map on the left side is fixed without adhesion, the matching degree of the flowing property of the pigment (such as paint) is poor, and a random edge can be rendered by overlapping the noise map, so that the flowing property and the adhesion of the pigment are reflected. As shown in fig. 4, c1 is a side noise map, c2 is a side height map of c2' (height map), and c is a height map after superposition.
For the superimposed target height map (or the target height map), an area in which the height value is greater than the height value of the corresponding position on the target noise map (the second noise map may be the same noise map as the first noise map or different noise maps) may be determined as a second spraying area, and the second spraying area is rendered into a color corresponding to the spraying pigment sprayed by the second spraying area.
For example, as shown in fig. 5, for a Shader (renderer) of a building, if the height value of a pixel point is greater than a noise threshold, a paint (an example of a paint) color is displayed, otherwise, a building body color is displayed.
Through this embodiment, combine the noise map to carry out the rendering of spraying object, can improve the fidelity degree that the object was rendered, promote user's use and experience.
As an alternative embodiment, rendering the second painting region of the target painting object according to the target height map includes:
s51, rendering a first sub-area of the second spraying area into a first color, wherein the first sub-area is an area in the second spraying area, the height value of the spraying pigment of the first participant is greater than or equal to a target height threshold value, the first participant is a participant to which the first spraying pigment belongs in a plurality of participants of the target event, and the first color is a color corresponding to the first participant;
and S52, rendering a second sub-area of the second spraying area into a second color, wherein the second sub-area is the other area of the second spraying area except the first sub-area.
In the rendering, for a first sub-area of the second painting area, which is an area in the second painting area where the height value of the painting pigment belonging to the first participant (first competitor) is greater than or equal to the target height threshold, the painting pigment can be rendered into a color corresponding to the first participant, that is, the first color. The first party is a party to which the first sprayed paint belongs among a plurality of parties (parties) to the target event (target match game).
For each pixel point in the first sub-area, it may be covered by only the paint of the first participant, or may be covered by paint of other participants (for example, the second competitor) except the first participant, and no matter whether the height value of the paint of the other participants is greater than or equal to the target height threshold, as long as the height value of the paint of the first participant is greater than or equal to the target height threshold, the pixel point may be rendered to the color corresponding to the first participant.
Since the height value of the sprayed paint of a participant on each pixel point in the second spraying region is greater than or equal to the target height threshold, the other regions of the second spraying region except the first sub-region can be rendered into a color different from the first color, for example, the second color. The second color may correspond to a color of a participant other than the first participant (e.g., a second competitor), e.g., a second participant.
Alternatively, in order to ensure the rendering accuracy, the height value of the spraying material of only one participant allowed to be greater than or equal to the target height threshold value on one pixel point may be set. Therefore, in the target height mapping, if the height value of the paint sprayed on a pixel point belonging to the first participant is greater than or equal to the target height threshold, there are two cases: before spraying the first spraying pigment, the height value of the spraying pigment belonging to the first party on the pixel point is greater than or equal to a target height threshold value; before spraying the first spraying pigment, the height value of the spraying pigment belonging to the first participant on the pixel point is smaller than the target height threshold, and after spraying the first spraying pigment, the height value of the spraying pigment belonging to the first participant on the pixel point is larger than or equal to the target height threshold, and in any case, the rendering mode can meet the requirement of pigment coverage (new pigment covers old pigment).
For example, as shown in fig. 6, when performing rendering, rendering is performed preferentially according to the height value of the spray paint of the participant corresponding to the spray paint that is sprayed most recently, and the spray paints of other colors in a dot shape may be displayed in the spray paint of one color, so that the displayed spray paint has a higher degree of simulation.
Through the embodiment, the painting object is rendered according to the condition that the height value of the painting pigment belonging to the first party meets the threshold requirement, and the rendering rationality of the painting object can be improved.
As an optional embodiment, before rendering the second painting region of the target painting object according to the target height map, the method further includes:
and S61, adjusting the height value of the second spraying pigment in a third subarea of the second spraying area to be smaller than the target height threshold value, wherein the second spraying pigment belongs to a second participant in the plurality of participants, and the height value of the second spraying pigment in the third subarea of the second spraying area sprayed by the second spraying pigment belongs to an area where the height value of the first participant is larger than or equal to the target height threshold value.
The other participants than the first participant include a second participant, and the paint color used by the second participant is a second paint color. In the second sprayed region, the region to which the second sprayed color is sprayed is the fourth subregion. In the fourth sub-area, the height values of the sprayed pigments belonging to the first participant on part of the pixel points are greater than or equal to the target height threshold, and the height values of the sprayed pigments belonging to the first participant on part of the pixel points are less than the target height threshold.
For the part of the fourth sub-area where the height value of the paint of the first participant is greater than or equal to the target height threshold, that is, the third sub-area, in order to ensure that the condition that the height value of the paint of only one participant is allowed to be greater than or equal to the target height threshold on one pixel point (which is convenient for the renderer to render) is met, the height value of the second paint on each pixel point in the third sub-area may be adjusted to be less than the target height threshold.
Through this embodiment, through the height value of the spraying pigment of adjustment belonging to the second party, can make things convenient for the renderer to render, improve the accuracy that the object was rendered.
As an alternative embodiment, adjusting the height value of the second sprayed color within the third sub-area of the second sprayed area to be less than the target height threshold comprises:
s71, reversing the height value of the spraying paint belonging to the first party in the fourth sub-area by taking the target height threshold value as an axis;
s72, the minimum value between the inverted height value and the height value of the paint color belonging to the second party in the fourth sub-area is determined as the height value of the paint color belonging to the second party.
In order to adjust the height value of the second spraying pigment in the third sub-area to be smaller than the target height threshold, the height value of the spraying pigment belonging to the first party in the fourth sub-area may be inverted with the target height threshold as an axis, the inverted height value may be a value greater than or equal to zero, and for a value smaller than zero, the inverted height value may be uniformly configured to be zero; the minimum value between the inverted height value and the height value of the spray paint belonging to the second party in the fourth sub-area is determined as the height value of the spray paint belonging to the second party.
For example, as shown on the left side of fig. 7, a display region having a color a height value greater than or equal to the threshold value overlaps with a display region having a color B height value greater than or equal to the threshold value. The color B is the color of the newly sprayed paint, and a new color (color B) is required to cover the old color (color) in the battle in order to improve the playability of the game. If the determination logic of the renderer preferentially determines whether the height value of the color A is greater than the threshold, the overlapping area displays the color A. In order to adjust the height value of the overlap area color a to be smaller than the threshold value, the height value of the color B may be inverted with the threshold value as an axis to obtain B ', and min (a, B') may be used as the height value of the color a to obtain a display effect as shown in the right side of fig. 7.
By this embodiment, by inverting the height value of the new paint with the threshold value as the axis and taking the minimum value of the inverted height value and the height value of the paint of the other party as the height value of the paint of the other party, the rationality of the height value adjustment can be ensured.
It should be noted that, in the actual rendering process, each pixel point of the spraying object may be rendered in a sequential rendering manner, and it is not necessary to render the area after the spraying area is first divided, and the final rendering result is to render different spraying areas.
As an alternative embodiment, after obtaining the target height map corresponding to the target spraying object, the method further includes:
s81, dynamically generating a first normal map corresponding to the spraying paint on the target spraying object according to the target height map;
and S82, generating a diffuse reflection shadow for the spraying paint on the target spraying object by using the first normal map.
To enhance the display effect of the spray paint and improve the realism of the spray paint display, a normal map (i.e., a first normal map) of the spray paint may be used to generate a diffuse reflection shadow for the spray paint on the target spray object.
The paint spraying can be dynamically generated based on a target height chartlet, and in order to improve the efficiency of the normal chartlet, each pixel point in the height chart can be sampled twice, for example, the height value of the upper pixel point and the height value of the right pixel point are calculated according to the formula (1), and the normal value of the pixel point is calculated to obtain the corresponding normal chartlet:
New_Normal=(∆hx,∆hy,1-(∆hx)2+(∆hy)2) (1)
wherein, Δ hx = (tex (u, v) -tex (u +1, v)). Scale,. hy = (tex (u, v) -tex (u, v + 1)). Scale,. New _ Normal is the value of the corresponding pixel in the Normal map,. _ Scale is the specific coefficient,. tex (u, v) is the height value of the pixel (u, v) in the height map, and.New _ Normal is the value of the corresponding pixel in the Normal map.
For example, as shown in fig. 8, the left side of fig. 8 is a height map, and the right side of fig. 8 is a normal map generated based on the left height map.
For the first normal map obtained in the above manner, a diffuse reflection shadow may be generated for the spray paint on the target spray object using the first normal map, for example, a diffuse reflection shadow may be generated for the spray paint on the target spray object based on the distance between the value in the first normal map and the camera in the scene. For example, a diffuse reflection shadow can be created for the spray paint by lambert's diffuse reflection, half-lambert's diffuse reflection, or other modifications.
According to the embodiment, the normal map is generated for the spraying pigment through the height map, and the diffuse reflection shadow is generated for the spraying pigment based on the normal map, so that the display effect of the spraying pigment can be enhanced, and the reality of the display of the spraying pigment is improved.
As an alternative embodiment, after generating the diffuse reflection shadow for the paint on the target painted object using the first normal map, the method further comprises:
and S91, generating the light-reflecting bright spots for the spraying paint sprayed on the target spraying object by using the target bright spot map.
In order to enhance the display effect of the spray paint, a light reflecting bright spot for characterizing light irradiation may be displayed on the spray paint. The reflective speckles may be added on the paint spray using a speckle pattern.
For example, as shown in fig. 9, the highlight map may be a cube map, where a plurality of highlights are distributed on a cube, and the cube map is sampled (e.g., using a texCUBE function provided by Unity) to generate reflective highlights for the paint.
Through the embodiment, the light-reflecting bright spots are generated for the spraying pigment, so that the display effect of the spraying pigment can be enhanced, and the reality of the display of the spraying pigment is improved.
As an alternative embodiment, after dynamically generating the first normal map corresponding to the spraying paint on the target spraying object according to the target height map, the method further includes:
and S101, rendering by using the first normal map and the second normal map of the target spraying object so as to control and generate an animation in which the first normal of the spraying pigment sprayed on the target spraying object and the second normal of the target spraying object appear alternately.
In addition to the first normal map of the sprayed paint, the target sprayed object itself has one normal map, i.e., the second normal map, and the reality of the sprayed paint displayed on the sprayed object can be increased by fusing the normals in the two normal maps.
Optionally, in this embodiment, the first normal map and the second normal map of the target spraying object may be used for rendering to control generation of an animation in which the first normal of the sprayed paint sprayed on the target spraying object and the second normal of the target spraying object appear alternately.
For example, as shown in FIG. 10, the paint sprayed has a first normal, the ground has a second normal, and the first normal and the second normal can be controlled to alternate in the Shader, thereby generating a normal blending animation.
Through this embodiment, through the normal line of fusing spraying pigment and the normal line of spraying object, can improve the authenticity that the spraying effect shows.
The following explains a rendering method of an object in the embodiment of the present application with an optional example. In this example, the target event is a target battle game, the paint is paint, and the target object is the ground.
As shown in fig. 11, the flow of the rendering method of the object in the optional example may include the following steps:
and step S1102, detecting that the paint sprayed by the virtual character is sprayed on the ground.
The player controls the virtual character to launch a bullet carrying paint toward the ground, and the client can detect that the bullet hits the ground.
And step S1104, acquiring a height map after the paint is sprayed.
The client can obtain the height map after the paint is sprayed, and the height map is used for representing the height values of the paint sprayed by different competitors at each position.
In step S1106, the target spray object is rendered using the surface map, the normal map, and the height map of the floor.
The client can use the surface map of the ground, the normal map of the paint, the normal map of the ground and the height map to render the target spraying object so as to control and display the effect that games of different opponents are sprayed on the ground, wherein the normal map of the paint is obtained through dynamic calculation of the height map, and the normal map of the ground and the normal map of the paint can be subjected to normal fusion.
Through this example, can allow building, ground etc. to resume original colour, promote the adhesion of spraying paint profile, promote the object for appreciation nature of battle game, improve player's gaming experience.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, an optical disk) and includes several instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the methods according to the embodiments of the present application.
According to another aspect of the embodiment of the present application, there is also provided an object rendering apparatus for implementing the object rendering method. Fig. 12 is a schematic diagram of an alternative object rendering apparatus according to an embodiment of the present application, and as shown in fig. 12, the apparatus may include:
(1) a first acquisition unit 1202 configured to acquire a first height map corresponding to a target spray object, wherein the first height map is used to represent height values of spray paint at respective positions of the target spray object before spraying the first spray paint;
(2) a second obtaining unit 1204, connected to the first obtaining unit 1202, for obtaining a second height map corresponding to the first spraying color, where the second height map is used to represent height values of the first spraying color sprayed at various positions of the target spraying object;
(3) a mixing unit 1206, connected to the second obtaining unit 1204, for mixing the first height map and the second height map to obtain a target height map, where the target height map is used to represent height values of the spray paint at various positions of the target spray object after the first spray paint is sprayed;
(4) and the first rendering unit 1208, connected to the mixing unit 1206, for rendering the target spraying object according to the target height map and the target surface map, where the target surface map is a surface map of the target spraying object.
It should be noted that the first obtaining unit 1202 in this embodiment may be configured to perform the step S202, the second obtaining unit 1204 in this embodiment may be configured to perform the step S204, the mixing unit 1206 in this embodiment may be configured to perform the step S206, and the first rendering unit 1208 in this embodiment may be configured to perform the step S208.
Acquiring a first height map corresponding to the target spraying object through the module, wherein the first height map is used for representing height values of spraying pigments at various positions of the target spraying object before the first spraying pigments are sprayed; acquiring a second height map corresponding to the first spraying paint, wherein the second height map is used for representing height values of the first spraying paint sprayed on each position of the target spraying object; mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of the spraying paint at various positions of the target spraying object after the first spraying paint is sprayed; the target spraying object is rendered according to the target height map and the target surface map, wherein the target surface map is the surface map of the target spraying object, the problem that the memory resource occupation is overlarge due to the fact that an original map needs to be reserved in a pigment spraying mode in a game scene in the related art is solved, the memory resource occupation is reduced, and the rationality of memory use is improved.
As an alternative embodiment, the first rendering unit 1208 includes:
the first rendering module is used for rendering a first spraying area of the target spraying object according to the target surface map, wherein the first spraying area is an area with the height value of the spraying pigment on the target spraying object smaller than a target height threshold value, and the first spraying area is rendered into a color corresponding to the target surface map;
and the second rendering module is used for rendering a second spraying area of the target spraying object according to the target height map, wherein the second spraying area is an area with the height of the spraying pigment on the target spraying object larger than or equal to the target height threshold, and the second spraying area is rendered into a color corresponding to the spraying pigment sprayed by the second spraying area.
As an alternative embodiment, the second rendering module comprises:
the first rendering submodule is used for rendering a first sub-area of the second spraying area into a first color, wherein the first sub-area is an area, in the second spraying area, of which the height value of the spraying pigment belonging to the first participant is greater than or equal to a target height threshold value, the first participant is a participant to which the first spraying pigment belongs in the multiple participants of the target event, and the first color is a color corresponding to the first participant;
and the second rendering submodule is used for rendering a second sub-area of the second spraying area into a second color, wherein the second sub-area is the other area except the first sub-area in the second spraying area.
As an optional embodiment, the apparatus further includes:
and the adjusting unit is used for adjusting the height value of the second spraying pigment in a third sub-area of the second spraying area to be smaller than a target height threshold value before the second spraying area of the target spraying object is rendered according to the target height map, wherein the second spraying pigment belongs to a second participant in the multiple participants, and the height value of the spraying pigment belonging to the first participant in a fourth sub-area of the second spraying area sprayed by the second spraying pigment is larger than or equal to the target height threshold value.
As an alternative embodiment, the adjusting unit includes:
the reversing module is used for reversing the height value of the spraying pigment belonging to the first party in the fourth sub-area by taking the target height threshold value as an axis;
and the determining module is used for determining the minimum value of the reversed height value and the height value of the spraying pigment belonging to the second party in the fourth sub-area as the height value of the spraying pigment belonging to the second party.
As an alternative embodiment, the second rendering module comprises:
the determining submodule is used for determining an area, with the height value larger than that of the corresponding position on the target noise map, of the target height map as a second spraying area;
and the third rendering submodule is used for rendering the second spraying area into a color corresponding to the spraying pigment sprayed by the second spraying area.
As an optional embodiment, the apparatus further includes:
the first generating unit is used for dynamically generating a first normal map corresponding to the spraying pigment on the target spraying object according to the target height map after the target height map corresponding to the target spraying object is obtained;
and a second generating unit for generating a diffuse reflection shadow for the spray paint on the target spray object using the first normal map.
As an optional embodiment, the apparatus further includes:
and a third generating unit, configured to generate a reflective bright spot for the spray paint sprayed on the target spray object using the target bright spot map after generating a diffuse reflection shadow for the spray paint on the target spray object using the first normal map.
As an optional embodiment, the apparatus further includes:
and the second rendering unit is used for rendering by using the first normal map and the second normal map of the target spraying object after dynamically generating the first normal map corresponding to the spraying pigment on the target spraying object according to the target height map so as to control and generate the animation that the first normal of the spraying pigment sprayed on the target spraying object and the second normal of the target spraying object alternately appear.
As an alternative embodiment, the second obtaining unit 1204 includes:
the obtaining module is used for obtaining a second height map corresponding to the first spraying pigment under the condition that the first spraying pigment is detected to be sprayed on the target spraying object, wherein the first spraying pigment is the spraying pigment sprayed by the target virtual character.
As an optional embodiment, the apparatus further includes:
a determining unit for determining a collision parameter of target spray ammunition carrying the first spray paint with the target spray object after detecting that the first spray paint is sprayed onto the target spray object, wherein the collision parameter includes: collision point, collision force and collision direction;
and the control unit is used for controlling the first spraying pigment to be sprayed on the target spraying object by taking the collision point as an anchor point according to the collision force and the collision direction.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.
According to still another aspect of the embodiments of the present application, there is also provided an electronic device for implementing the rendering method of the object, where the electronic device may be a server, a terminal, or a combination thereof.
Fig. 13 is a block diagram of an alternative electronic device according to an embodiment of the present application, as shown in fig. 13, including a processor 1302, a communication interface 1304, a memory 1306, and a communication bus 1308, where the processor 1302, the communication interface 1304, and the memory 1306 communicate with each other via the communication bus 1308, where,
a memory 1306 for storing a computer program;
the processor 1302, when executing the computer program stored in the memory 1306, implements the following steps:
s1, acquiring a first height map corresponding to the target spraying object, wherein the first height map is used for representing height values of the spraying pigment at each position of the target spraying object before the first spraying pigment is sprayed;
s2, acquiring a second height map corresponding to the first spraying paint, wherein the second height map is used for representing height values of the first spraying paint sprayed on each position of the target spraying object;
s3, mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of the spraying paint at each position of the target spraying object after the first spraying paint is sprayed;
and S4, rendering the target spraying object according to the target height map and the target surface map, wherein the target surface map is the surface map of the target spraying object.
Alternatively, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 13, but this is not intended to represent only one bus or type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The memory may include RAM, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
As an example, the memory 1302 may include, but is not limited to, a first obtaining unit 1202, a second obtaining unit 1204, a mixing unit 1206, and a first rendering unit 1206 of the rendering apparatus including the object. In addition, other modules in the rendering apparatus of the above object may also be included, but are not limited to these modules, and are not described in this example again.
The processor may be a general-purpose processor, and may include but is not limited to: a CPU (Central Processing Unit), an NP (Network Processor), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 13 is only an illustration, and the device implementing the rendering method of the object may be a terminal device, and the terminal device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 13 is a diagram illustrating a structure of the electronic device. For example, the terminal device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in fig. 13, or have a different configuration than shown in fig. 13.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.
According to still another aspect of an embodiment of the present application, there is also provided a storage medium. Optionally, in this embodiment, the storage medium may be configured to execute program codes of a rendering method of any one of the objects in this embodiment of the present application.
Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the above embodiment.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
s1, acquiring a first height map corresponding to the target spraying object, wherein the first height map is used for representing height values of the spraying pigment at each position of the target spraying object before the first spraying pigment is sprayed;
s2, acquiring a second height map corresponding to the first spraying paint, wherein the second height map is used for representing height values of the first spraying paint sprayed on each position of the target spraying object;
s3, mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of the spraying paint at each position of the target spraying object after the first spraying paint is sprayed;
and S4, rendering the target spraying object according to the target height map and the target surface map, wherein the target surface map is the surface map of the target spraying object.
Optionally, the specific example in this embodiment may refer to the example described in the above embodiment, which is not described again in this embodiment.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a U disk, a ROM, a RAM, a removable hard disk, a magnetic disk, or an optical disk.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the method described in the embodiments of the present application.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, and may also be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (13)

1. A method for rendering an object, comprising:
acquiring a first height map corresponding to a target spraying object, wherein the first height map is used for representing height values of spraying pigments at various positions of the target spraying object before spraying the first spraying pigment;
acquiring a second height map corresponding to the first spraying paint, wherein the second height map is used for representing height values sprayed by the first spraying paint at various positions of the target spraying object;
mixing the first height map and the second height map to obtain a target height map, wherein the target height map is used for representing height values of spraying paint on each position of the target spraying object after the first spraying paint is sprayed;
rendering the target spraying object according to the target height map and a target surface map, wherein the target surface map is a surface map of the target spraying object;
wherein rendering the target spray object according to the target height map and the target surface map comprises: rendering a first spraying area of the target spraying object according to the target surface map, wherein the first spraying area is an area where the height value of the spraying pigment on the target spraying object is smaller than a target height threshold value, and the first spraying area is rendered to be a color corresponding to the target surface map; and rendering a second spraying area of the target spraying object according to the target height map, wherein the second spraying area is an area in which the height of the spraying pigment on the target spraying object is greater than or equal to the target height threshold, and the second spraying area is rendered into a color corresponding to the spraying pigment sprayed by the second spraying area.
2. The method of claim 1, wherein rendering the second spray area of the target spray object in accordance with the target height map comprises:
rendering a first sub-region of the second spray region as a first color, wherein the first sub-region is a region of the second spray region where a height value of spray paint belonging to a first participant is greater than or equal to the target height threshold, the first participant is a participant to which the first spray paint belongs among a plurality of participants of a target event, and the first color is a color corresponding to the first participant;
rendering a second sub-region of the second painted region as a second color, wherein the second sub-region is a region of the second painted region other than the first sub-region.
3. The method of claim 2, wherein prior to rendering the second spray area of the target spray object in accordance with the target height map, the method further comprises:
adjusting a height value of a second spray paint within a third sub-area of the second spray area to be less than the target height threshold, wherein the second spray paint belongs to a second participant of the plurality of participants, the third sub-area being an area in which the height value of the spray paint belonging to the first participant is greater than or equal to the target height threshold in a fourth sub-area of the second spray area to which the second spray paint is sprayed.
4. The method of claim 3, wherein adjusting the height value of the second spray paint in the third sub-area of the second spray area to be less than the target height threshold comprises:
reversing the height value of the sprayed paint belonging to the first party in the fourth sub-area with the target height threshold as an axis;
determining a minimum value of the reversed height value and the height value of the spray paint belonging to the second party in the fourth sub-area as the height value of the spray paint belonging to the second party.
5. The method of claim 1, wherein rendering the second spray area of the target spray object in accordance with the target height map comprises:
determining an area with the height value larger than the height value of the corresponding position on the target noise map as the second spraying area;
rendering the second spray area to a color corresponding to the spray paint sprayed by the second spray area.
6. The method of claim 1, wherein after obtaining a target height map corresponding to the target spray object, the method further comprises:
dynamically generating a first normal map corresponding to the spraying paint on the target spraying object according to the target height map;
generating a diffuse reflection shadow for spray paint on the target spray object using the first normal map.
7. The method of claim 6, after generating a diffuse reflectance shadow for spray paint on the target spray object using the first normal map, the method further comprising:
and generating reflective bright spots for the spraying pigment sprayed on the target spraying object by using the target bright spot map.
8. The method of claim 6, wherein after dynamically generating a first normal map corresponding to paint color on the target painted object according to the target height map, the method further comprises:
and rendering by using the first normal map and the second normal map of the target spraying object so as to control and generate an animation that the first normal of the sprayed paint sprayed on the target spraying object and the second normal of the target spraying object alternately appear.
9. The method of any of claims 1-8, wherein obtaining a second height map corresponding to the first sprayed paint comprises:
and under the condition that the first spraying pigment is detected to be sprayed on the target spraying object, acquiring the second height map corresponding to the first spraying pigment, wherein the first spraying pigment is the spraying pigment sprayed by the target virtual character.
10. The method according to claim 9, wherein after detecting that the first spray paint is sprayed onto the target spray object, the method further comprises:
determining a collision parameter of a target paint charge carrying the first paint color with the target paint object, wherein the collision parameter comprises: collision point, collision force and collision direction;
and controlling to spray the first spraying pigment on the target spraying object by taking the collision point as an anchor point according to the collision force and the collision direction.
11. An apparatus for rendering an object, comprising:
a first acquisition unit configured to acquire a first height map corresponding to a target spray object, wherein the first height map is used to represent height values of spray paint at respective positions of the target spray object before spraying of the first spray paint;
a second obtaining unit, configured to obtain a second height map corresponding to the first spraying color, where the second height map is used to represent height values of the first spraying color sprayed at various positions of the target spraying object;
a mixing unit, configured to mix the first height map and the second height map to obtain a target height map, where the target height map is used to represent height values of the spray paint at various positions of the target spray object after the first spray paint is sprayed;
the first rendering unit is used for rendering the target spraying object according to the target height map and a target surface map, wherein the target surface map is a surface map of the target spraying object;
wherein the first rendering unit includes: a first rendering module, configured to render a first spraying area of the target spraying object according to the target surface map, where the first spraying area is an area where a height value of a spraying pigment on the target spraying object is smaller than a target height threshold, and the first spraying area is rendered as a color corresponding to the target surface map; and the second rendering module is used for rendering a second spraying area of the target spraying object according to the target height map, wherein the second spraying area is an area where the height of the pigment sprayed on the target spraying object is greater than or equal to the target height threshold, and the second spraying area is rendered into a color corresponding to the pigment sprayed on the second spraying area.
12. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein said processor, said communication interface and said memory communicate with each other via said communication bus,
the memory for storing a computer program;
the processor for performing the method steps of any one of claims 1 to 10 by running the computer program stored on the memory.
13. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to carry out the method steps of any one of claims 1 to 10 when executed.
CN202011317132.9A 2020-11-23 2020-11-23 Object rendering method and device, storage medium and electronic equipment Active CN112090084B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011317132.9A CN112090084B (en) 2020-11-23 2020-11-23 Object rendering method and device, storage medium and electronic equipment
PCT/CN2021/121095 WO2022105436A1 (en) 2020-11-23 2021-09-27 Object rendering method and apparatus, program and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011317132.9A CN112090084B (en) 2020-11-23 2020-11-23 Object rendering method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112090084A CN112090084A (en) 2020-12-18
CN112090084B true CN112090084B (en) 2021-02-09

Family

ID=73785903

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011317132.9A Active CN112090084B (en) 2020-11-23 2020-11-23 Object rendering method and device, storage medium and electronic equipment

Country Status (2)

Country Link
CN (1) CN112090084B (en)
WO (1) WO2022105436A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112090084B (en) * 2020-11-23 2021-02-09 成都完美时空网络技术有限公司 Object rendering method and device, storage medium and electronic equipment
CN112619154A (en) * 2020-12-28 2021-04-09 网易(杭州)网络有限公司 Processing method and device of virtual model and electronic device
CN113134230B (en) * 2021-01-08 2024-03-22 成都完美时空网络技术有限公司 Clustering method and device for virtual objects, storage medium and electronic device
CN112843700B (en) * 2021-03-05 2022-08-19 腾讯科技(深圳)有限公司 Terrain image generation method and device, computer equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101819462A (en) * 2010-03-12 2010-09-01 东南大学 Image texture tactile representation system based on force/haptic interaction equipment
CN103021010A (en) * 2012-12-01 2013-04-03 王爽 Wave effect realtime rendering method based on graphics processing unit (GPU)
US9280848B1 (en) * 2011-10-24 2016-03-08 Disney Enterprises Inc. Rendering images with volumetric shadows using rectified height maps for independence in processing camera rays
EP3193308A1 (en) * 2016-01-13 2017-07-19 Sony Interactive Entertainment Inc. Apparatus and method of image rendering
CN108876883A (en) * 2018-05-24 2018-11-23 武汉斗鱼网络科技有限公司 Texture creation method, device, equipment and storage medium based on OpenGLES
CN111009026A (en) * 2019-12-24 2020-04-14 腾讯科技(深圳)有限公司 Object rendering method and device, storage medium and electronic device
CN111514581A (en) * 2020-04-26 2020-08-11 网易(杭州)网络有限公司 Method and device for displaying virtual object in game and electronic terminal
CN111957040A (en) * 2020-09-07 2020-11-20 网易(杭州)网络有限公司 Method and device for detecting shielding position, processor and electronic device

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9717982B2 (en) * 2012-12-21 2017-08-01 Microsoft Technology Licensing, Llc Client rendering of latency sensitive game features
CN104217461B (en) * 2014-07-10 2017-05-10 无锡梵天信息技术股份有限公司 A parallax mapping method based on a depth map to simulate a real-time bump effect
US10155158B2 (en) * 2016-06-13 2018-12-18 King.Com Ltd. Rendering method
US10002456B2 (en) * 2016-07-08 2018-06-19 Wargaming.Net Limited Water surface rendering in virtual environment
CN106780709B (en) * 2016-12-02 2018-09-07 腾讯科技(深圳)有限公司 A kind of method and device of determining global illumination information
CN108564646B (en) * 2018-03-28 2021-02-26 腾讯科技(深圳)有限公司 Object rendering method and device, storage medium and electronic device
CN109993822B (en) * 2019-04-10 2023-02-21 创新先进技术有限公司 Ink and wash style rendering method and device
CN110196746B (en) * 2019-05-30 2022-09-30 网易(杭州)网络有限公司 Interactive interface rendering method and device, electronic equipment and storage medium
CN110706324B (en) * 2019-10-18 2023-03-31 网易(杭州)网络有限公司 Method and device for rendering weather particles
CN111882634B (en) * 2020-07-24 2024-02-06 上海米哈游天命科技有限公司 Image rendering method, device, equipment and storage medium
CN112090084B (en) * 2020-11-23 2021-02-09 成都完美时空网络技术有限公司 Object rendering method and device, storage medium and electronic equipment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101819462A (en) * 2010-03-12 2010-09-01 东南大学 Image texture tactile representation system based on force/haptic interaction equipment
US9280848B1 (en) * 2011-10-24 2016-03-08 Disney Enterprises Inc. Rendering images with volumetric shadows using rectified height maps for independence in processing camera rays
CN103021010A (en) * 2012-12-01 2013-04-03 王爽 Wave effect realtime rendering method based on graphics processing unit (GPU)
EP3193308A1 (en) * 2016-01-13 2017-07-19 Sony Interactive Entertainment Inc. Apparatus and method of image rendering
CN108876883A (en) * 2018-05-24 2018-11-23 武汉斗鱼网络科技有限公司 Texture creation method, device, equipment and storage medium based on OpenGLES
CN111009026A (en) * 2019-12-24 2020-04-14 腾讯科技(深圳)有限公司 Object rendering method and device, storage medium and electronic device
CN111514581A (en) * 2020-04-26 2020-08-11 网易(杭州)网络有限公司 Method and device for displaying virtual object in game and electronic terminal
CN111957040A (en) * 2020-09-07 2020-11-20 网易(杭州)网络有限公司 Method and device for detecting shielding position, processor and electronic device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Shader Integration in a Virtual Reality Framework;Ives Fernando M.S.de Moura 等;《2013 XV Symposium on Virtual and Augmented Reality》;20130531;276-279 *
游戏中的三维图形特效算法设计与实现;陈雪培;《中国优秀硕士学位论文全文数据库 信息科技辑》;20170615(第06期);I138-1191 *

Also Published As

Publication number Publication date
CN112090084A (en) 2020-12-18
WO2022105436A1 (en) 2022-05-27

Similar Documents

Publication Publication Date Title
CN112090084B (en) Object rendering method and device, storage medium and electronic equipment
CN108597530B (en) Sound reproducing method and apparatus, storage medium and electronic apparatus
US8172678B2 (en) Image processing for a game
EP2371433B1 (en) Image generation device, program product, and image generation method
CN107913521B (en) The display methods and device of virtual environment picture
JP7386360B2 (en) Information processing method, apparatus and terminal device
JP5980266B2 (en) Information processing system, information processing program, information processing apparatus, and information processing method
JP2006065877A5 (en)
US10729978B2 (en) Information storage medium, information processing device, and game system
CN111921195B (en) Three-dimensional scene generation method and device, storage medium and electronic device
US11992754B2 (en) Information storage medium, game device, and game system
JP7207911B2 (en) Program, game system, server system and game providing method
JP6543361B2 (en) INFORMATION PROCESSING SYSTEM, INFORMATION PROCESSING PROGRAM, INFORMATION PROCESSING APPARATUS, AND INFORMATION PROCESSING METHOD
CN112156459A (en) Method and apparatus for controlling battle game, storage medium, and electronic apparatus
CN112402974A (en) Game scene display method and device, storage medium and electronic equipment
JP7482953B2 (en) Information processing program, information processing device, information processing method, and information processing system
AU2002301127B2 (en) Fictitious virtual centripetal calculation and simulation system
JP6561155B2 (en) Information processing system, information processing program, information processing apparatus, and information processing method
US11998842B2 (en) Method for rendering an environment in an electronic game
WO2024067009A1 (en) Virtual character display method and apparatus, and storage medium and electronic device
JP6283072B2 (en) Information processing system, information processing program, information processing apparatus, and information processing method
JP4409709B2 (en) GAME DEVICE AND INFORMATION STORAGE MEDIUM
CN114648616A (en) Terrain rendering method and device and electronic equipment
JP2003256863A (en) Image generation information, information storing medium and image generating device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant