CN116310020A - Method and device for realizing light reflection effect, computer equipment and storage medium - Google Patents
Method and device for realizing light reflection effect, computer equipment and storage medium Download PDFInfo
- Publication number
- CN116310020A CN116310020A CN202211655505.2A CN202211655505A CN116310020A CN 116310020 A CN116310020 A CN 116310020A CN 202211655505 A CN202211655505 A CN 202211655505A CN 116310020 A CN116310020 A CN 116310020A
- Authority
- CN
- China
- Prior art keywords
- reflection
- light
- virtual object
- light reflecting
- area
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/50—Controlling the output signals based on the game progress
- A63F13/52—Controlling the output signals based on the game progress involving aspects of the displayed game scene
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
- G06T19/20—Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F2300/00—Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
- A63F2300/60—Methods for processing data by generating or executing the game program
- A63F2300/66—Methods for processing data by generating or executing the game program for rendering three dimensional images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2219/00—Indexing scheme for manipulating 3D models or images for computer graphics
- G06T2219/20—Indexing scheme for editing of 3D models
- G06T2219/2012—Colour editing, changing, or manipulating; Use of colour codes
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Architecture (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Image Generation (AREA)
Abstract
The embodiment of the invention discloses a method, a device, computer equipment and a storage medium for realizing a light reflection effect; the embodiment of the invention can obtain a virtual object model with a light reflecting effect to be added, wherein the virtual object model comprises a transparent area, the smoothness corresponding to the transparent area, the preset light reflecting color and the light incidence direction are obtained, at least one light reflecting area displayed in the light reflecting color on the preset light reflecting body model is calculated based on the smoothness, the light reflecting color and the light incidence direction, a light reflecting texture map is obtained, the light reflecting texture map comprises light reflecting effect textures, the light reflecting textures in the light reflecting texture map are fused with the light reflecting area, a processed light reflecting area with the light reflecting textures and the light reflecting color is obtained, and the light reflecting effect is displayed on the transparent area on the virtual object model based on the processed light reflecting area; the embodiment of the invention can realize the real reflection effect with only a small amount of computing resources, improves the rendering speed and reduces the rendering cost.
Description
Technical Field
The invention relates to the technical field of rendering, in particular to a method and a device for realizing a reflection effect, computer equipment and a storage medium.
Background
With the rapid development of display technology, in game scenes of various games, there are often cases where a reflection effect needs to be displayed. Currently, if a reflective effect is to be achieved in a game scene, a physical-Based Rendering (PBR) method is generally used for Rendering.
However, if the actual reflection effect is to be realized, parameters such as color, smoothness, high light attribute and the like of the model need to be accurately processed, and a large amount of calculation is performed based on a physical principle, so that a large amount of calculation resources are occupied, and the rendering cost is high.
Disclosure of Invention
The embodiment of the invention provides a method, a device, computer equipment and a storage medium for realizing a reflecting effect, which can realize the real reflecting effect with only a small amount of computing resources, improve the rendering speed and reduce the rendering cost.
The embodiment of the invention provides a method for realizing a light reflecting effect, which comprises the following steps:
obtaining a virtual object model with a reflection effect to be added, wherein the virtual object model comprises a transparent area;
acquiring the smoothness, the preset reflective color and the light incidence direction corresponding to the transparent area;
calculating at least one reflection area displayed in the reflection color on a preset reflector model based on the smoothness, the reflection color and the light incidence direction;
Obtaining a reflective texture map, wherein the reflective texture map comprises reflective effect textures;
fusing the light reflecting texture in the light reflecting texture map with the light reflecting area to obtain a treated light reflecting area with the light reflecting texture and the light reflecting color;
and displaying the reflecting effect on the transparent area on the virtual object model based on the processed reflecting area.
Correspondingly, the embodiment of the invention also provides a device for realizing the reflecting effect, which comprises the following steps:
the system comprises a model acquisition unit, a reflection effect adding unit and a reflection effect adding unit, wherein the model acquisition unit is used for acquiring a virtual object model to be added with the reflection effect, and the virtual object model comprises a transparent area;
the regional parameter acquisition unit is used for acquiring the smoothness, the preset reflective color and the light incidence direction corresponding to the transparent region;
a region calculating unit for calculating at least one reflection region displayed in the reflection color on a preset reflector model based on the smoothness, the reflection color and the light incident direction;
the map obtaining unit is used for obtaining a reflective texture map, wherein the reflective texture map comprises reflective effect textures;
the texture fusion unit is used for fusing the reflective texture in the reflective texture mapping with the reflective area to obtain a processed reflective area with the reflective texture and the reflective color;
And the reflection effect display unit is used for displaying the reflection effect on the transparent area on the virtual object model based on the processed reflection area.
Correspondingly, the embodiment of the invention also provides computer equipment, which comprises a memory and a processor; the memory stores an application program, and the processor is configured to run the application program in the memory, so as to execute steps in any one of the light reflection effect implementation methods provided by the embodiments of the present invention.
Correspondingly, the embodiment of the invention also provides a computer readable storage medium, which stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the steps in any one of the light reflection effect implementation methods provided by the embodiment of the invention.
In addition, the embodiment of the invention also provides a computer program product, which comprises a computer program or instructions, wherein the computer program or instructions realize the steps in any of the light reflection effect implementation methods provided by the embodiment of the invention when being executed by a processor.
By adopting the scheme of the embodiment of the invention, the virtual object model with the light reflecting effect to be added can be obtained, the virtual object model comprises a transparent area, the smoothness corresponding to the transparent area, the preset light reflecting color and the light incident direction are obtained, based on the smoothness, the light reflecting color and the light incident direction, at least one light reflecting area displayed by the light reflecting color on the preset light reflecting body model is calculated, the light reflecting texture map is obtained, the light reflecting texture map comprises light reflecting effect textures, the light reflecting textures in the light reflecting texture map are fused with the light reflecting area, the processed light reflecting area with the light reflecting textures and the light reflecting color is obtained, and the light reflecting effect is displayed on the transparent area on the virtual object model based on the processed light reflecting area; in the embodiment of the invention, after the light reflecting area is obtained, the light texture in the light reflecting effect is realized through the light reflecting effect texture in the light reflecting problem map, and a large amount of physical correlation operation is not needed to be carried out based on a physical principle so as to realize the light emitting effect, so that the real light reflecting effect can be realized with only a small amount of calculation resources, the rendering speed is improved, and the rendering cost is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of a scenario of a method for implementing a light reflection effect according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for implementing a light reflection effect according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a virtual object model provided by an embodiment of the present invention;
FIG. 4 is a schematic illustration of a reflector model exhibiting retroreflective regions provided in accordance with an embodiment of the present invention;
FIG. 5 is a schematic diagram of a reflective texture map provided by an embodiment of the present invention;
FIG. 6 is a schematic view of a treated retroreflective region provided by an embodiment of the present invention;
FIG. 7 is a schematic diagram of a light reflection effect achieved before transparency is not adjusted according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of a reflection effect after transparency adjustment according to an embodiment of the present invention;
FIG. 9 is another flowchart of a method for implementing a light reflection effect according to an embodiment of the present invention;
Fig. 10 is a schematic structural diagram of a reflection effect implementation device according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of another embodiment of a reflection effect implementation device according to the present invention;
fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
The embodiment of the invention provides a method, a device, computer equipment and a computer readable storage medium for realizing a light reflection effect. Specifically, the embodiment of the invention provides a light reflection effect implementation method suitable for a light reflection effect implementation device, and the light reflection effect implementation device can be integrated in computer equipment.
The computer device may be a terminal or the like, including but not limited to a mobile terminal, such as a mobile terminal including but not limited to a smart phone, a smart watch, a tablet computer, a notebook computer, a smart car, etc., and a fixed terminal including but not limited to a desktop computer, a smart television, etc.
The computer device may be a server, which may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network ), and basic cloud computing services such as big data and artificial intelligence platform, but is not limited thereto.
The method for realizing the light reflecting effect can be realized by a server or a terminal and the server together.
The method for realizing the light reflection effect by the terminal and the server is taken as an example, and the method is described below.
As shown in fig. 1, the reflection effect implementation system provided by the embodiment of the present invention includes a terminal 10, a server 20, and the like; the terminal 10 and the server 20 are connected through a network, for example, a wired or wireless network connection, wherein the server 20 may exist as a computer device storing data such as a virtual object model, smoothness, a preset reflective color, and a light incident direction.
Wherein the terminal 10 may be configured to send a display data acquisition request to the server 20 in response to a display instruction of the virtual object model.
The server 20 may be configured to transmit the virtual object model, the smoothness, the preset reflective color, and the light incident direction to the terminal 10 in response to the display data acquisition request.
The terminal 10 may be configured to receive a virtual object model to be added with a light reflection effect, where the virtual object model includes a transparent area, obtains a smoothness corresponding to the transparent area, a preset light reflection color, and a light incidence direction, calculates at least one light reflection area displayed in the light reflection color on the preset light reflection body model based on the smoothness, the light reflection color, and the light incidence direction, obtains a light reflection texture map, where the light reflection texture map includes a light reflection effect texture, fuses the light reflection texture in the light reflection texture map with the light reflection area, and obtains a processed light reflection area having the light reflection texture and the light reflection color, and displays the light reflection effect on the transparent area on the virtual object model based on the processed light reflection area.
It will be appreciated that in some embodiments, the steps performed by the terminal 10 to achieve the light reflection effect may also be performed by the server 20, which is not limited by the embodiment of the present invention.
The following will describe in detail. The following description of the embodiments is not intended to limit the preferred embodiments.
The embodiments of the present invention will be described from the perspective of a light reflection effect implementation apparatus, which may be integrated in a server or a terminal in particular.
As shown in fig. 2, the specific flow of the method for implementing the light reflection effect in this embodiment may be as follows:
201. and obtaining a virtual object model with a reflection effect to be added, wherein the virtual object model comprises a transparent area.
The virtual object model is a model of a virtual object which needs to realize a reflection effect. In particular, the virtual object model may be a model of a dynamic or static virtual object.
For example, the virtual object model may be a model of a mirror that is static in the virtual environment; alternatively, the virtual object model may be a dynamic reflective object model, such as a model of a vehicle having a metal housing, or the like.
Specifically, the transparent region is a component of the virtual object model, and is a region in the virtual object model. It should be noted that the transparent region does not mean that the content presented in the transparent region is necessarily presented in a transparent form, but means that when the light reflection effect is not displayed, the transparent region is in a transparent state, and does not affect the light reflection effect to be presented.
Taking the virtual object model as a mirror, as shown in fig. 3, the structure of the whole mirror (i.e., the virtual object model) can be divided into three partial areas from back to front, which are respectively a decorative outer frame, a base drawing capable of showing a mirror looking effect in the mirror, and glass for enabling the surface of the mirror to have a light reflecting effect, wherein the glass partial areas are transparent areas.
It will be appreciated that in fig. 3, the current viewing angle is completely transparent as there is no reflection of the glass surface, which produces a reflection effect when the viewing angle is moved to the front of the mirror.
In some alternative embodiments, in order to add a light reflection effect other than a simple light effect to the virtual object model, the virtual object model may further include an image display area, and the transparent area may be superimposed on the image display area. At this time, the method for implementing the light reflection effect provided by the embodiment of the invention may further include:
and acquiring a target display image corresponding to the virtual object model, and displaying the target display image in the image display area so that the reflection effect in the transparent area is overlapped and displayed on the target display image.
Wherein the target display image may be an image for display in the image display area. Image content of the virtual object model reflecting the virtual scene may be included in the target display image, or some specific image content may be included in the target display image.
The image display area is an area for displaying image contents needing to be superimposed with the reflection effect in the virtual object model. Specifically, the image display area may display some image content by displaying the target display image, and since the transparent area is superimposed on the image display area, the reflective effect may be superimposed on the image content displayed by the image display area through the transparent area.
It will be appreciated that, in addition to the image display area, other areas may be provided in the virtual object model to display some images, but the image content displayed by the other areas displaying images is not superimposed with the reflective effect displayed by the transparent areas.
For example, the region where the base map is located as shown in fig. 3 is the image display region, and the base map is the target display image.
Alternatively, when the transparent region is superimposed on the image display region, a part of the image display region may be covered, or the transparent region may entirely cover the image display region. The transparent region may be the same size as the image display region or may be different from the image display region.
In some examples, the determining, according to the information of the virtual scene, a portion that needs to be reflected by the virtual object model to generate a target display image, where the step of "obtaining the target display image corresponding to the virtual object model" may specifically include:
generating a reflected object image based on a target reflected object in the virtual scene, which needs to be reflected by the virtual object model;
and generating a target display image corresponding to the virtual object model according to the reflected object image and the preset background image.
In particular, the virtual scene may be a virtual environment that an application program displays (or provides) while running on a terminal or server. The virtual scene is any one of a two-dimensional virtual scene and a three-dimensional virtual scene, and the virtual environment can be sky, land, ocean and the like, wherein the land comprises environmental elements such as deserts, cities and the like.
For example, in a 2D card game, the virtual scene may be a scene for displaying a released card or a virtual object corresponding to the displayed card, and the exemplary virtual scene may include: arenas, battle fields, or other "field" elements or other elements that may display the status of card play.
Wherein the target reflective object may be a static object or a controlled dynamic object in the virtual scene. For example, the target reflective object may be a plant, a table and chair, etc. in a virtual scene; alternatively, the target reflective object may be a virtual character, a virtual animal, a cartoon character, or the like.
Specifically, the reflection object image may be an image including only the target reflection object, or the reflection object image may be an image including the target reflection object and a virtual scene of a certain range around the position where the target reflection object is located.
The background image may be a preset image that provides background information for a target reflective object in the reflective object image. In some examples, the background image may be an image of the virtual scene in which the target reflective object is currently located, may be an image of other virtual scenes, or the background image may be empty.
For example, the virtual object model may be a mirror, and one virtual character in the virtual scene may be stored as RT as a target display image. The avatar in RT is movable, e.g., the avatar's actions may change. By displaying RT in the image display area, an effect that the virtual character stands in the mirror, that is, an effect that the virtual character looks in the mirror can be created.
Where RT is a render target, which may also be referred to as a render target, rendering the 3D scene to an intermediate storage buffer or Render Target Texture (RTT).
In the embodiment of the invention, when a game virtual character stands in a scene, a game picture at the moment can be stored as RT, and the RT can be used as a static picture of a base picture. The game virtual character can do any action in the scene, and the game picture is recorded in real time in the RT and then displayed in the image display area of the virtual object model.
RT is understood to be a movie curtain that replaces a fixed target display image. Different content can be played on the movie canvas (i.e., RT), say that a virtual character is walking. It will be appreciated that no model of the avatar may appear in the actual virtual scene, but the avatar's walking content is displayed on the canvas.
In the practical application process, the virtual image reflected by the virtual object model is represented by the target display image in the image display area, and because the virtual image reflected by the virtual object model is not actually directly irradiated by light, the virtual image is darker, in order to reflect the stereoscopic impression of the reflection effect of the virtual object model, the brightness of the target display image can be adjusted, so that the display effect of the target display image in the image display area in the virtual object model is more real, that is, before the step of displaying the target display image in the image display area, the method for realizing the reflection effect provided by the embodiment of the invention further includes:
Acquiring the sight direction of a game player, and determining the sight included angle between the sight direction and the virtual object model;
based on the included angle of the line of sight, predicting the reflection brightness of the display image of the display target through the virtual object model;
and adjusting the image brightness of the target display image according to the reflection brightness to obtain the target display image with the brightness adjusted.
Wherein the line of sight direction may be a viewing direction of the game player. In the process of game making, a camera can be arranged, wherein the direction in which the camera is placed is the viewing direction of a game player, and according to the different positions and angles of the camera, the game object can be viewed from different directions, and in the actual game process, the viewing direction can be understood as the direction perpendicular to the screen displaying the game picture.
The line-of-sight angle may be an angle between the line-of-sight direction and a normal direction of the virtual object model. The virtual object model may include a plurality of pixel points, each pixel point corresponding to a respective normal direction, where the normal direction is a direction perpendicular to a plane in which the pixel point is located.
Specifically, the prediction mode between the included angle of the line of sight and the reflection brightness can be set by a technician according to the actual display requirement. For example, the line of sight angle and the reflected brightness may be linear or nonlinear.
Optionally, when the target display image is adjusted according to the reflection brightness, the brightness of the target display image may be adjusted to the reflection brightness, or the reflection brightness may be mapped according to a preset mapping relationship, so as to obtain the brightness of the target display image to be adjusted, and the specific mapping relationship may be designed by a technician according to the actual display requirement.
In the game, a third person viewing angle is generally adopted, and instead of the game player facing the virtual object model directly under the first person viewing angle, an included angle exists between the player viewing angle and the virtual object model. The brightness of the target display image is also adjusted as a way to create a sense of volume in the art. By using the effect of the target display image with the image brightness adjusted, the display effect of the virtual object model can be better integrated into the scene. For example, for the case of a virtual character looking down on a mirror, the resulting effect may be a more stiff effect similar to the virtual character actually standing inside the virtual scene, rather than directly mapping.
202. And acquiring the smoothness, the preset reflective color and the light incidence direction corresponding to the transparent area.
The smoothness is used for controlling the smoothness of the reflecting surface for realizing the reflecting effect. Taking the virtual object model as a mirror as an example, the smoothness corresponding to the transparent area is the smoothness of the surface of the mirror.
Specifically, the technician can set the color of the light reflecting effect, that is, the light reflecting color according to the actual display requirement. For example, the reflective color may be set to yellow; alternatively, the reflection color may be set to be the same as the color of a certain virtual object in the virtual scene, where the color of the virtual object is the reflection color, and so on.
Wherein the light incident direction is the simulated illumination direction. It will be appreciated that the direction of incidence of light here does not actually produce illumination, but is merely used to calculate the light reflection effect.
For example, the illumination direction may be set for glass, assuming that the light comes from the upper left corner of the virtual object model, and the light comes from the upper left corner regardless of how the virtual object model moves, rotates, and the user's perspective changes. That is, for a virtual object model, the parameters of the light incident direction for the virtual object model are unchanged regardless of how the user switches the viewing angle.
203. Based on the smoothness, the reflection color and the light incidence direction, at least one reflection area displayed in the reflection color on a preset reflector model is calculated.
The reflector model is a preset model for representing the reflecting effect. When the reflection effect needs to be rendered on the virtual object model, the reflection body model or a part of the area of the reflection body model can be displayed through the transparent area of the virtual object model, so that the effect of the reflection effect on the virtual object model is achieved.
Alternatively, the reflector model and the virtual object model may be two different models. For example, the virtual object model may be a model of a mirror that is static in the virtual environment, while the reflector model is a model for achieving a reflection effect in the virtual object model. The reflector model is not included in the virtual object model, but is displayed through transparent areas.
Of course, there may be some correlation between the reflector model and the virtual object model. For example, parameters such as the size of the reflector model may be related to the size of the transparent region of the virtual object model, and so on.
It will be appreciated that since the reflective effect exhibited by the transparent regions is actually obtained by the appearance of the reflector model, the corresponding smoothness of the transparent regions can also be considered as a setting parameter for the smoothness of the reflector model.
Specifically, the light reflecting area is actually obtained by distinguishing the color of a specific area in the reflector model from the color of other areas in the reflector model in the art, but the light reflecting area can be visually obtained by reflecting, scattering and the like of light by the reflector model.
For example, the reflector model and the light reflecting area may be as shown in fig. 4.
It will be appreciated that the retroreflective effect exhibited by the transparent areas may be determined by both the direction of illumination and the viewing angle of the user, and thus the retroreflective effect will change as the viewing angle of the user changes. For example, to achieve the reflection effect of the glass portion, i.e., the transparent region, as shown in fig. 3, the user's viewing angle, i.e., the direction of line of sight, and the direction of incidence of the light rays may be first obtained to calculate the half-distance vector affecting the reflection effect, and then the smoothness and reflection color of the model surface may be obtained to calculate.
In some alternative embodiments, the step of calculating the at least one reflection area displayed in the reflection color on the preset reflector model based on the smoothness, the reflection color and the incident direction of the light ray may specifically include:
calculating a half-range vector of a preset reflector model based on the light incidence direction and the sight direction of a game player;
acquiring normal line information of the reflector model, and determining a normal line direction vector of the reflector model according to the normal line information;
and calculating at least one reflecting area displayed by the reflecting color on the reflecting body model according to the smoothness, the reflecting color, the half-way vector and the normal direction vector.
The viewing direction may be a preset user viewing direction. In the game making process, a camera can be arranged, wherein the placed direction of the camera is a preset user viewing direction, and according to the placed position and angle of the camera, the game object can be viewed from different directions, and in the actual game process, the viewing direction can be understood to be the direction perpendicular to the screen displaying the game picture.
Optionally, the line-of-sight direction may be obtained by subtracting the coordinates of the reflector model in world space from the coordinates of the camera in the preset virtual scene, and normalizing the subtraction result to obtain the direction in which the camera looks at the model (i.e., the line-of-sight direction of the game player).
Wherein the normal information may indicate the normal direction of the reflector model, the normal direction vector being the vector of the normal direction. In general, the target game model may include a plurality of pixels, each pixel corresponding to a respective normal direction, where the normal direction is a direction perpendicular to a plane in which the pixel is located, and in general, the normal vector may be in the form of a unit vector.
Alternatively, the normal information of the reflector model can be transferred from the model space to the world space, and the conversion result is normalized to obtain the normal direction vector. Specifically, the normalization processing, namely normal, can map the data to be processed within the range of-1 to 1, and the normalization processing can enable calculation to be more convenient and rapid.
For example, in the embodiment of the invention, a Blinn-Phong model can be used to calculate the position of the high light point illuminated on the reflector model, namely the reflecting area, through parameters such as smoothness, reflecting color, light incidence direction and the like.
Alternatively, the line-of-sight direction and the light incident direction are added, and the result obtained by normalizing the added result may be used as a half-way direction, i.e., a half-way Vector (Halfway Vector).
The half-range vector is a unit vector in the half direction of the included angle between the light and the line of sight, and the closer the half-range vector is to the normal vector, the larger the specular light component is.
The smoothness, the reflection color, the half-range vector and the normal direction vector are substituted into a Blinn-Phong model, and a reflection area=reflection color x pow (max (0, dot (half-range direction, normal direction)), smoothness) can be calculated by the Blinn-Phong model.
Where pow (x, y) is the power of x to the y of the mathematical operation x, max (x, y) is the maximum of x and y, and dot (x, y) is the dot product of x and y.
The Blinn-Phong illumination model is proposed by Jim Blinn in 1977 on the basis of the conventional Phong illumination model. It is an empirical model and does not fully conform to the illumination phenomenon in the real world. It divides the light entering the camera into three parts, each part using a method to calculate its contribution, the three parts being Ambient light (Ambient), diffuse and Specular (Specular), respectively.
204. And obtaining a reflective texture map, wherein the reflective texture map comprises reflective effect textures.
The reflective texture map is an image comprising reflective effect textures.
Specifically, the retroreflective texture map may be as shown in fig. 5. The retroreflective effect texture, i.e., the texture that embodies the path of travel of the light rays in the retroreflective effect, may provide, for example, a diagonal pattern as shown in fig. 5 and a gradual change of the light rays from top to bottom.
205. And fusing the light reflecting texture in the light reflecting texture map with the light reflecting area to obtain the treated light reflecting area with the light reflecting texture and the light reflecting color.
Wherein, the treated light reflecting area can comprise a texture which presents a certain light reflecting effect by a light reflecting texture with a light reflecting color. For example, the treated retroreflective regions can be as shown in fig. 6.
In some alternative embodiments, if the reflector model is black, the reflector model may obscure effects behind transparent areas in the virtual object model. Therefore, if the area behind the transparent area in the virtual object model needs to display content, the reflector model may have a certain transparency, for example, the other places except the reflective part are transparent, so before the step of displaying the reflective effect on the transparent area on the virtual object model based on the post-processing reflective area, the method for implementing the reflective effect provided by the embodiment of the present invention may further include:
Determining a transparency adjustment channel from the color channels of the reflector model according to the reflection color;
and adjusting the transparency parameter of the reflector model based on the color component of the reflector model in the transparency adjustment channel to obtain a treated reflective area subjected to transparency treatment.
In particular, the color channel may have R, G, B three channels, and R, G, B three channels may be selected as transparency adjustment channels, all of which store color information.
When the transparency adjustment channel is determined, a certain channel can be taken as the transparency adjustment channel according to the proximity degree of the reflection color and each color channel, and the color value and the transparency can be output. For example, assuming that the highlighting color is gold, the color of the R channel is more clearly defined as being more biased to red in red, green and blue, and then the R channel may be selected as the transparency adjustment channel.
For example, the reflection effect achieved by the virtual object model before the transparency is not adjusted may be as shown in fig. 7, that is, the reflection effect on the reflector model only displayed by the virtual object model; the reflection effect of the virtual object model after the transparency is adjusted can be shown in fig. 8, that is, the image display area in the virtual object model can be displayed.
206. And displaying the reflection effect on the transparent area on the virtual object model based on the processed reflection area.
It is understood that the transparent region may display all or only a portion of the treated retroreflective region, and in some examples, a portion of the retroreflective region may also be modeled as an area outside the treated retroreflective region. The embodiment of the invention does not limit the display range of the treated reflecting area in the reflecting body model by the transparent area.
In some optional embodiments, in order to match the display effect of the virtual object model with the virtual environment, the method for implementing the light reflection effect provided by the embodiment of the present invention may further include:
acquiring environment brightness information of a virtual environment;
generating a brightness adjustment image according to the environment brightness information;
and performing model brightness adjustment on the virtual object model based on the brightness adjustment image to obtain a virtual object model with brightness adjusted.
For example, the model brightness of the virtual object model can be reduced according to the environment brightness information, and the virtual object model is gradually darkened from top to bottom through a positive film overlapping processing method.
Taking a rendering tool as a Blender as an example, the positive film overlay in the Blender can multiply the pixel values of all the pixel points by adopting values (namely color processing parameters) between (0.0 and 1.0), so as to realize the fusion calculation of the pixel values of all the pixel points. This operation does not have to be standardized, and a multiplication of two terms between (0.0 and 1.0) always yields results between (0.0 and 1.0).
Alternatively, the color processing parameters may be represented using a "traditional" triplet, such as RGB (124, 255, 56), where the multiplication results in too high a value, such as RGB (7316, 46410, 1848), which can be normalized (recovered) to a value in the range of (0 to 255) by dividing by 256.
As can be seen from the foregoing, the embodiment of the present invention may obtain a virtual object model to be added with a light reflection effect, where the virtual object model includes a transparent region, obtains a smoothness corresponding to the transparent region, a preset light reflection color, and a light ray incidence direction, calculates, based on the smoothness, the light reflection color, and the light ray incidence direction, at least one light reflection region displayed in the light reflection color on the preset light reflector model, and obtains a light reflection texture map, where the light reflection texture map includes a light reflection effect texture, and fuses the light reflection texture in the light reflection texture map with the light reflection region to obtain a processed light reflection region having the light reflection texture and the light reflection color, and displays the light reflection effect on the transparent region on the virtual object model based on the processed light reflection region. In the embodiment of the invention, after the light reflecting area is obtained, the light texture in the light reflecting effect is realized through the light reflecting effect texture in the light reflecting problem map, and a large amount of physical correlation operation is not needed to be carried out based on a physical principle so as to realize the light emitting effect, so that the real light reflecting effect can be realized with only a small amount of calculation resources, the rendering speed is improved, and the rendering cost is reduced.
The method described in the previous examples is described in further detail below by way of example.
In this embodiment, a description will be given with reference to the system of fig. 1.
As shown in fig. 9, the specific flow of the method for implementing the light reflection effect in this embodiment may be as follows:
901. and obtaining a virtual object model with a reflection effect to be added, wherein the virtual object model comprises a transparent area and an image display area, and the transparent area is overlapped on the image display area.
Taking the virtual object model as a mirror, as shown in fig. 3, the structure of the whole mirror (i.e., the virtual object model) can be divided into three partial areas from back to front, which are respectively a decorative outer frame, a base map capable of showing a mirror looking effect in the mirror, and glass capable of making the surface of the mirror have a light reflecting effect, wherein the glass partial area is a transparent area, and the base map is an image display area.
902. And acquiring the smoothness, the preset reflective color and the light incidence direction corresponding to the transparent area.
903. Based on the smoothness, the reflection color and the light incidence direction, at least one reflection area displayed in the reflection color on a preset reflector model is calculated.
In the embodiment of the invention, a Blinn-Phong model can be used, and the position of a high light spot, namely a light reflection area, illuminated on the model is calculated through parameters set by us.
The normal information of the model is transferred from the model space to the world space, and the normal information is normalized and is marked as the normal direction. Specifically, the normalization processing, namely normal, can map the data to be processed within the range of-1 to 1, so that the calculation can be more convenient and faster.
And subtracting the coordinate of the model in world space from the coordinate of the camera, and carrying out normalization processing to obtain the sight direction of the camera looking at the model.
The normalization process is performed by adding the direction of the line of sight to the direction of illumination, and the normalization process is denoted as the half-way direction, i.e., half-way Vector (Halfway Vector).
The half-range vector is a unit vector in the half direction of the included angle between the light and the line of sight, and the closer the half-range vector is to the normal vector, the larger the specular light component is.
The retroreflective area = retroreflective color x pow (max (0, dot (half way direction, normal direction)), smoothness) was calculated by Blinn-Phong model.
Where pow (x, y) is the power of x to the y of the mathematical operation x, max (x, y) is the maximum of x and y, and dot (x, y) is the dot product of x and y.
904. And obtaining a reflective texture map, wherein the reflective texture map comprises reflective effect textures.
Specifically, the retroreflective texture map may be as shown in fig. 5.
905. And fusing the light reflecting texture in the light reflecting texture map with the light reflecting area to obtain the treated light reflecting area with the light reflecting texture and the light reflecting color.
906. And determining a transparency adjustment channel from the color channels of the reflector model according to the reflective color, and adjusting the transparency parameter of the reflector model based on the color components of the reflector model in the transparency adjustment channel to obtain a treated reflective area of transparent treatment.
If the reflector pattern is black, the reflector pattern will block the effect behind the mirror. It is therefore desirable to have the reflector model exhibit the effect of having a certain transparency, for example, being transparent elsewhere than in the reflective portion.
Specifically, the color value has three channels of RGB, and we take a certain channel as a transparency adjustment channel to output the color value and the transparency.
907. And acquiring a target display image corresponding to the virtual object model, and displaying the target display image in the image display area so that the reflection effect in the transparent area is overlapped and displayed on the target display image.
908. And displaying the reflection effect on the transparent area on the virtual object model based on the processed reflection area.
In order to match the display effect of the virtual object model with the virtual environment, the method for implementing the light reflection effect provided by the embodiment of the invention further may include:
Acquiring environment brightness information of a virtual environment;
generating a brightness adjustment image according to the environment brightness information;
and performing model brightness adjustment on the virtual object model based on the brightness adjustment image to obtain a virtual object model with brightness adjusted.
For example, the brightness of the virtual object model can be reduced, and the virtual object model is gradually darkened from top to bottom through a positive overlay processing method.
As can be seen from the foregoing, the embodiment of the present invention may obtain a virtual object model to be added with a light reflection effect, where the virtual object model includes a transparent region, obtains a smoothness corresponding to the transparent region, a preset light reflection color, and a light ray incidence direction, calculates, based on the smoothness, the light reflection color, and the light ray incidence direction, at least one light reflection region displayed in the light reflection color on the preset light reflector model, and obtains a light reflection texture map, where the light reflection texture map includes a light reflection effect texture, and fuses the light reflection texture in the light reflection texture map with the light reflection region to obtain a processed light reflection region having the light reflection texture and the light reflection color, and displays the light reflection effect on the transparent region on the virtual object model based on the processed light reflection region. In the embodiment of the invention, after the light reflecting area is obtained, the light texture in the light reflecting effect is realized through the light reflecting effect texture in the light reflecting problem map, and a large amount of physical correlation operation is not needed to be carried out based on a physical principle so as to realize the light emitting effect, so that the real light reflecting effect can be realized with only a small amount of calculation resources, the rendering speed is improved, and the rendering cost is reduced.
In order to better implement the method, correspondingly, the embodiment of the invention also provides a device for realizing the light reflecting effect.
Referring to fig. 10, the apparatus includes:
the model obtaining unit 1001 may be configured to obtain a virtual object model to be added with a reflection effect, where the virtual object model may include a transparent area;
the region parameter obtaining unit 1002 may be configured to obtain smoothness, a preset reflective color, and a light incident direction corresponding to the transparent region;
a region calculation unit 1003 operable to calculate at least one reflection region displayed in a reflection color on a preset reflector model based on the smoothness, the reflection color, and the direction of incidence of light;
the map obtaining unit 1004 may be configured to obtain a reflective texture map, where the reflective texture map may include a reflective effect texture;
the texture fusion unit 1005 may be configured to fuse the reflective texture in the reflective texture map with the reflective region to obtain a processed reflective region having a reflective texture and a reflective color;
the reflection effect display unit 1006 may be configured to display a reflection effect on a transparent area on the virtual object model based on the processed reflection area.
In some alternative embodiments, the virtual object model may further include an image display area over which the transparent area is superimposed;
As shown in fig. 11, the light reflection effect implementation apparatus provided by the embodiment of the present invention may further include an image display unit 1007 that may be configured to obtain a target display image corresponding to the virtual object model, and display the target display image in the image display area, so that the light reflection effect in the transparent area is displayed in a superimposed manner on the target display image.
In some alternative embodiments, the reflection effect implementation apparatus provided by the embodiments of the present invention may further include a transparency adjustment unit 1008, which may be configured to determine a transparency adjustment channel from color channels of the reflector model according to the reflection color;
and adjusting the transparency parameter of the reflector model based on the color component of the reflector model in the transparency adjustment channel to obtain a treated reflective area subjected to transparency treatment.
In some alternative embodiments, the image display unit 1007 may be configured to generate a reflected object image based on a target reflected object in the virtual scene that needs to be reflected by the virtual object model;
and generating a target display image corresponding to the virtual object model according to the reflected object image and the preset background image.
In some optional embodiments, the light reflection effect implementation apparatus provided by the embodiments of the present invention may further include an image brightness adjustment unit 1009, which may be configured to obtain a line of sight direction of a game player, and determine a line of sight angle between the line of sight direction and the virtual object model;
Based on the included angle of the line of sight, predicting the reflection brightness of the display image of the display target through the virtual object model;
and adjusting the image brightness of the target display image according to the reflection brightness to obtain the target display image with the brightness adjusted.
In some alternative embodiments, the half-way vector of the predetermined reflector model is calculated based on the direction of incidence of the light and the direction of the line of sight of the player;
acquiring normal line information of the reflector model, and determining a normal line direction vector of the reflector model according to the normal line information;
and calculating at least one reflecting area displayed by the reflecting color on the reflecting body model according to the smoothness, the reflecting color, the half-way vector and the normal direction vector.
In some optional embodiments, the light reflection effect implementation apparatus provided in the embodiments of the present invention may further include a model brightness adjustment unit 1010, which may be configured to obtain environment brightness information of the virtual environment;
generating a brightness adjustment image according to the environment brightness information;
and performing model brightness adjustment on the virtual object model based on the brightness adjustment image to obtain a virtual object model with brightness adjusted.
As can be seen from the above, by the light reflection effect implementation device, a virtual object model to be added with a light reflection effect can be obtained, the virtual object model includes a transparent region, a smoothness corresponding to the transparent region, a preset light reflection color and a light incidence direction are obtained, at least one light reflection region displayed in the light reflection color on the preset light reflection body model is calculated based on the smoothness, the light reflection color and the light incidence direction, a light reflection texture map is obtained, the light reflection texture map includes a light reflection effect texture, the light reflection texture in the light reflection texture map is fused with the light reflection region, a processed light reflection region with the light reflection texture and the light reflection color is obtained, and the light reflection effect is displayed on the transparent region on the virtual object model based on the processed light reflection region; in the embodiment of the invention, after the light reflecting area is obtained, the light texture in the light reflecting effect is realized through the light reflecting effect texture in the light reflecting problem map, and a large amount of physical correlation operation is not needed to be carried out based on a physical principle so as to realize the light emitting effect, so that the real light reflecting effect can be realized with only a small amount of calculation resources, the rendering speed is improved, and the rendering cost is reduced.
In addition, correspondingly, the embodiment of the application also provides computer equipment, and the computer equipment can be a terminal. Fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application, as shown in fig. 12. The computer device 1200 includes a processor 1201 having one or more processing cores, a memory 1202 having one or more computer readable storage media, and a computer program stored on the memory 1202 and executable on the processor. Wherein the processor 1201 is electrically connected to the memory 1202. It will be appreciated by those skilled in the art that the computer device structure shown in the figures is not limiting of the computer device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The processor 1201 is a control center of the computer device 1200, connects various parts of the entire computer device 1200 using various interfaces and lines, and performs various functions and processes of the computer device 1200 by running or loading software programs and/or modules stored in the memory 1202, and calling data stored in the memory 1202, thereby performing overall monitoring of the computer device 1200.
In the embodiment of the present application, the processor 1201 in the computer device 1200 loads the instructions corresponding to the processes of one or more application programs into the memory 1202 according to the following steps, and the processor 1201 executes the application programs stored in the memory 1202, thereby implementing various functions:
obtaining a virtual object model to be added with a reflection effect, wherein the virtual object model can comprise a transparent area;
acquiring the smoothness, preset reflection color and light incidence direction corresponding to the transparent area;
calculating at least one reflection area displayed in a reflection color on a preset reflector model based on the smoothness, the reflection color and the light incidence direction;
obtaining a reflective texture map, wherein the reflective texture map can comprise reflective effect textures;
fusing the reflective texture in the reflective texture map with the reflective region to obtain a treated reflective region with reflective texture and reflective color;
and displaying the reflection effect on the transparent area on the virtual object model based on the processed reflection area.
In some alternative embodiments, the virtual object model may further include an image display area over which the transparent area is superimposed;
The method for realizing the light reflecting effect provided by the embodiment of the invention can further comprise the following steps:
and acquiring a target display image corresponding to the virtual object model, and displaying the target display image in the image display area so that the reflection effect in the transparent area is overlapped and displayed on the target display image.
In some optional embodiments, before the light reflection effect is displayed on the transparent area on the virtual object model based on the processed light reflection area, the light reflection effect implementation method provided by the embodiment of the invention may further include:
determining a transparency adjustment channel from the color channels of the reflector model according to the reflection color;
and adjusting the transparency parameter of the reflector model based on the color component of the reflector model in the transparency adjustment channel to obtain a treated reflective area subjected to transparency treatment.
In some optional embodiments, acquiring the target display image corresponding to the virtual object model may include:
generating a reflected object image based on a target reflected object in the virtual scene, which needs to be reflected by the virtual object model;
and generating a target display image corresponding to the virtual object model according to the reflected object image and the preset background image.
In some optional embodiments, before displaying the target display image in the image display area, the method for implementing the light reflection effect provided by the embodiment of the invention may further include:
acquiring the sight direction of a game player, and determining the sight included angle between the sight direction and the virtual object model;
based on the included angle of the line of sight, predicting the reflection brightness of the display image of the display target through the virtual object model;
and adjusting the image brightness of the target display image according to the reflection brightness to obtain the target display image with the brightness adjusted.
In some alternative embodiments, calculating at least one reflective area displayed in a reflective color on a predetermined reflector model based on the smoothness, the reflective color, and the direction of incidence of light may include:
calculating a half-range vector of a preset reflector model based on the light incidence direction and the sight direction of a game player;
acquiring normal line information of the reflector model, and determining a normal line direction vector of the reflector model according to the normal line information;
and calculating at least one reflecting area displayed by the reflecting color on the reflecting body model according to the smoothness, the reflecting color, the half-way vector and the normal direction vector.
In some optional embodiments, the method for implementing the light reflection effect provided by the embodiment of the present invention may further include:
Acquiring environment brightness information of a virtual environment;
generating a brightness adjustment image according to the environment brightness information;
and performing model brightness adjustment on the virtual object model based on the brightness adjustment image to obtain a virtual object model with brightness adjusted.
According to the scheme, a virtual object model with a light reflecting effect to be added can be obtained, the virtual object model comprises a transparent area, smoothness corresponding to the transparent area, preset light reflecting color and light ray incidence direction are obtained, at least one light reflecting area displayed in the light reflecting color on the preset light reflecting body model is calculated based on the smoothness, the light reflecting color and the light ray incidence direction, a light reflecting texture map is obtained, the light reflecting texture map comprises light reflecting effect textures, the light reflecting textures in the light reflecting texture map are fused with the light reflecting area, a processed light reflecting area with the light reflecting textures and the light reflecting color is obtained, and the light reflecting effect is displayed on the transparent area of the virtual object model based on the processed light reflecting area; in the embodiment of the invention, after the light reflecting area is obtained, the light texture in the light reflecting effect is realized through the light reflecting effect texture in the light reflecting problem map, and a large amount of physical correlation operation is not needed to be carried out based on a physical principle so as to realize the light emitting effect, so that the real light reflecting effect can be realized with only a small amount of calculation resources, the rendering speed is improved, and the rendering cost is reduced.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Optionally, as shown in fig. 12, the computer device 1200 further includes: a touch display 1203, a radio frequency circuit 1204, an audio circuit 1205, an input unit 1206, and a power supply 1207. The processor 1201 is electrically connected to the touch display 1203, the rf circuit 1204, the audio circuit 1205, the input unit 1206, and the power supply 1207, respectively. Those skilled in the art will appreciate that the computer device structure shown in FIG. 12 is not limiting of the computer device and may include more or fewer components than shown, or may be combined with certain components, or a different arrangement of components.
The touch display 1203 may be configured to display a graphical user interface and receive an operation instruction generated by a user acting on the graphical user interface. The touch display 1203 may include a display panel and a touch panel. Wherein the display panel may be used to display information entered by a user or provided to a user as well as various graphical user interfaces of a computer device, which may be composed of graphics, text, icons, video, and any combination thereof. Alternatively, the display panel may be configured in the form of a liquid crystal display (LCD, liquid Crystal Display), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations on or near the user (such as operations on or near the touch panel by the user using any suitable object or accessory such as a finger, stylus, etc.), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends the touch point coordinates to the processor 1201, and can receive and execute commands sent from the processor 1201. The touch panel may overlay the display panel, and upon detection of a touch operation thereon or thereabout, the touch panel is passed to the processor 1201 to determine the type of touch event, and the processor 1201 then provides a corresponding visual output on the display panel in accordance with the type of touch event. In the embodiment of the application, the touch panel and the display panel may be integrated into the touch display screen 1203 to implement the input and output functions. In some embodiments, however, the touch panel and the touch panel may be implemented as two separate components to perform the input and output functions. I.e. the touch sensitive display 1203 may also implement an input function as part of the input unit 1206.
The rf circuitry 1204 may be configured to receive and transmit rf signals to and from a network device or other computer device via wireless communication to establish wireless communication with the network device or other computer device.
The input unit 1206 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), as well as to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 1207 is used to power the various components of the computer device 1200. Alternatively, the power supply 1207 may be logically connected to the processor 1201 through a power management system, so as to perform functions of managing charging, discharging, and power consumption management through the power management system. The power supply 1207 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown in fig. 12, the computer device 1200 may also include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., and will not be described in detail herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
As can be seen from the foregoing, the computer device provided in this embodiment may obtain a virtual object model with a light reflection effect to be added, where the virtual object model includes a transparent region, obtains a smoothness corresponding to the transparent region, a preset light reflection color, and a light incidence direction, calculates, based on the smoothness, the light reflection color, and the light incidence direction, at least one light reflection region displayed in the light reflection color on the preset light reflector model, and obtains a light reflection texture map, where the light reflection texture map includes a light reflection effect texture, fuses the light reflection texture in the light reflection texture map with the light reflection region, and obtains a processed light reflection region with the light reflection texture and the light reflection color, and displays the light reflection effect on the transparent region on the virtual object model based on the processed light reflection region. In the embodiment of the invention, after the light reflecting area is obtained, the light texture in the light reflecting effect is realized through the light reflecting effect texture in the light reflecting problem map, and a large amount of physical correlation operation is not needed to be carried out based on a physical principle so as to realize the light emitting effect, so that the real light reflecting effect can be realized with only a small amount of calculation resources, the rendering speed is improved, and the rendering cost is reduced.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer readable storage medium having stored therein a plurality of computer programs that can be loaded by a processor to perform the steps in any of the light reflection effect implementation methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
obtaining a virtual object model to be added with a reflection effect, wherein the virtual object model can comprise a transparent area;
acquiring the smoothness, preset reflection color and light incidence direction corresponding to the transparent area;
calculating at least one reflection area displayed in a reflection color on a preset reflector model based on the smoothness, the reflection color and the light incidence direction;
obtaining a reflective texture map, wherein the reflective texture map can comprise reflective effect textures;
fusing the reflective texture in the reflective texture map with the reflective region to obtain a treated reflective region with reflective texture and reflective color;
And displaying the reflection effect on the transparent area on the virtual object model based on the processed reflection area.
In some alternative embodiments, the virtual object model may further include an image display area over which the transparent area is superimposed;
the method for realizing the light reflecting effect provided by the embodiment of the invention can further comprise the following steps:
and acquiring a target display image corresponding to the virtual object model, and displaying the target display image in the image display area so that the reflection effect in the transparent area is overlapped and displayed on the target display image.
In some optional embodiments, before the light reflection effect is displayed on the transparent area on the virtual object model based on the processed light reflection area, the light reflection effect implementation method provided by the embodiment of the invention may further include:
determining a transparency adjustment channel from the color channels of the reflector model according to the reflection color;
and adjusting the transparency parameter of the reflector model based on the color component of the reflector model in the transparency adjustment channel to obtain a treated reflective area subjected to transparency treatment.
In some optional embodiments, acquiring the target display image corresponding to the virtual object model may include:
Generating a reflected object image based on a target reflected object in the virtual scene, which needs to be reflected by the virtual object model;
and generating a target display image corresponding to the virtual object model according to the reflected object image and the preset background image.
In some optional embodiments, before displaying the target display image in the image display area, the method for implementing the light reflection effect provided by the embodiment of the invention may further include:
acquiring the sight direction of a game player, and determining the sight included angle between the sight direction and the virtual object model;
based on the included angle of the line of sight, predicting the reflection brightness of the display image of the display target through the virtual object model;
and adjusting the image brightness of the target display image according to the reflection brightness to obtain the target display image with the brightness adjusted.
In some alternative embodiments, calculating at least one reflective area displayed in a reflective color on a predetermined reflector model based on the smoothness, the reflective color, and the direction of incidence of light may include:
calculating a half-range vector of a preset reflector model based on the light incidence direction and the sight direction of a game player;
acquiring normal line information of the reflector model, and determining a normal line direction vector of the reflector model according to the normal line information;
And calculating at least one reflecting area displayed by the reflecting color on the reflecting body model according to the smoothness, the reflecting color, the half-way vector and the normal direction vector.
In some optional embodiments, the method for implementing the light reflection effect provided by the embodiment of the present invention may further include:
acquiring environment brightness information of a virtual environment;
generating a brightness adjustment image according to the environment brightness information;
and performing model brightness adjustment on the virtual object model based on the brightness adjustment image to obtain a virtual object model with brightness adjusted.
According to the scheme, a virtual object model with a light reflecting effect to be added can be obtained, the virtual object model comprises a transparent area, smoothness corresponding to the transparent area, preset light reflecting color and light ray incidence direction are obtained, at least one light reflecting area displayed in the light reflecting color on the preset light reflecting body model is calculated based on the smoothness, the light reflecting color and the light ray incidence direction, a light reflecting texture map is obtained, the light reflecting texture map comprises light reflecting effect textures, the light reflecting textures in the light reflecting texture map are fused with the light reflecting area, a processed light reflecting area with the light reflecting textures and the light reflecting color is obtained, and the light reflecting effect is displayed on the transparent area of the virtual object model based on the processed light reflecting area; in the embodiment of the invention, after the light reflecting area is obtained, the light texture in the light reflecting effect is realized through the light reflecting effect texture in the light reflecting problem map, and a large amount of physical correlation operation is not needed to be carried out based on a physical principle so as to realize the light emitting effect, so that the real light reflecting effect can be realized with only a small amount of calculation resources, the rendering speed is improved, and the rendering cost is reduced.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The steps in any one of the light reflection effect implementation methods provided in the embodiments of the present application may be executed by the computer program stored in the storage medium, so that the beneficial effects that any one of the light reflection effect implementation methods provided in the embodiments of the present application may be implemented, which are described in detail in the previous embodiments and are not repeated herein.
The foregoing describes in detail a method, an apparatus, a storage medium, and a computer device for implementing a light reflection effect provided in the embodiments of the present application, and specific examples are applied to illustrate principles and implementations of the present application, where the foregoing description of the embodiments is only for helping to understand the method and core ideas of the present application; meanwhile, those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, and the present description should not be construed as limiting the present application in view of the above.
Claims (11)
1. The method for realizing the light reflecting effect is characterized by comprising the following steps of:
obtaining a virtual object model with a reflection effect to be added, wherein the virtual object model comprises a transparent area;
acquiring the smoothness, the preset reflective color and the light incidence direction corresponding to the transparent area;
calculating at least one reflection area displayed in the reflection color on a preset reflector model based on the smoothness, the reflection color and the light incidence direction;
obtaining a reflective texture map, wherein the reflective texture map comprises reflective effect textures;
fusing the light reflecting texture in the light reflecting texture map with the light reflecting area to obtain a treated light reflecting area with the light reflecting texture and the light reflecting color;
and displaying the reflecting effect on the transparent area on the virtual object model based on the processed reflecting area.
2. The method of claim 1, wherein the virtual object model further comprises an image display area, the transparent area being superimposed over the image display area;
the method further comprises the steps of:
and acquiring a target display image corresponding to the virtual object model, and displaying the target display image in the image display area so that the reflection effect in the transparent area is overlapped and displayed on the target display image.
3. The method of claim 2, wherein the method further comprises, based on the post-processing retroreflective regions, before the retroreflective effects are displayed by the transparent regions on the virtual object model:
determining a transparency adjustment channel from the color channels of the reflector model according to the reflection color;
and adjusting the transparency parameter of the reflector model based on the color component of the reflector model in the transparency adjustment channel to obtain a treated reflective area subjected to transparency treatment.
4. The method for realizing the light reflection effect according to claim 2, wherein the obtaining the target display image corresponding to the virtual object model includes:
generating a reflected object image based on a target reflected object in the virtual scene, which needs to be reflected by the virtual object model;
and generating a target display image corresponding to the virtual object model according to the reflection object image and a preset background image.
5. The method according to any one of claims 2 to 4, wherein before the target display image is displayed in the image display area, the method further comprises:
Acquiring a sight line direction of a game player, and determining a sight line included angle between the sight line direction and the virtual object model;
based on the included angle of the sight line, predicting the reflection brightness of the target display image displayed by the virtual object model;
and adjusting the image brightness of the target display image according to the reflection brightness to obtain the target display image with the adjusted brightness.
6. The method for realizing a light reflecting effect according to claim 1, wherein calculating at least one light reflecting area displayed in the light reflecting color on a preset reflector model based on the smoothness, the light reflecting color and the light incident direction comprises:
calculating a half-range vector of a preset reflector model based on the light incidence direction and the sight direction of the game player;
acquiring normal information of the reflector model, and determining a normal direction vector of the reflector model according to the normal information;
and calculating at least one reflection area displayed by the reflection color on the reflector model according to the smoothness, the reflection color, the half-range vector and the normal direction vector.
7. The method of any one of claims 1-6, further comprising:
Acquiring environment brightness information of a virtual environment;
generating a brightness adjustment image according to the environment brightness information;
and based on the brightness adjustment image, performing model brightness adjustment on the virtual object model to obtain a virtual object model with brightness adjusted.
8. The device for realizing the light reflecting effect is characterized by comprising:
the system comprises a model acquisition unit, a reflection effect adding unit and a reflection effect adding unit, wherein the model acquisition unit is used for acquiring a virtual object model to be added with the reflection effect, and the virtual object model comprises a transparent area;
the regional parameter acquisition unit is used for acquiring the smoothness, the preset reflective color and the light incidence direction corresponding to the transparent region;
a region calculating unit for calculating at least one reflection region displayed in the reflection color on a preset reflector model based on the smoothness, the reflection color and the light incident direction;
the map obtaining unit is used for obtaining a reflective texture map, wherein the reflective texture map comprises reflective effect textures;
the texture fusion unit is used for fusing the reflective texture in the reflective texture mapping with the reflective area to obtain a processed reflective area with the reflective texture and the reflective color;
And the reflection effect display unit is used for displaying the reflection effect on the transparent area on the virtual object model based on the processed reflection area.
9. A computer device comprising a memory and a processor; the memory stores an application program, and the processor is configured to run the application program in the memory to perform the steps in the light reflection effect implementation method as claimed in any one of claims 1 to 7.
10. A computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps in the light reflection effect realization method of any one of claims 1 to 7.
11. A computer program product comprising computer programs or instructions which, when executed by a processor, implement the steps of the retroreflective effect-implementing method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211655505.2A CN116310020A (en) | 2022-12-21 | 2022-12-21 | Method and device for realizing light reflection effect, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211655505.2A CN116310020A (en) | 2022-12-21 | 2022-12-21 | Method and device for realizing light reflection effect, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116310020A true CN116310020A (en) | 2023-06-23 |
Family
ID=86824689
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211655505.2A Pending CN116310020A (en) | 2022-12-21 | 2022-12-21 | Method and device for realizing light reflection effect, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116310020A (en) |
-
2022
- 2022-12-21 CN CN202211655505.2A patent/CN116310020A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US12056813B2 (en) | Shadow rendering method and apparatus, computer device, and storage medium | |
WO2021208648A1 (en) | Virtual object adjusting method and apparatus, storage medium and augmented reality device | |
US11393154B2 (en) | Hair rendering method, device, electronic apparatus, and storage medium | |
CN108525298B (en) | Image processing method, image processing device, storage medium and electronic equipment | |
CN109427083B (en) | Method, device, terminal and storage medium for displaying three-dimensional virtual image | |
CN111701238A (en) | Virtual picture volume display method, device, equipment and storage medium | |
CN113052947B (en) | Rendering method, rendering device, electronic equipment and storage medium | |
US11776197B2 (en) | Method and apparatus for displaying personalized face of three-dimensional character, device, and storage medium | |
CN112870707A (en) | Virtual object display method in virtual scene, computer device and storage medium | |
CN112287852B (en) | Face image processing method, face image display method, face image processing device and face image display equipment | |
CN112884873B (en) | Method, device, equipment and medium for rendering virtual object in virtual environment | |
CN111308707B (en) | Picture display adjusting method and device, storage medium and augmented reality display equipment | |
WO2018209710A1 (en) | Image processing method and apparatus | |
CN112907716B (en) | Cloud rendering method, device, equipment and storage medium in virtual environment | |
CN113487662B (en) | Picture display method and device, electronic equipment and storage medium | |
CN113552942A (en) | Method and equipment for displaying virtual object based on illumination intensity | |
CN116402931A (en) | Volume rendering method, apparatus, computer device, and computer-readable storage medium | |
CN113194329B (en) | Live interaction method, device, terminal and storage medium | |
CN114155336B (en) | Virtual object display method, device, electronic device and storage medium | |
CN117582661A (en) | Virtual model rendering method, device, medium and equipment | |
US20250069326A1 (en) | Method and apparatus for rendering image, and electronic device | |
CN118115652A (en) | Fog effect rendering method, fog effect rendering device, electronic equipment and computer readable storage medium | |
CN117065330A (en) | Fluid special effect processing method, device, computer equipment and storage medium | |
CN116310020A (en) | Method and device for realizing light reflection effect, computer equipment and storage medium | |
CN110807826B (en) | Map display method, device, equipment and storage medium in virtual scene |
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 |