CN113706683B - Shadow processing method and device for virtual three-dimensional model and electronic device - Google Patents

Shadow processing method and device for virtual three-dimensional model and electronic device Download PDF

Info

Publication number
CN113706683B
CN113706683B CN202110904390.5A CN202110904390A CN113706683B CN 113706683 B CN113706683 B CN 113706683B CN 202110904390 A CN202110904390 A CN 202110904390A CN 113706683 B CN113706683 B CN 113706683B
Authority
CN
China
Prior art keywords
virtual
dimensional model
shadow
texture
casting
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
CN202110904390.5A
Other languages
Chinese (zh)
Other versions
CN113706683A (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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110904390.5A priority Critical patent/CN113706683B/en
Publication of CN113706683A publication Critical patent/CN113706683A/en
Application granted granted Critical
Publication of CN113706683B publication Critical patent/CN113706683B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/60Shadow generation
    • 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/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features 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/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images
    • A63F2300/6646Methods for processing data by generating or executing the game program for rendering three dimensional images for the computation and display of the shadow of an object or character

Abstract

The application discloses a shadow processing method, a shadow processing device and an electronic device for a virtual three-dimensional model. Wherein the method comprises the following steps: obtaining a shadow casting texture, wherein the shadow casting texture is a casting shadow generated by irradiating a first virtual three-dimensional model in a target area by using a virtual light source in a game scene; setting the shadow casting texture as casting shadow generated by a second virtual three-dimensional model under the irradiation of a virtual light source in the target area, wherein the second virtual three-dimensional model has the same modeling as the first virtual three-dimensional model, and the number of patches of the second virtual three-dimensional model is lower than that of the first virtual three-dimensional model. The application solves the technical problems of lower number of plant models and lower shadow precision in the related technology.

Description

Shadow processing method and device for virtual three-dimensional model and electronic device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a shadow processing method, a shadow processing device, and an electronic device for a virtual three-dimensional model.
Background
In a game scene, a 'stereoscopic impression' of an object is realized by adding shadows to the object under illumination, so that better visual experience is provided for players. In the related art, shadows are generated by shielding the engine light through the plant model, the models can be rich in shielding the light in the plant model with higher surface number, and the shadow precision is higher, however, in the plant model with lower surface number, the models are simpler in shielding the light, the shadow precision is poorer, and then the stereoscopic impression of the low-surface plant model is poorer.
Aiming at the problem of lower shadow precision of the plant model with lower surface number in the related technology, no effective solution is proposed at present.
Disclosure of Invention
The embodiment of the application provides a shadow processing method, a shadow processing device and an electronic device for a virtual three-dimensional model, which at least solve the technical problem of lower shadow precision of a plant model with lower surface number in the related technology.
According to an aspect of an embodiment of the present application, there is provided a shadow processing method of a virtual three-dimensional model, including: obtaining a shadow casting texture, wherein the shadow casting texture is a casting shadow generated by irradiating a first virtual three-dimensional model in a target area by using a virtual light source in a game scene; setting the shadow casting texture as casting shadow generated by a second virtual three-dimensional model under the irradiation of a virtual light source in the target area, wherein the second virtual three-dimensional model has the same modeling as the first virtual three-dimensional model, and the number of patches of the second virtual three-dimensional model is lower than that of the first virtual three-dimensional model.
Further, obtaining the shadow cast texture includes: acquiring a first virtual three-dimensional model corresponding to the second virtual three-dimensional model; setting the first virtual three-dimensional model and the second virtual three-dimensional model at a target position in a target area; and controlling the virtual light source to irradiate the target position from a preset direction to obtain the shadow casting texture.
Further, controlling the virtual light source to irradiate the target position from a preset direction, and obtaining the shadow casting texture comprises the following steps: controlling a virtual light source to irradiate a target position from a preset direction, and determining a part of patches for receiving the cast shadow in the first virtual three-dimensional model; and performing rendering-to-texture operation on part of the patches to obtain shadow casting textures.
Further, disposing the first virtual three-dimensional model and the second virtual three-dimensional model at a target location within the target region includes: the first virtual three-dimensional model and the second virtual three-dimensional model are disposed at the same position within the target area.
Further, the shadow processing method of the virtual three-dimensional model further comprises the following steps: and adjusting the object attribute of the first virtual three-dimensional model to enable the first virtual three-dimensional model to be in an invisible state in the visual field range of the virtual camera in the game scene.
Further, the shadow processing method of the virtual three-dimensional model further comprises the following steps: object properties of the second virtual three-dimensional model are adjusted to cancel the drop shadows generated by the second virtual three-dimensional model under the virtual light source illumination.
Further, the shadow cast texture is obtained using the first game engine and multiplexed to the second game engine.
According to another aspect of the embodiment of the present application, there is also provided a shadow processing apparatus for a virtual three-dimensional model, including: the system comprises an acquisition module, a control module and a display module, wherein the acquisition module is used for acquiring a shadow casting texture, wherein the shadow casting texture is a casting shadow generated by utilizing a virtual light source in a game scene to irradiate a first virtual three-dimensional model in a target area; the processing module is used for setting the shadow casting texture as casting shadows generated by a second virtual three-dimensional model under the irradiation of the virtual light source in the target area, wherein the second virtual three-dimensional model is identical to the first virtual three-dimensional model in modeling, and the number of patches of the second virtual three-dimensional model is lower than that of the first virtual three-dimensional model.
According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium having stored therein a computer program, wherein the computer program is configured to execute the shadow processing method of the virtual three-dimensional model in any one of the above-mentioned items when running.
According to another aspect of the embodiments of the present application, there is also provided an electronic device including a memory in which a computer program is stored, and a processor configured to run the computer program to perform the shadow processing method of the virtual three-dimensional model in any one of the above.
In the embodiment of the application, the shadow casting texture is obtained, wherein the shadow casting texture is a casting shadow generated by utilizing a virtual light source in a game scene to irradiate a first virtual three-dimensional model in a target area, the shadow casting texture is set as a casting shadow generated by a second virtual three-dimensional model in the target area under the irradiation of the virtual light source, the first virtual three-dimensional model with high surface number is independently manufactured to correspond to the shadow casting texture and used for setting a second virtual three-dimensional model with low surface number, the visual effect of showing that the second virtual three-dimensional model with low surface number has high-precision shadow in the game scene is realized, the third dimension of the second virtual three-dimensional model with low surface number is enhanced, the visual experience of the game scene is further improved, and the technical problems of lower surface number and lower shadow precision in the related technology are further solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1a is a schematic diagram of a shadow processing method according to the related art;
FIG. 1b is a schematic diagram of a shadow processing method according to the related art;
FIG. 2 is a flow chart of a method of shadow processing of a virtual three-dimensional model according to an embodiment of the application;
FIG. 3 is a schematic illustration of a drop shadow of a second virtual three-dimensional model in accordance with an embodiment of the application;
FIG. 4 is a schematic diagram of a shadow casting texture of a low aspect number plant model according to an embodiment of the application;
FIG. 5 is a schematic illustration of a shadow casting texture of a high aspect number plant model according to an embodiment of the application;
FIG. 6 is a schematic diagram of a rendered shadow cast texture according to an embodiment of the application;
FIG. 7 is a schematic diagram of a rendered shadow cast texture according to an embodiment of the application;
FIG. 8 is a schematic illustration of adjusting object properties of a first virtual three-dimensional model according to an embodiment of the application;
FIG. 9 is a schematic diagram of adjusting object properties of a second virtual three-dimensional model according to an embodiment of the application;
FIG. 10 is a schematic diagram of a shadow casting texture displayed in a game engine according to an embodiment of the application;
fig. 11 is a schematic diagram of a shadow processing apparatus of a virtual three-dimensional model according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise 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 embodiment of the present application, there is provided an embodiment of a shadow processing method of a virtual three-dimensional model, it being noted that the steps shown in the flowcharts of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that herein.
A shadow processing method of a virtual three-dimensional model in one embodiment of the present disclosure may be run on a terminal device or a server. The terminal device may be a local terminal device. When the shadow processing method of the virtual three-dimensional model runs on a server, the method can be realized and executed based on a cloud interaction system, wherein the cloud interaction system comprises the server and client equipment.
In an alternative embodiment, the terminal device may be a local terminal device. Taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used for interacting with the player through the graphical user interface, namely, conventionally downloading and installing the game program through the electronic device and running. The manner in which the local terminal device provides the graphical user interface to the player may include a variety of ways, for example, it may be rendered for display on a display screen of the terminal, or provided to the player by holographic projection. For example, the local terminal device may include a display screen for presenting a graphical user interface including game visuals, and a processor for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.
In the related art, shadows can be generated by a Shadow mapping (Shadow mapping) method, i.e., from the light source position, all objects that can be seen are in the light, and things behind those objects will be in the shadows. Another method of generating shadows is the Ray tracing (Ray tracing) method, which is based on a special rendering algorithm in three-dimensional computer graphics, tracks light emitted from the eye instead of an external light source, has more accurate simulation effect on reflection and refraction, has high efficiency, and can achieve higher quality effect. FIG. 1a is a schematic diagram of a Shadow processing method according to the related art, as shown in FIG. 1a, a scene is rendered by using the light of an engine, the surface depth of an object 12 that can be seen is saved, a Shadow Map 11 (i.e. Shadow Map) is obtained, each point in a normal scene is compared with the Shadow Map 11, and whether each point in the scene can be seen by light is determined, so that the rendering of the normal scene is performed, the point P in FIG. 1a is the point where the Shadow of the object 12 is located, and the depth Z where the point P is located B Greater than the corresponding depth Z on shadow map 11 A . FIG. 1b is a schematic diagram of a shadow processing method according to the related art, as shown in FIG. 1b, when the P point is not a point where the object 12 is shadow, the depth Z where the P point is located B Equal to the corresponding depth Z on the shadow map 11 A And comparing the depth of each point in the scene with the shadow map 11 to determine the shadow point in the scene. The method can be applied to the manufacture of game scenes, such as the manufacture of plant shadows and the enhancement of the stereoscopic impression of plants, however, the shadows in the game scenes are determined according to the shielding of lamplight, and the method is characterized in thatIn the plant model with higher surface number, the model can be richer in shielding generated by lamplight, the shadow precision can be higher, and for the plant model with lower surface number, the shielding of lamplight is simpler, the shadow precision is worse, and then the stereoscopic effect of a scene is worse.
In view of the above problems, according to an embodiment of the present application, there is provided a shadow processing method of a virtual three-dimensional model, and fig. 2 is a flowchart of a shadow processing method of a virtual three-dimensional model according to an embodiment of the present application, as shown in fig. 2, the method including the steps of:
in step S202, a shadow cast texture is obtained, where the shadow cast texture is a cast shadow generated by illuminating a first virtual three-dimensional model within a target area with a virtual light source in a game scene.
The target area is an area needing shadow making in the game scene, one or more first virtual three-dimensional models can be included in the target area, and a plurality of corresponding shadow casting textures can be made corresponding to the plurality of first virtual three-dimensional models. For example, the first virtual three-dimensional model may be a plant three-dimensional model, the target area of the game scene is an area (for example, a forest area) containing a plurality of plants, different plants correspond to different first virtual three-dimensional models so as to represent plants with different forms in the game scene, and after the target area is irradiated by a virtual light source in the game scene, a plurality of shadow casting textures corresponding to the different plant three-dimensional models can be obtained.
The shadow casting texture can be manufactured by a preset game engine according to the first virtual three-dimensional model, for example, the preset game engine can be 3DSMAX software, the first virtual three-dimensional model can be irradiated by a virtual light source in the 3DSMAX software, and casting shadows are generated according to the shielding of the first virtual three-dimensional model on the illumination of the virtual light source.
In step S204, the shadow casting texture is set as a casting shadow generated by a second virtual three-dimensional model under the irradiation of the virtual light source in the target area, where the second virtual three-dimensional model is identical to the first virtual three-dimensional model in shape, and the number of patches of the second virtual three-dimensional model is lower than the number of patches of the first virtual three-dimensional model.
Since the number of patches of the second virtual three-dimensional model is lower than that of the first virtual three-dimensional model, the first virtual three-dimensional model can be considered as a low-surface-number virtual three-dimensional model, and the second virtual three-dimensional model is a high-surface-number virtual three-dimensional model. Because the high-surface-number virtual three-dimensional model has rich shielding generated by the irradiation of the virtual light source, the precision of the cast shadow obtained based on the irradiation of the virtual light source is high, and the obtained shadow cast texture of the high-surface-number virtual three-dimensional model is used in a game scene with the low-surface-number virtual three-dimensional model, the shadow precision of the low-surface-number virtual three-dimensional model can be improved, and the stereoscopic impression of the low-surface-number virtual three-dimensional model is improved.
The same modeling may be the same appearance structure of the second virtual three-dimensional model and the first virtual three-dimensional model, for example, the second virtual three-dimensional model is a low-surface-number plant model in a game scene, the first virtual three-dimensional model may be a high-surface-number plant model, the low-surface-number plant model and the high-surface-number plant model are the same in modeling, and may include that the two are the same in branch contour, the same in number of branches and leaves, the same in extending direction of the branches and leaves, and the like, so that the appearance presented by the low-surface-number plant model and the high-surface-number plant model is the same.
In an alternative embodiment, fig. 3 is a schematic diagram of a shadow cast by a second virtual three-dimensional model according to an embodiment of the present application, where, as shown in fig. 3, the second virtual three-dimensional model may be a low-surface-number plant model in a game scene, the first virtual three-dimensional model may be a high-surface-number plant model in the game scene, and in the 3d max software interface, a virtual light source 31 may be disposed at an upper right corner in fig. 3, where the virtual light source emits parallel light to illuminate a target area 32, and the target area 32 includes a plurality of low-surface-number plant models 33, and the shadow cast texture is obtained by illuminating the shadow cast on the ground of the target area 32. FIG. 4 is a schematic diagram of a shadow cast texture of a low aspect number plant model according to an embodiment of the present application, wherein the shadow cast texture 41 of the low aspect number plant model is thinner and has a poorer stereoscopic impression as shown in FIG. 4. In the 3DSMAX software interface, a virtual light source is used to irradiate the high-surface-number plant model to obtain a cast shadow, and fig. 5 is a schematic diagram of a shadow cast texture of the high-surface-number plant model, as shown in fig. 5, the high-surface-number plant model is rich in shielding light beams, a high-precision shadow cast texture 51 can be generated, the high-precision shadow cast texture 51 replaces the shadow cast texture 41 of the low-surface-number plant model in fig. 4, the low-surface-number plant model can have the shadow cast texture with higher precision, and the stereoscopic impression of the low-surface-number plant model is improved.
In this embodiment, a shadow casting texture is obtained, where the shadow casting texture is set as a casting shadow generated by irradiating a first virtual three-dimensional model in a target area with a virtual light source in a game scene, and the shadow casting texture is made to correspond to the shadow casting texture by separately making a first virtual three-dimensional model with a high number of patches and is used for setting a second virtual three-dimensional model with a low number of patches, so that a visual effect that the second virtual three-dimensional model with the low number of patches has high-precision shadows in the game scene is achieved, a third dimension of the second virtual three-dimensional model with the low number of patches is enhanced, a visual experience of the game scene is further improved, and a technical problem that a plant model with a lower number of patches and a lower shadow precision in related technologies is solved.
In an alternative embodiment, obtaining the shadow cast texture includes: acquiring a first virtual three-dimensional model corresponding to the second virtual three-dimensional model; setting the first virtual three-dimensional model and the second virtual three-dimensional model at a target position in a target area; and controlling the virtual light source to irradiate the target position from a preset direction to obtain the shadow casting texture.
The first virtual three-dimensional model has the same structure as the second virtual three-dimensional model, and the number of the patches is more. It should be noted that, a plurality of second virtual three-dimensional models may be set in the target area, different second virtual three-dimensional models may have different shapes, the obtained first virtual three-dimensional models correspond to the original second virtual three-dimensional models one by one, and the obtained first virtual three-dimensional models are placed on the original positions (i.e. the target positions) of the second virtual three-dimensional models.
The first virtual three-dimensional model and the second virtual three-dimensional model can be placed on the target position at the same time, or the second virtual three-dimensional model can be placed first, then the first virtual three-dimensional model is placed, and the placing sequence of the first virtual three-dimensional model and the second virtual three-dimensional model is unlimited.
In an alternative embodiment, positioning the first virtual three-dimensional model and the second virtual three-dimensional model at a target location within the target area includes: the first virtual three-dimensional model and the second virtual three-dimensional model are disposed at the same position within the target area.
The first virtual three-dimensional model and the second virtual three-dimensional model are placed at the same position, the same virtual light source is used for irradiation, so that the shadow casting texture of the first virtual three-dimensional model can be obtained, namely, the shadow with higher precision is obtained.
For example, the second virtual three-dimensional model may be a low-surface-number plant model in a game scene, the first virtual three-dimensional model may be a high-surface-number plant model in a game scene, as shown in fig. 3, in the 3d sm ax software interface, the plurality of low-surface-number plant models 33 in the target area represent plants with different shapes, the obtained high-surface-number plant model corresponds to the original plurality of low-surface-number plant models 33 one by one, the high-surface-number plant models with the same shape are placed on the original positions of the plurality of low-surface-number plant models 33, the same virtual light source 31 is used for irradiation, and a shadow of the high-surface-number plant model may be obtained.
In an alternative embodiment, a first virtual three-dimensional model with a high number of patches may be first created, and a second virtual three-dimensional model with a low number of patches may be obtained by topology subtracting, etc., where the second virtual three-dimensional model is only a reduced number of patches, but has the same shape as the first virtual three-dimensional model. It should be noted that, because many engines and game environments have limitations on the number of the patches of the virtual three-dimensional model, especially the number of patches displayed on the same screen is strictly limited, the virtual model with rich modeling often has a huge number of patches, cannot be directly used in the game, needs to reduce the number of patches for use, and ensures the performance of the game.
As an alternative embodiment, controlling the virtual light source to illuminate the target location from a predetermined direction, the obtaining the shadow casting texture comprises: controlling a virtual light source to irradiate a target position from a preset direction, and determining a part of patches for receiving the cast shadow in the first virtual three-dimensional model; and performing rendering-to-texture operation on part of the patches to obtain shadow casting textures.
The first virtual three-dimensional model is a virtual three-dimensional model with a higher number of patches, and due to the higher number of patches, the shielding degree of the virtual light source irradiation is richer, a part of patches in the first virtual three-dimensional model can receive projection, a rendering-to-texture operation is performed on a part of patches receiving the projection shadow, and the shadow projection texture is extracted.
Fig. 6 is a schematic diagram of rendering a shadow cast texture according to an embodiment of the present application, where, as shown in fig. 6, the first virtual three-dimensional model may be a high-surface-number plant model, and in the interface of the 3d max software, a portion of the patches that receive the cast shadow may be selected, rendering is performed to the texture, and baking extraction of the shadow cast texture of the first virtual three-dimensional model may be implemented by adding the element CompleteMap (i.e., complete mapping). FIG. 7 is a schematic diagram of a shadow cast texture rendering according to an embodiment of the application, as shown in FIG. 7, the shadow cast texture of a baked extracted high aspect ratio plant model is richer in shape than the shadow of a low aspect ratio plant model, and can be used to set the shadow of the low aspect ratio plant model.
As an alternative embodiment, the shadow processing method of the virtual three-dimensional model further includes: and adjusting the object attribute of the first virtual three-dimensional model to enable the first virtual three-dimensional model to be in an invisible state in the visual field range of the virtual camera in the game scene.
The virtual camera is used for determining the manufacturing view angle of the virtual three-dimensional model, namely the view angle of the virtual camera is the same as the view angle seen by a user in a game scene. When the mapping shadow of the second virtual three-dimensional model is produced, only the shadow casting texture of the first virtual three-dimensional model is needed to be extracted, the first virtual three-dimensional model is not needed to be seen in the game scene, and the object attribute of the first virtual three-dimensional model is adjusted so that the first virtual three-dimensional model is invisible to the virtual camera.
For example, the second virtual three-dimensional model may be a low-surface-number plant model in a game scene, the first virtual three-dimensional model may be a high-surface-number plant model in a game scene, as shown in fig. 3, in the 3d sm software interface, the multiple low-surface-number plant models 33 in the target area represent plants with different shapes, the high-surface-number plant model with the same shape is placed at the original position of the multiple low-surface-number plant models 33, the same virtual light source 31 is used for irradiation, a shadow casting of the high-surface-number plant model can be obtained, fig. 8 is a schematic diagram for adjusting the object attribute of the first virtual three-dimensional model, as shown in fig. 8, the high-surface-number plant model is only used for making a shadow casting texture with high precision, and the high-surface-number plant model is not required to be displayed in the game scene, the "object attribute" interface of the high-number plant model is not required, other options "visible to the camera" are not selected "for the camera" option "to be kept unchanged, it is ensured that the high-surface-number plant model can be cast in the high-number of the max plant model, the shadow casting shadow can be seen at the same plane, and the high-number plant model can be seen at the normal position of the low-surface-number plant model in the game scene, and the high-number plant model can be seen at the high-surface-number of the high-number plant model, and the high-surface-number plant model can be rendered at the normal level.
As an alternative embodiment, the shadow processing method of the virtual three-dimensional model further includes: object properties of the second virtual three-dimensional model are adjusted to cancel the drop shadows generated by the second virtual three-dimensional model under the virtual light source illumination.
When the mapping shadow of the second virtual three-dimensional model is manufactured, the final display effect is the shadow casting texture of the first virtual three-dimensional model, the actual mapping shadow of the second virtual three-dimensional model does not need to be displayed, and the casting shadow generated by the second virtual three-dimensional model under the irradiation of the virtual light source can be canceled by adjusting the object attribute of the second virtual three-dimensional model.
For example, the second virtual three-dimensional model may be a low-aspect-number plant model in a game scene, the first virtual three-dimensional model may be a high-aspect-number plant model in the game scene, and fig. 9 is a schematic diagram of adjusting object properties of the second virtual three-dimensional model according to an embodiment of the present application, as shown in fig. 9, in the 3d sm ax software interface, since a shadow casting texture of the high-aspect-number plant model is already obtained, as a casting shadow of the low-aspect-number plant model, the object properties of the low-aspect-number plant model may be set, specifically, the "object properties" interface of the low-aspect-number plant model is entered, the "casting shadow" option is deselected, and other options of "rendering control" remain unchanged, so that the low-aspect-number plant model is in a visible state in the field of view of the virtual camera in the game scene, but no baking of the shadow is performed.
Through the steps, the cast shadows extracted by baking the second virtual three-dimensional model and the first virtual three-dimensional model are displayed in the view angle of the virtual camera, the shadows of the second virtual three-dimensional model are not baked, the first virtual three-dimensional model is invisible to the virtual camera, the cast shadow of the second virtual three-dimensional model with higher precision is replaced by the cast shadow of the first virtual three-dimensional model with higher precision, and the third dimension of the second virtual three-dimensional model with lower surface patch number is enhanced.
As an alternative embodiment, shadow cast textures are obtained using a first game engine and multiplexed to a second game engine.
The first game engine may be used to create a first virtual three-dimensional model of a high number of tiles and the second game engine may be used to create a virtual three-dimensional model of a low number of tiles. In an alternative embodiment, the first game engine may be 3DSMAX software, and the second game engine may be any one of the manufacturing environments such as Neox, unity, unreal.
It should be noted that, by using the shadow cast texture of the first virtual three-dimensional model obtained by the first game engine, the second virtual three-dimensional model may be replaced in the first game engine itself, for example, by placing the first virtual three-dimensional model and the second virtual three-dimensional model at the same target position through the steps described above, canceling the view of the virtual camera based on setting the first virtual three-dimensional model, and canceling the cast of the second virtual three-dimensional model, so that the cast shadow of the first virtual three-dimensional model replaces the shadow of the second virtual three-dimensional model in the first game engine. After the shadows of the first virtual three-dimensional model obtained by the first game engine are baked and extracted, the shadows of the second virtual three-dimensional model are replaced in the second game engine, so that the stereoscopic vision effect of the virtual three-dimensional model in various game engines is improved, and the method is applicable to various game engines.
Since most games, particularly hand-play, have high requirements on the performance of the game, there is a high requirement on the number of tiles to be molded, e.g., a high number of tiles, a game terminal requiring high performance may result in a stuck terminal operation. The shadow casting textures with higher precision are obtained from the first game engine and multiplexed into the second game engine, so that the performance of the game and the stereoscopic effect of the scene can be considered, and the excellent experience of the game performance and the visual effect can be brought to the player at the same time.
In an alternative embodiment, the first virtual three-dimensional model may be a high-level plant three-dimensional model, and the shadow cast texture of the high-level plant three-dimensional model is manufactured in 3DSMAX software, as shown in fig. 7, after the shadow cast texture of the baked high-level plant three-dimensional model is extracted, the shadow of the low-level plant three-dimensional model is replaced in the second game engine, and fig. 10 is a schematic diagram of the shadow cast texture displayed in the game engine according to an embodiment of the present application, as shown in fig. 10, the shadow cast texture of the high-level plant three-dimensional model obtained in fig. 7 is multiplexed into the second game engine, so as to display a cast shadow with higher precision, improve the stereoscopic impression of the low-level plant three-dimensional model in the second game engine, and realize the manufacturing of the shadow cast texture with higher precision in the low-level plant three-dimensional model in the second game engine, thereby achieving both game performance and visual experience of the scene.
In an alternative embodiment, the second virtual three-dimensional model may be a low-surface-number plant model in a game scene, the first virtual three-dimensional model may be a high-surface-number plant model in the game scene, the first game engine may be 3DSMAX software, and a high-precision shadow of the low-surface-number plant model may be made based on the 3DSMAX software, and specifically, the shadow processing method of the virtual three-dimensional model may include the following steps:
s1, placing a low-surface-number plant model in a 3DSMAX software interface, and placing a high-surface-number plant model with the same shape on the position of the low-surface-number plant model, wherein the low-surface-number plant model can be obtained by adopting a method of topological subtracting surface of the high-surface-number plant model and the like.
S2, setting object attributes of the high-surface-number plant model, entering an 'object attribute' interface of the high-surface-number plant model as shown in fig. 8, and deselecting a 'visible to camera' option to realize that the high-surface-number plant model is cancelled to be visible to a virtual camera of 3DSMAX software.
S3, setting object attributes of the low-surface-number plant model, entering an 'object attribute' interface of the low-surface-number plant model as shown in fig. 9, and canceling the shadow cast by the low-surface-number plant model.
S4, controlling the virtual light source to irradiate the high-surface-number plant model from a preset direction, and obtaining the shadow casting texture of the high-surface-number plant model.
Through the steps, the shadow casting texture of the high-surface-number plant model is obtained and is replaced to the shadow of the low-surface-number plant model, so that the shadow effect of the plant model shown in fig. 10 can be obtained, on one hand, the performance of game running is guaranteed due to the fact that the low-surface-number plant model is still adopted, and on the other hand, the shadow of the low-surface-number plant model is replaced by the shadow casting texture of the high-surface-number plant model, so that the game scene shows the plant model with a stronger stereoscopic impression, and the visual experience of the scene is improved.
According to an embodiment of the present application, there is provided an embodiment of a shadow processing apparatus of a virtual three-dimensional model, and fig. 11 is a schematic diagram of a shadow processing apparatus of a virtual three-dimensional model according to an embodiment of the present application, as shown in fig. 11, the apparatus including:
an obtaining module 1101, configured to obtain a shadow cast texture, where the shadow cast texture is a cast shadow generated by illuminating a first virtual three-dimensional model in a target area with a virtual light source in a game scene; the processing module 1102 is configured to set the shadow casting texture as a casting shadow generated by a second virtual three-dimensional model in the target area under the irradiation of the virtual light source, where the second virtual three-dimensional model is identical to the first virtual three-dimensional model in shape, and the number of patches of the second virtual three-dimensional model is lower than the number of patches of the first virtual three-dimensional model.
In this embodiment, the obtaining module obtains a shadow cast texture, where the shadow cast texture is a cast shadow generated by using a virtual light source in a game scene to irradiate a first virtual three-dimensional model in a target area, the processing module sets the shadow cast texture as a cast shadow generated by a second virtual three-dimensional model in the target area under the irradiation of the virtual light source, and the processing module independently makes the first virtual three-dimensional model with a high number of patches to correspond to the shadow cast texture and uses the second virtual three-dimensional model with a low number of patches to set the second virtual three-dimensional model with a low number of patches, so that a visual effect of the second virtual three-dimensional model with a high accuracy shadow in the game scene is achieved, a third dimension of the second virtual three-dimensional model with a low number of patches is enhanced, further visual experience of the game scene is improved, and technical problems of a plant model with a low number of patches and a low shadow accuracy in related technologies are solved.
As an alternative embodiment, the above-mentioned acquisition module is further configured to: acquiring a first virtual three-dimensional model corresponding to the second virtual three-dimensional model; simultaneously setting the first virtual three-dimensional model and the second virtual three-dimensional model at a target position in a target area; and controlling the virtual light source to irradiate the target position from a preset direction to obtain the shadow casting texture.
As an alternative embodiment, the above-mentioned acquisition module is further configured to: controlling a virtual light source to irradiate a target position from a preset direction, and determining a part of patches for receiving the cast shadow in the first virtual three-dimensional model; and performing rendering-to-texture operation on part of the patches to obtain shadow casting textures.
As an alternative embodiment, the above-mentioned acquisition module is further configured to: the first virtual three-dimensional model and the second virtual three-dimensional model are arranged at the same position in the target area.
As an alternative embodiment, the shadow processing apparatus of the virtual three-dimensional model further includes: the first adjusting module is used for adjusting the object attribute of the first virtual three-dimensional model so that the first virtual three-dimensional model is in an invisible state in the visual field range of the virtual camera in the game scene.
As an alternative embodiment, the shadow processing apparatus of the virtual three-dimensional model further includes: and the second adjusting module is used for adjusting the object attribute of the second virtual three-dimensional model so as to cancel the cast shadow generated by the second virtual three-dimensional model under the irradiation of the virtual light source.
As an alternative embodiment, shadow cast textures are obtained using a first game engine and multiplexed to a second game engine.
It should be noted that, the optional or preferred implementation manner of this embodiment may refer to the related description in the method embodiment, which is not repeated herein.
According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium having stored therein a computer program, wherein the computer program is configured to execute the shadow processing method of the virtual three-dimensional model in any one of the above-mentioned items when running.
The computer readable storage medium is arranged to store program code for performing the steps of: obtaining a shadow casting texture, wherein the shadow casting texture is a casting shadow generated by irradiating a first virtual three-dimensional model in a target area by using a virtual light source in a game scene; setting the shadow casting texture as casting shadow generated by a second virtual three-dimensional model under the irradiation of a virtual light source in the target area, wherein the second virtual three-dimensional model has the same modeling as the first virtual three-dimensional model, and the number of patches of the second virtual three-dimensional model is lower than that of the first virtual three-dimensional model.
According to another aspect of the embodiments of the present application, there is also provided a processor for running a program, wherein the program is configured to execute the shadow processing method of the virtual three-dimensional model in any one of the above-mentioned aspects at runtime.
In this embodiment, the above-described processor may be configured to execute the following steps by a computer program: obtaining a shadow casting texture, wherein the shadow casting texture is a casting shadow generated by irradiating a first virtual three-dimensional model in a target area by using a virtual light source in a game scene; setting the shadow casting texture as casting shadow generated by a second virtual three-dimensional model under the irradiation of a virtual light source in the target area, wherein the second virtual three-dimensional model has the same modeling as the first virtual three-dimensional model, and the number of patches of the second virtual three-dimensional model is lower than that of the first virtual three-dimensional model.
According to another aspect of the embodiments of the present application, there is also provided an electronic device including a memory in which a computer program is stored, and a processor configured to run the computer program to perform the shadow processing method of the virtual three-dimensional model in any one of the above.
The electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, 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 performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
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, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.

Claims (9)

1. A shadow processing method for a virtual three-dimensional model, comprising:
obtaining a shadow casting texture, wherein the shadow casting texture is a casting shadow generated by irradiating a first virtual three-dimensional model in a target area by using a virtual light source in a game scene;
replacing a cast shadow generated by a second virtual three-dimensional model in the target area under the irradiation of the virtual light source with the shadow cast texture, wherein the second virtual three-dimensional model has the same modeling as the first virtual three-dimensional model, and the number of patches of the second virtual three-dimensional model is lower than that of the first virtual three-dimensional model;
wherein obtaining the shadow casting texture comprises: acquiring the first virtual three-dimensional model corresponding to the second virtual three-dimensional model; setting the first virtual three-dimensional model and the second virtual three-dimensional model at a target position in the target area; and controlling the virtual light source to irradiate the target position from a preset direction to obtain the shadow casting texture.
2. The shadow processing method of claim 1, wherein controlling the virtual light source to illuminate the target location from the preset direction, the shadow casting texture comprising:
controlling the virtual light source to irradiate the target position from the preset direction, and determining a part of patches which receive the cast shadow in the first virtual three-dimensional model;
and executing rendering-to-texture operation on the partial patches to obtain the shadow casting texture.
3. The shadow processing method of a virtual three-dimensional model according to claim 1, wherein disposing the first virtual three-dimensional model and the second virtual three-dimensional model at target positions within the target region comprises:
the first virtual three-dimensional model and the second virtual three-dimensional model are arranged at the same position in the target area.
4. The shadow processing method of a virtual three-dimensional model according to claim 1, wherein the shadow processing method of a virtual three-dimensional model further comprises:
and adjusting object attributes of the first virtual three-dimensional model to enable the first virtual three-dimensional model to be in an invisible state in the visual field range of the virtual camera in the game scene.
5. The shadow processing method of a virtual three-dimensional model according to claim 1, wherein the shadow processing method of a virtual three-dimensional model further comprises:
and adjusting object properties of the second virtual three-dimensional model to cancel the drop shadows generated by the second virtual three-dimensional model under the irradiation of the virtual light source.
6. The method of claim 1, wherein the shadow cast texture is obtained using a first game engine and multiplexed to a second game engine.
7. A shadow processing apparatus for a virtual three-dimensional model, comprising:
an acquisition module for acquiring a shadow casting texture, wherein the shadow casting texture is a casting shadow generated by irradiating a first virtual three-dimensional model in a target area by using a virtual light source in a game scene;
the processing module is used for setting the shadow casting texture as a casting shadow generated by a second virtual three-dimensional model in the target area under the irradiation of the virtual light source, wherein the second virtual three-dimensional model has the same modeling as the first virtual three-dimensional model, and the number of patches of the second virtual three-dimensional model is lower than that of the first virtual three-dimensional model;
wherein the acquisition module is configured to acquire the shadow casting texture by: acquiring the first virtual three-dimensional model corresponding to the second virtual three-dimensional model; setting the first virtual three-dimensional model and the second virtual three-dimensional model at a target position in the target area; and controlling the virtual light source to irradiate the target position from a preset direction to obtain the shadow casting texture.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program, wherein the computer program is arranged to execute the shadow processing method of the virtual three-dimensional model of any one of claims 1 to 7 at run-time.
9. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the shadow processing method of the virtual three-dimensional model of any one of claims 1 to 7.
CN202110904390.5A 2021-08-06 2021-08-06 Shadow processing method and device for virtual three-dimensional model and electronic device Active CN113706683B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110904390.5A CN113706683B (en) 2021-08-06 2021-08-06 Shadow processing method and device for virtual three-dimensional model and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110904390.5A CN113706683B (en) 2021-08-06 2021-08-06 Shadow processing method and device for virtual three-dimensional model and electronic device

Publications (2)

Publication Number Publication Date
CN113706683A CN113706683A (en) 2021-11-26
CN113706683B true CN113706683B (en) 2023-09-26

Family

ID=78651788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110904390.5A Active CN113706683B (en) 2021-08-06 2021-08-06 Shadow processing method and device for virtual three-dimensional model and electronic device

Country Status (1)

Country Link
CN (1) CN113706683B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901313A (en) * 2010-06-10 2010-12-01 中科方德软件有限公司 Linux file protection system and method
CN103500462A (en) * 2013-10-14 2014-01-08 合肥完美世界网络技术有限公司 Method and system for providing image of virtual game scene
CN108434742A (en) * 2018-02-02 2018-08-24 网易(杭州)网络有限公司 The treating method and apparatus of virtual resource in scene of game
CN109448099A (en) * 2018-09-21 2019-03-08 腾讯科技(深圳)有限公司 Rendering method, device, storage medium and the electronic device of picture
CN110124318A (en) * 2019-06-12 2019-08-16 网易(杭州)网络有限公司 The method and device of virtual vegetation production, electronic equipment, storage medium
CN111292405A (en) * 2020-02-06 2020-06-16 腾讯科技(深圳)有限公司 Image rendering method and related device
CN111784817A (en) * 2020-06-30 2020-10-16 完美世界(北京)软件科技发展有限公司 Shadow display method and device, storage medium and electronic device
CN111773719A (en) * 2020-06-23 2020-10-16 完美世界(北京)软件科技发展有限公司 Rendering method and device of virtual object, storage medium and electronic device
CN111968216A (en) * 2020-07-29 2020-11-20 完美世界(北京)软件科技发展有限公司 Volume cloud shadow rendering method and device, electronic equipment and storage medium
CN112206535A (en) * 2020-11-05 2021-01-12 腾讯科技(深圳)有限公司 Rendering display method and device of virtual object, terminal and storage medium
CN112215936A (en) * 2020-10-16 2021-01-12 广州虎牙科技有限公司 Image rendering method and device, electronic equipment and storage medium
CN112435323A (en) * 2020-11-26 2021-03-02 网易(杭州)网络有限公司 Light effect processing method, device, terminal and medium in virtual model

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AUPQ691100A0 (en) * 2000-04-14 2000-05-11 Lim, Dr Hong Lip Improvements to 3d graphics
US9883167B2 (en) * 2015-09-25 2018-01-30 Disney Enterprises, Inc. Photometric three-dimensional facial capture and relighting
GB2578592B (en) * 2018-10-31 2023-07-05 Sony Interactive Entertainment Inc Apparatus and method of video playback

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901313A (en) * 2010-06-10 2010-12-01 中科方德软件有限公司 Linux file protection system and method
CN103500462A (en) * 2013-10-14 2014-01-08 合肥完美世界网络技术有限公司 Method and system for providing image of virtual game scene
CN108434742A (en) * 2018-02-02 2018-08-24 网易(杭州)网络有限公司 The treating method and apparatus of virtual resource in scene of game
CN109448099A (en) * 2018-09-21 2019-03-08 腾讯科技(深圳)有限公司 Rendering method, device, storage medium and the electronic device of picture
CN110124318A (en) * 2019-06-12 2019-08-16 网易(杭州)网络有限公司 The method and device of virtual vegetation production, electronic equipment, storage medium
CN111292405A (en) * 2020-02-06 2020-06-16 腾讯科技(深圳)有限公司 Image rendering method and related device
CN111773719A (en) * 2020-06-23 2020-10-16 完美世界(北京)软件科技发展有限公司 Rendering method and device of virtual object, storage medium and electronic device
CN111784817A (en) * 2020-06-30 2020-10-16 完美世界(北京)软件科技发展有限公司 Shadow display method and device, storage medium and electronic device
CN111968216A (en) * 2020-07-29 2020-11-20 完美世界(北京)软件科技发展有限公司 Volume cloud shadow rendering method and device, electronic equipment and storage medium
CN112215936A (en) * 2020-10-16 2021-01-12 广州虎牙科技有限公司 Image rendering method and device, electronic equipment and storage medium
CN112206535A (en) * 2020-11-05 2021-01-12 腾讯科技(深圳)有限公司 Rendering display method and device of virtual object, terminal and storage medium
CN112435323A (en) * 2020-11-26 2021-03-02 网易(杭州)网络有限公司 Light effect processing method, device, terminal and medium in virtual model

Also Published As

Publication number Publication date
CN113706683A (en) 2021-11-26

Similar Documents

Publication Publication Date Title
CN109427088B (en) Rendering method for simulating illumination and terminal
Ijiri et al. Floral diagrams and inflorescences: interactive flower modeling using botanical structural constraints
CN113223131B (en) Model rendering method and device, storage medium and computing equipment
CN107909641A (en) One kind bakees rendering intent, device, terminal device and storage medium
CN108837510B (en) Information display method and device, storage medium and electronic device
CN108043027A (en) Storage medium, electronic device, the display methods of game picture and device
CN111803942A (en) Soft shadow generation method and device, electronic equipment and storage medium
CN111199573B (en) Virtual-real interaction reflection method, device, medium and equipment based on augmented reality
CN105335996A (en) Light irradiation effect calculation method and device
CN116228943A (en) Virtual object face reconstruction method, face reconstruction network training method and device
CN114549719A (en) Rendering method, rendering device, computer equipment and storage medium
CN113706683B (en) Shadow processing method and device for virtual three-dimensional model and electronic device
CN111632376B (en) Virtual model display method and device, electronic equipment and storage medium
CN112052864A (en) Image drawing method and device, electronic equipment and readable storage medium
CN112215938A (en) Method and device for generating reflected illumination data in game and computer equipment
CN115063330A (en) Hair rendering method and device, electronic equipment and storage medium
CN115845369A (en) Cartoon style rendering method and device, electronic equipment and storage medium
CN106775741B (en) Icon generation method and device
CN113034350B (en) Vegetation model processing method and device
CN114307158A (en) Three-dimensional virtual scene data generation method and device, storage medium and terminal
CN111738967B (en) Model generation method and apparatus, storage medium, and electronic apparatus
CN114119848A (en) Model rendering method and device, computer equipment and storage medium
CN108846897B (en) Three-dimensional model surface material simulation method and device, storage medium and electronic equipment
CN113610955A (en) Object rendering method and device and shader
US10713836B2 (en) Simulating lenses

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