Information processing method, device, readable storage medium and electronic device

By obtaining baking information of the vegetation model from multiple target orientations and baking, the problem of low rendering efficiency of vegetation model is solved, efficient rendering and lighting shadow calculation are achieved, and the number of vegetation surfaces is significantly reduced.

CN114863010BActive Publication Date: 2025-04-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210429359.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-22
Publication Date
2025-04-25
Estimated Expiration
2042-04-22

AI Technical Summary

Technical Problem

The rendering efficiency of vegetation models in the game is mainly due to the complexity of the topological geometry and the need to enable alpha testing, which affects the rendering process of the graphics processor.

Method used

By obtaining baking information of the vegetation model from multiple target orientations, multiple sets of shadow information are generated, and baking the vegetation model based on this information, multiple baking results are obtained. Then, based on the current orientation of the vegetation model, the target baking results are selected from multiple baking results and converted into the target image so that the bulletin board can also participate in the light shadow calculation.

Benefits of technology

By reducing the number of faces of the vegetation model, the overhead of rendering is reduced, the efficiency of vegetation model processing is improved, and the bulletin board can participate in lighting shadow calculations, improving the display effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863010B_ABST
    Figure CN114863010B_ABST
Patent Text Reader

Abstract

The present invention discloses an information processing method, device, readable storage medium and electronic device. The method comprises: obtaining a set of baking information corresponding to a vegetation model to be baked from each target orientation of multiple target orientations, and obtaining multiple sets of baking information, wherein each set of baking information includes shadow information of the vegetation model at the corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation; baking the vegetation model based on the multiple sets of baking information, and obtaining multiple baking results, wherein the multiple baking results correspond to the multiple sets of baking information one by one; selecting a target baking result from the multiple baking results based on the first current orientation of the vegetation model in the virtual scene; converting the target baking result into a target image of the vegetation model, wherein the target image includes a shadow image corresponding to the first current orientation. The present invention solves the technical problem of low efficiency in processing vegetation models.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to an information processing method, device, readable storage medium and electronic device. Background Art

[0002] At present, when displaying vegetation models in games, it is usually achieved mainly through inserts, and this form of display usually has a high number of faces. However, due to the complexity of its topological geometry, when rendering vegetation models, it is necessary to enable alpha testing. Alpha testing will affect the rendering process of the graphics processor and reduce the rendering speed, thus leading to technical problems such as low efficiency in vegetation model processing.

[0003] Currently, no effective solution has been proposed to address the problem of low efficiency in vegetation model processing. Summary of the invention

[0004] At least some embodiments of the present invention provide an information processing method, apparatus, readable storage medium and electronic device to at least solve the technical problem of low efficiency in vegetation model processing.

[0005] According to one embodiment of the present invention, an information processing method is provided, the method comprising: obtaining a set of baking information corresponding to a vegetation model to be baked from each target orientation of a plurality of target orientations, to obtain a plurality of sets of baking information, wherein each set of baking information comprises shadow information of the vegetation model at the corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation; baking the vegetation model based on the plurality of sets of baking information, to obtain a plurality of baking results, wherein the plurality of baking results correspond one-to-one to the plurality of sets of baking information; selecting a target baking result from the plurality of baking results based on a first current orientation of the vegetation model in a virtual scene; and converting the target baking result into a target image of the vegetation model, wherein the target image comprises a shadow image corresponding to the first current orientation.

[0006] Optionally, shadow information is determined based on a plurality of vertices of the vegetation model.

[0007] Optionally, determining shadow information based on the vertices of the vegetation model includes: obtaining a set of rays starting from each vertex to obtain multiple sets of rays, wherein the multiple sets of rays correspond one-to-one to multiple vertices; obtaining intersection information between the multiple sets of rays; and determining shadow information based on the intersection information.

[0008] Optionally, the vegetation model is baked based on multiple groups of baking information to obtain multiple baking results, including: baking the vegetation model based on one group of baking information to obtain a target baking map, wherein the baking results include the target baking map.

[0009] Optionally, the baking information includes the encoding result of the shadow information of the vegetation model at a corresponding target orientation, the color information of the vegetation model at a corresponding target orientation, and the normal information of the vegetation model at a corresponding target orientation. The vegetation model is baked based on a set of baking information to obtain a target baking map, including: baking the vegetation model based on the color information to obtain a first map, baking the vegetation model based on the normal information to obtain a second map, and baking the vegetation model based on the encoding result of the shadow information to obtain a third map, wherein the target baking map includes the first map, the second map, and the third map.

[0010] Optionally, baking the vegetation model based on the encoding result of the shadow information to obtain a third map includes: interpolating the encoding result to obtain an interpolation result; and baking the vegetation model based on the interpolation result to obtain the third map.

[0011] Optionally, baking the vegetation model based on normal information to obtain a second map includes: converting the normal information from the local space of the vegetation model to the world space of the vegetation model; baking the vegetation model based on the normal information in the local space to obtain the second map.

[0012] Optionally, converting the target baking result into a target image of the vegetation model includes: rendering and displaying the first map and the second map respectively, and generating a shadow image from the encoding result of the shadow information in the third map to obtain the target image.

[0013] Optionally, baking the vegetation model based on a set of baking information to obtain a target baking map includes: baking the vegetation model based on a set of baking information to obtain an original baking map; supersampling the original baking map to obtain a target baking map, wherein the size of the target baking map is smaller than the size of the original baking map.

[0014] Optionally, supersampling the original baking map to obtain a target baking map includes: supersampling the original baking map, and performing edge expansion processing on the sampled original baking map to obtain the target baking map.

[0015] Optionally, a bounding sphere of the vegetation model is obtained; the spherical surface of the bounding sphere is equally divided into a plurality of sub-spherical surfaces; and the orientation corresponding to each sub-spherical surface is determined as a target orientation.

[0016] Optionally, a set of baking information corresponding to the vegetation model to be baked is obtained from each of the multiple target orientations to obtain multiple sets of baking information, including: obtaining a set of baking information based on a virtual camera at each target orientation to obtain multiple sets of baking information, wherein the virtual camera is directed toward the center of the vegetation model.

[0017] Optionally, based on a first current orientation of the vegetation model in the virtual scene, a target baking result is selected from multiple baking results, including: obtaining an angle between the first current orientation and a second current orientation, wherein the second current orientation is the orientation of a virtual camera currently facing the virtual scene; and selecting a target baking result from multiple baking results based on the angle.

[0018] Optionally, mesh information of the billboard model is determined based on the size of the vegetation model; the billboard model is generated based on the mesh information of the billboard model; and the target baking result is displayed based on the billboard model.

[0019] Optionally, converting the target baking result into a target image of the vegetation model includes: performing lighting processing on the billboard model displaying the target baking result to obtain the target image.

[0020] Optionally, determining the mesh information of the billboard model based on the size of the vegetation model includes: determining the mesh vertex information and mesh texture information of the billboard model based on the bounding box and bounding sphere of the vegetation model.

[0021] Optionally, the number of target locations is eight.

[0022] According to one embodiment of the present invention, an information processing device is also provided, which includes: an acquisition unit, used to acquire a set of baking information corresponding to the vegetation model to be baked from each target orientation of multiple target orientations, to obtain multiple sets of baking information, wherein each set of baking information includes shadow information of the vegetation model at a corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation; a baking unit, used to bake the vegetation model based on the multiple sets of baking information, to obtain multiple baking results, wherein the multiple baking results correspond one-to-one to the multiple sets of baking information; a selection unit, used to select a target baking result from the multiple baking results based on the first current orientation of the vegetation model in the virtual scene; a conversion unit, used to convert the target baking result into a target image of the vegetation model, wherein the target image includes a shadow image corresponding to the first current orientation.

[0023] According to one embodiment of the present invention, a non-volatile storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute any of the above information processing methods when running.

[0024] According to one embodiment of the present invention, there is further provided an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any of the above information processing methods.

[0025] In at least some embodiments of the present invention, a set of baking information corresponding to the vegetation model to be baked is obtained from each target orientation of multiple target orientations to obtain multiple sets of baking information, wherein each set of baking information includes shadow information of the vegetation model at the corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation; the vegetation model is baked based on the multiple sets of baking information to obtain multiple baking results, wherein the multiple baking results correspond one-to-one to the multiple sets of baking information; based on a first current orientation of the vegetation model in the virtual scene, a target baking result is selected from the multiple baking results; and the target baking result is converted into a target image of the vegetation model, wherein the target image includes a shadow image corresponding to the first current orientation. That is to say, the embodiment of the present invention obtains a group of baking information corresponding to the vegetation model to be baked from each target orientation of multiple target orientations to obtain multiple groups of baking information, and then bakes the vegetation model based on the multiple groups of baking information to obtain multiple baking results. Finally, based on the first current orientation of the vegetation model in the virtual scene, the target baking result is selected from the multiple baking results, and the target baking result is converted into a target image of the vegetation model, so that the baked billboard can also participate in the lighting and shadow calculation, thereby achieving the purpose of using the billboard to replace the vegetation model and significantly reducing the number of vegetation faces, thereby achieving the technical effect of improving the efficiency of vegetation model processing and solving the technical problem of low efficiency of vegetation model processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0027] Figure 1 It is a hardware structure block diagram of a mobile terminal of an information method according to an embodiment of the present invention;

[0028] Figure 2 is a flow chart of an information processing method according to an embodiment of the present invention;

[0029] Figure 3 is a flow chart of a method for baking a billboard model according to an embodiment of the present invention;

[0030] Figure 4 is a flow chart of a method for rendering a vegetation model according to an embodiment of the present invention;

[0031] Figure 5 is a schematic diagram of an information processing device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0034] According to one embodiment of the present invention, an embodiment of an information processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0035] The method embodiment can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, referred to as MID), a PAD, a game console and other terminal devices. Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of an information processing method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a programmable logic device (FPGA), a neural network processor (NPU), a tensor processor (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 for communication functions, an input and output device 108, and a display device 110. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0036] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the information processing method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above-mentioned information processing method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0037] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0038] The inputs in the input / output device 108 may come from a plurality of human interface devices (HIDs), such as keyboards and mice, game controllers, and other dedicated game controllers (such as steering wheels, fishing rods, dance mats, remote controls, etc.). In addition to providing input functions, some human interface devices may also provide output functions, such as force feedback and vibration of game controllers, audio output of controllers, etc.

[0039] The display device 110 may be, for example, a head-up display (HUD), a touch-screen liquid crystal display (LCD), and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), and a user may interact with the GUI by finger contacts and / or gestures on a touch-sensitive surface, wherein the human-computer interaction functions here may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or a readable storage medium executable by one or more processors.

[0040] In this embodiment, an information processing method running on the above mobile terminal is provided. Figure 2 is a flow chart of an information processing method according to an embodiment of the present invention. Figure 2 As shown, the method may include the following steps:

[0041] Step S202, respectively obtain a set of baking information corresponding to the vegetation model to be baked from each of the multiple target orientations, to obtain multiple sets of baking information, wherein each set of baking information includes shadow information of the vegetation model at the corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation.

[0042] In the technical solution provided by the above step S202 of the present invention, the baking information corresponding to the vegetation model to be baked at each target orientation in the multiple target orientations is obtained respectively, thereby obtaining multiple sets of baking information. Based on the obtained multiple sets of baking information, the baked billboard can also participate in the lighting and shadow calculation to ensure the display effect, wherein each set of baking information may include the shadow information of the vegetation model at the corresponding target orientation, and the shadow information of the vegetation model at the corresponding target orientation may be the self-occlusion shadow information corresponding to the self-occlusion problem generated when generating real-time shadow information, which may be used to generate a shadow image at the corresponding target orientation. The vegetation model may be a tree model and a flower and grass model, which is not specifically limited here.

[0043] Optionally, the multiple target directions may be directions of eight equally divided angles in the 360-degree plane direction, wherein each equally divided angle is 45 degrees, namely, 0 degrees, 45 degrees, 90 degrees, 135 degrees, 180 degrees, 225 degrees, 270 degrees, and 325 degrees.

[0044] Optionally, the baking information may further include base color (BaseColor) information, normal information, and real-time shadow information of the vegetation model, wherein jaggedness and self-occlusion problems may occur when generating real-time shadow information.

[0045] Step S204 , baking the vegetation model based on the multiple sets of baking information respectively to obtain multiple baking results, wherein the multiple baking results correspond to the multiple sets of baking information one by one.

[0046] In the technical solution provided in the above step S204 of the present invention, the corresponding vegetation model to be baked is baked based on each set of baking information obtained to obtain multiple baking results, wherein each set of baking information corresponds to the baking result obtained, each set of baking information can be the baking information of the vegetation model at each target orientation, and the baking result can be a baking result map after baking is completed.

[0047] Optionally, when the corresponding vegetation models to be baked are baked based on each set of baking information obtained, each set of baking information may include: the encoding result of the shadow information of the vegetation model at a corresponding target orientation, the color information of the vegetation model at a corresponding target orientation, and the normal information of the vegetation model at a corresponding target orientation.

[0048] Optionally, baking the corresponding vegetation model to be baked is performed based on each set of baking information obtained, which can include: first baking the vegetation model based on color information to obtain a first map, then baking the vegetation model based on normal information to obtain a second map, and finally baking the vegetation model based on the encoding result of shadow information to obtain a third map, and baking the vegetation model based on the first map, the second map and the third map, wherein the color information can be basic color information, the first map can be the baked basic map, the normal information can be the normal information restored from the normal in the tangent space to the local space of the model, the second map can be a normal map, the encoding result based on the shadow information can be the spherical harmonic coefficients encoding the occlusion information on the mesh vertices, and the third map information can be a spherical harmonic information map.

[0049] Optionally, a virtual camera is placed at each target orientation, the virtual camera is set to point to the center of the vegetation model, and then a set of baking information is obtained based on the virtual camera at each target orientation, thereby obtaining multiple sets of baking information.

[0050] Step S206: selecting a target baking result from a plurality of baking results based on a first current orientation of the vegetation model in the virtual scene.

[0051] In the technical solution provided in the above step S206 of the present invention, a target baking result is selected from multiple baking results for display according to the first current orientation of the model in the virtual scene, that is, the target baking result corresponds to the first current orientation, wherein the first current orientation may be the current orientation of the vegetation model in the virtual scene, and the multiple baking results may be eight baking results obtained based on eight baking orientations.

[0052] Optionally, based on the angle between the first current orientation and the current orientation of the virtual camera facing the virtual scene, a target baking result is selected from the multiple baking results. Step S208, converting the target baking result into a target image of the vegetation model, wherein the target image includes a shadow image corresponding to the first current orientation.

[0053] In the technical solution provided in the above step S208 of the present invention, the target baking result is converted into a target image of the vegetation model by rendering the vegetation model and calculating the lighting of the self-shadow based on the target baking result, wherein the target image can be an image obtained after rendering the vegetation model and calculating the lighting of the self-shadow.

[0054] Optionally, converting the target baking result into a target image of the vegetation model may include: rendering and displaying the first map and the second map respectively, generating a shadow image based on the encoding result of the self-occlusion shadow information in the third map, and then performing lighting calculation on the shadow image to obtain the target image, thereby achieving the purpose of ensuring the display effect of the vegetation model.

[0055] Optionally, generating a shadow image based on the encoding result of the self-occlusion shadow information in the third map may include: first recording the self-occlusion shadow information when baking the vegetation model, and then using spherical harmonic function projection to store the self-occlusion shadow information, so that when the system is running, the self-occlusion shadow information can be directly restored from the spherical harmonic function, and a shadow image is generated based on the restored self-occlusion shadow information.

[0056] Through the above-mentioned steps S202 to S208 of the present invention, a group of baking information corresponding to the vegetation model to be baked is obtained from each target orientation of multiple target orientations, and multiple groups of baking information are obtained, wherein each group of baking information includes shadow information of the vegetation model at the corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation; the vegetation model is baked based on the multiple groups of baking information to obtain multiple baking results, wherein the multiple baking results correspond one-to-one to the multiple groups of baking information; based on the first current orientation of the vegetation model in the virtual scene, a target baking result is selected from the multiple baking results; the target baking result is converted into a target image of the vegetation model, wherein the target image includes a shadow image corresponding to the first current orientation. That is to say, the present invention obtains a group of baking information corresponding to the vegetation model to be baked from each target orientation of multiple target orientations to obtain multiple groups of baking information, and then bakes the vegetation model based on the multiple groups of baking information to obtain multiple baking results. Finally, based on the first current orientation of the vegetation model in the virtual scene, the target baking result is selected from the multiple baking results, and the target baking result is converted into a target image of the vegetation model, so that the baked billboard can also participate in the lighting and shadow calculation, thereby achieving the purpose of using the billboard to replace the vegetation model and significantly reducing the number of vegetation faces, thereby achieving the technical effect of improving the efficiency of vegetation model processing and solving the technical problem of low efficiency of vegetation model processing.

[0057] The above method of this embodiment is further introduced below.

[0058] As an optional implementation, the method may include: determining shadow information based on a plurality of vertices of the vegetation model.

[0059] In this embodiment, taking multiple vertex positions on the vegetation model as starting points, shadow information can be determined by judging whether rays emitted by the vertices intersect, wherein the shadow information may be the occlusion status of the vertices in various directions.

[0060] As an optional implementation, determining shadow information based on the vertices of the vegetation model includes: obtaining a set of rays starting from each vertex to obtain multiple sets of rays, wherein the multiple sets of rays correspond one-to-one to multiple vertices; obtaining intersection information between the multiple sets of rays; and determining shadow information based on the intersection information.

[0061] In this embodiment, each vertex position on the vegetation model is used as a starting point, and multiple rays are respectively emitted in the spherical space to determine whether the rays intersect, thereby determining shadow information.

[0062] As an optional implementation, step S204 bakes the vegetation model based on multiple groups of baking information to obtain multiple baking results, including: baking the vegetation model based on one group of baking information to obtain a target baking map, wherein the baking results include the target baking map.

[0063] In this embodiment, the corresponding vegetation model to be baked is baked based on each set of baking information obtained to obtain a plurality of target baking images, thereby obtaining a plurality of baking results.

[0064] As an optional implementation, the baking information includes the encoding result of the shadow information of the vegetation model at a corresponding target orientation, the color information of the vegetation model at a corresponding target orientation, and the normal information of the vegetation model at a corresponding target orientation. The vegetation model is baked based on a set of baking information to obtain a target baking map, including: baking the vegetation model based on the color information to obtain a first map, baking the vegetation model based on the normal information to obtain a second map, and baking the vegetation model based on the encoding result of the shadow information to obtain a third map, wherein the target baking map includes the first map, the second map, and the third map.

[0065] In this embodiment, the vegetation model is first baked based on color information to obtain a first map, and then the vegetation model is baked based on normal information to obtain a second map. Finally, the vegetation model is baked based on the encoding result of shadow information to obtain a third map. The vegetation model is baked based on the first map, the second map and the third map, wherein the color information can be basic color information, the first map can be a baked basic map, the second map can be a normal map, and the third map information can be a spherical harmonic information map.

[0066] Optionally, the vegetation model is baked based on the baking information, so that the baked billboard can also participate in the lighting and shadow calculation, thereby achieving the purpose of ensuring the display effect.

[0067] As an optional implementation, baking the vegetation model based on the encoding result of the shadow information to obtain a third map includes: interpolating the encoding result to obtain an interpolation result; baking the vegetation model based on the interpolation result to obtain the third map.

[0068] In this embodiment, after performing difference processing on the encoding result based on the shadow information, the vegetation model is baked to obtain a third map, wherein the encoding result based on the shadow information may be spherical harmonic coefficients encoding the occlusion information on the mesh vertices.

[0069] As an optional implementation, the vegetation model is baked based on normal information to obtain a second map, including: converting the normal information from the local space of the vegetation model to the world space of the vegetation model, and baking the vegetation model based on the normal information in the local space to obtain a second map.

[0070] In this embodiment, the normal information of the vegetation model is converted from the local space to the world space, and then the vegetation model is baked based on the normal information to obtain a second map, wherein the normal information can be the normal information restored from the normal in the tangent space to the local space of the model, the local space can refer to the relative coordinates of the model coordinate system, the world space can refer to the absolute coordinates of the world coordinate system, and the world coordinate system can also be understood as the global coordinate system.

[0071] Optionally, general normal information is based on the tangent space, and three conversions are required during calculation, namely, conversion from tangent space to local space and then to world space. The present invention restores the normals in the tangent space to the local space of the model in advance, so that the normal map stores the normal information in the local space, omitting one conversion step, thereby achieving the purpose of improving runtime efficiency.

[0072] As an optional implementation, step S208, converting the target baking result into a target image of the vegetation model, includes: rendering and displaying the first map and the second map respectively, and generating a shadow image from the encoding result of the shadow information in the third map to obtain the target image.

[0073] In this embodiment, the first map and the second map are rendered and displayed respectively, a shadow image is generated based on the encoding result of the shadow information in the third map, and then lighting calculation is performed to obtain a target image, wherein the target image can be an image obtained after rendering the vegetation model and performing lighting calculation on the self-shadow.

[0074] Optionally, by recording occlusion information during baking, and then using spherical harmonic function projection to store the occlusion shadow information, the shadow information is restored from the spherical harmonic function at runtime, and then lighting calculations are performed, a shadow image is generated based on the encoding result of the shadow information in the third map, and the target image is obtained, thereby achieving the purpose of ensuring the display effect.

[0075] As an optional implementation, the vegetation model is baked based on a set of baking information to obtain a target baking map, including: baking the vegetation model based on a set of baking information to obtain an original baking map; supersampling the original baking map to obtain a target baking map, wherein the size of the target baking map is smaller than the size of the original baking map.

[0076] In this embodiment, the corresponding vegetation model is baked through a set of baking information to obtain an original baking image, and then the original baking image is supersampled, and the size of the original baking image is reduced to the size of the image used for rendering to obtain a target baking image, wherein the original baking image may be a baking image without noise processing, and the target baking image may be a baking image with noise processing, and the size of the target baking image is smaller than that of the original baking image.

[0077] Optionally, when setting up the rendering pipeline, the size of the baked image is usually set to be twice or four times the size of the image finally used for rendering, so as to achieve the purpose of reducing the noise information of the baked generated image.

[0078] Optionally, after obtaining the baked image, supersampling technology may be used to reduce the baked large-size image to the size of the image used for rendering, thereby effectively removing noise information in the image.

[0079] As an optional implementation, supersampling the original baking map to obtain the target baking map includes: supersampling the original baking map, and expanding the edge of the sampled original baking map to obtain the target baking map.

[0080] In this embodiment, after the original baking image is reduced to the size of the image used for rendering by supersampling technology, the sampled original baking image needs to be expanded to obtain a target baking image, wherein the target baking image may be a baking image after the expansion process.

[0081] Optionally, when expanding the original baked image, you need to first get the alpha channel information in the base image. If the alpha channel value of a pixel in the baked base image is 0, find the pixel closest to the pixel and take the color value of the three channels of the color system (Red, Green, Blue, RGB for short) of the nearest pixel as the color value of the pixel.

[0082] Optionally, the baked normal map and spherical harmonic information map are also expanded according to the information of the alpha channel in the base map at the corresponding position. The base map will not expand the alpha channel, but only expand the three channels of the color system. The normal map and spherical harmonic information map will effectively expand all four channels of the generated map.

[0083] Optionally, due to the mipmap mechanism of the rendering pipeline, if the baking result image after noise processing is not expanded, black edges will appear on the edges of the model when drawing. Therefore, the present invention introduces a post-processing flow and adds expansion logic to solve the black edge problem in the real effect.

[0084] As an optional implementation, the method may include: obtaining a bounding sphere of the vegetation model; dividing the spherical surface of the bounding sphere into a plurality of sub-spherical surfaces; and determining the orientation corresponding to each sub-spherical surface as a target orientation.

[0085] In this embodiment, by calculating the bounding sphere information of the vegetation model to be baked, a spherical surface parallel to the ground on the bounding sphere is taken, and the spherical surface is divided into eight equal parts, each of which represents a sub-spherical surface, and the orientation corresponding to each sub-spherical surface is determined as a target orientation, wherein the target orientation can be the position where the virtual camera needs to be placed during baking.

[0086] As an optional implementation, a set of baking information corresponding to the vegetation model to be baked is obtained from each of the multiple target directions, and multiple sets of baking information are obtained, including: a set of baking information is obtained based on a virtual camera at each target direction, and multiple sets of baking information are obtained, wherein the virtual camera is directed toward the center of the vegetation model.

[0087] In this embodiment, the orientation of the virtual camera at each target orientation is set to point to the center of the vegetation model, and then a set of baking information is acquired based on the virtual camera at each target orientation to obtain multiple sets of baking information.

[0088] Optionally, when baking, the direction of the virtual camera is not the center direction of the bounding sphere, but the center direction of the model. Only in this way can the baked information be stored in the center of the image, thus avoiding the displacement problem from the vegetation model to the normal model billboard model.

[0089] As an optional implementation, step S206, based on the first current orientation of the vegetation model in the virtual scene, selects a target baking result from multiple baking results, including: obtaining the angle between the first current orientation and the second current orientation, wherein the second current orientation is the orientation of the virtual camera currently facing the virtual scene; and selecting the target baking result from the multiple baking results based on the angle.

[0090] In this embodiment, the angle between the first current orientation and the second current orientation is calculated according to the first current orientation and the second current orientation, and a target baking result is selected from multiple baking results based on the angle for display, wherein the first current orientation may be the current orientation of the vegetation model in the virtual scene, the second current orientation may be the orientation of the virtual camera currently facing the virtual scene, and the multiple baking results may be eight baking results obtained based on eight baking directions.

[0091] As an optional implementation, the method may include: determining mesh information of a billboard model based on a size of a vegetation model; generating a billboard model based on the mesh information of the billboard model; and displaying a target baking result based on the billboard model.

[0092] In this embodiment, the grid information of the billboard model is determined according to the size of the vegetation model, and then the billboard model can be generated based on the grid information of the billboard model. Finally, the target baking result can be further displayed based on the billboard model, wherein the billboard model can be used to display the billboard of the baking result.

[0093] As an optional implementation, step S208, converting the target baking result into a target image of the vegetation model, includes: performing lighting processing on the billboard model displaying the target baking result to obtain the target image.

[0094] In this embodiment, the billboard model displaying the target baking result is illuminated to obtain the target image, so that the baked billboard model can also participate in the lighting and shadow calculations, thereby achieving the purpose of using the billboard model to replace the vegetation model and significantly reducing the number of faces of the vegetation model, thereby achieving the effect of improving performance and reducing power consumption.

[0095] As an optional implementation, determining the mesh information of the billboard model based on the size of the vegetation model includes: determining the mesh vertex information and mesh texture information of the billboard model based on the bounding box and bounding sphere of the vegetation model.

[0096] In this embodiment, the mesh vertex information and mesh texture information of the billboard model are calculated based on the bounding box and bounding sphere of the vegetation model, wherein the mesh vertex information of the billboard model needs to be generated according to the baked vegetation model size information.

[0097] Optionally, since the camera settings during baking are set according to the size of the vegetation model's bounding sphere, in order to avoid abnormal stretching when the billboard is displayed, the generation of the billboard model's mesh vertex information needs to be calculated based on the vegetation model's bounding sphere, and the vertex positions of the billboard model mesh need to be calculated based on the ratio of the vegetation model's bounding box and bounding sphere.

[0098] Optionally, under the premise of ensuring the display effect, the grid information of the generated billboard model should be reduced as much as possible. The smaller the generated billboard grid is, the fewer the number of pixels for alpha testing is, and the higher the efficiency is.

[0099] As an optional implementation, the method may include: the number of target positions is eight.

[0100] In this embodiment, the number of target directions is eight, that is, the baking process records baking information of the vegetation model in eight directions in total.

[0101] Optionally, only the information in eight directions is baked, which can reduce the number of generated images compared to traditional imposter technology, and can also effectively avoid the problem of goofs compared to simple billboard technology.

[0102] In this embodiment, a group of baking information corresponding to the vegetation model to be baked is obtained from each target orientation of multiple target orientations to obtain multiple groups of baking information, and then the vegetation model is baked based on the multiple groups of baking information to obtain multiple baking results. Finally, based on the first current orientation of the vegetation model in the virtual scene, a target baking result is selected from the multiple baking results, and the target baking result is converted into a target image of the vegetation model, so that the baked billboard can also participate in the lighting and shadow calculation, thereby achieving the purpose of using the billboard to replace the vegetation model and significantly reducing the number of vegetation faces, thereby achieving the technical effect of improving the efficiency of vegetation model processing and solving the technical problem of low efficiency of vegetation model processing.

[0103] The technical solution of the embodiment of the present invention is further introduced below with examples in combination with preferred implementation modes.

[0104] At present, vegetation models in games (including trees and shrubs, etc.) are generally implemented in the form of inserts, which usually have a high number of faces. However, due to the complexity of its topological geometry, when rendering vegetation models, it is necessary to enable alpha testing. Alpha testing will affect the rendering process of the graphics processing unit (GPU) and reduce the rendering speed. On mobile platforms, alpha testing will bring huge rendering overhead. Therefore, due to the performance, power consumption and heat generation of mobile platforms, it is necessary to strictly control the number of faces of vegetation in the scene.

[0105] In the related art, for a vegetation model in the distance, a simple photo is taken in one direction, and it is posted on a bulletin board in the game. The code controls its continuous rotation so that the billboard always faces the camera of the scene. The overhead of this solution is relatively small, but because the information is limited and no processing is done during baking, there will be many noise points, black edges, entity (lod) switching and shifting, etc. At the same time, the baked billboard has no normal information and self-shadow information, and cannot participate in the lighting calculation, so the display effect is very poor. In addition, since there is only information in one direction, there will be a phenomenon of goofs for vegetation models with poor symmetry. On mobile platforms, due to the limitation of the number of faces, the display distance of the billboard is required to be much smaller than that of the computer platform, so it is still necessary to ensure the basic effect and be able to participate in the lighting calculation.

[0106] In another related technology, imposter technology, compared with the billboard technology, the information of vegetation is baked in 64 directions, and the information in 64 directions is stored. However, due to the excessive number of directions and information baked, the number of pictures that need to be stored also becomes more. On mobile platforms, loading too many pictures will bring huge memory overhead, and low-end machines may have insufficient memory, and will also cause a lot of bandwidth overhead. Due to the above limitations, due to the excessive number of baked pictures, each picture cannot be too large, and when the display distance is slightly closer, the display is blurry and rough, and the effect is very poor.

[0107] However, both of the above technologies cannot perform real-time shadow calculations, so there is no self-shadow information, resulting in the rendered vegetation model being too flat, which is significantly different from when shadows are calculated. Although ambient occlusion (AO) can be used to replace shadows, it requires artists to produce it, which significantly increases production costs.

[0108] However, the embodiment of the present invention proposes a new billboard baking method, which only records the information of the baked vegetation model in eight directions, including base color information, normal information, real-time shadow information, etc. At the same time, based on this information, it is ensured that the baked billboard can also participate in the lighting and shadow calculation, thereby ensuring the display effect. On mobile platforms, billboards can be used to replace vegetation models at close range, significantly reducing the number of vegetation faces, improving performance, and reducing power consumption.

[0109] Next, a novel bulletin board baking method provided by an embodiment of the present invention is further introduced. Figure 3 As shown, Figure 3 : is a flowchart of a method for baking a billboard model according to an embodiment of the present invention, and the baking process may include:

[0110] Step S301, calculating the self-occlusion shadow information of the vegetation model.

[0111] In the technical solution provided by the above step S301 of the present invention, after the model is loaded, for each vertex on the model, multiple rays are emitted in the spherical space with the vertex position as the starting point, and it is determined whether the rays intersect, and the occlusion of the vertex in each direction is recorded. After calculating the occlusion information in each direction, the occlusion information is encoded with a second-order spherical harmonic function using spherical harmonic function projection, and the encoded spherical harmonic coefficients of the occlusion information are stored in the vertex information of the mesh. The shadow spherical harmonic function is extracted during baking and stored in the baking map, which is subsequently used for self-shadow lighting calculation.

[0112] Step S302, calculating the position and orientation of the camera during baking.

[0113] In the technical solution provided in the above step S302 of the present invention, the bounding sphere information of the model to be baked is first calculated, and the spherical surface parallel to the ground on the bounding sphere is taken, and the spherical surface is divided into eight equal parts, and the eight positions after the eight equal parts represent the positions where the camera needs to be placed during baking. In order to avoid the displacement problem, when baking, the camera is not facing the center of the bounding sphere, but the center of the model. Only in this way can the baked information be stored in the center of the image, thereby avoiding the displacement problem when going from the vegetation model to the normal model bulletin board model.

[0114] Step S303, initializing the baking rendering pipeline.

[0115] In the technical solution provided in step S303 of the present invention, the baking rendering pipeline is initialized, the size of the rendering object in the rendering pipeline is initialized, and then the vegetation model to be baked is loaded, including the mesh information, texture information, spherical harmonic function information, etc. of the model.

[0116] Step S304, baking the vegetation model.

[0117] In the technical solution provided by the above step S304 of the present invention, the base map information is first baked onto the first image. Then the normal information is restored, and the normals in the tangent space are restored to the local space of the model. For runtime efficiency, the normal map stores the normal information in the local space. Then, the spherical harmonic coefficients encoded by the occlusion information on the mesh vertices pre-calculated in the previous step are taken, and the spherical harmonic coefficients are interpolated and baked onto the third image to obtain a baked generated image.

[0118] Alternatively, general normal information is based on normal space, and the conversion process during calculation is: normal space → local space → world space. However, the normal calculation process of the billboard model is: local space → world space, which omits one step of calculation and has higher efficiency in lighting calculation.

[0119] Optionally, in addition to the base map, bake and record the model's normal information to participate in lighting calculations.

[0120] Step S305: performing noise processing on the baked generated image.

[0121] In the technical solution provided in the above step S305 of the present invention, in order to reduce the noise information of the baked generated image, when setting the rendering pipeline, the size of the baked image is usually set to be twice or four times the size of the image finally used for rendering. After obtaining the baked image, the supersampling technology is used to reduce the large size of the baked image to the size of the image used for rendering, which can effectively remove the noise information in the image.

[0122] Optionally, in order to effectively solve the noise problem, the present invention adopts supersampling technology, bakes a relatively large image, and then manually generates a result image of the corresponding target size.

[0123] Step S306, performing edge expansion processing on the baked generated image.

[0124] In the technical solution provided in the above step S306 of the present invention, due to the mipmap mechanism of the rendering pipeline, if the baking result image after noise processing is not expanded, black edges will appear on the edge of the model when drawing. When expanding the baked generated image, first get the information of the alpha channel in the base image. If the value of the alpha channel of a pixel in the baked base image is 0, find the pixel closest to the pixel, and take the color value of the three channels of the color system (Red, Green, Blue, RGB for short) of the nearest pixel as the color value of the pixel. For the baked normal map and spherical harmonic information map, the expansion process is also performed based on the information of the alpha channel in the base image at the corresponding position. The base image will not expand the alpha channel, but only expand the three channels of the color system. The normal map and the spherical harmonic information map will effectively expand all four channels of the generated image.

[0125] Step S307, baking the next position to be baked of the vegetation model.

[0126] In the technical solution provided in the above step S307 of the present invention, it is determined whether to bake the next position to be baked of the vegetation model according to the baking effect of the baking generated image. If so, it indicates that the baking generated image of the current position meets the requirements, and the baking process can be continued until the baking is completed and the baking result image is output; if not, return to step S302 and bake again.

[0127] Step S308, generating vertex information of the billboard model mesh.

[0128] In the technical solution provided in the above step S308 of the present invention, the mesh vertex information of the billboard model needs to be generated according to the size information of the baked vegetation model. In order to improve efficiency, the generated billboard model mesh information should be reduced as much as possible while ensuring the display effect. The smaller the generated billboard model mesh, the fewer the number of pixels for alpha testing, and the higher the efficiency. Since the camera settings during baking are set according to the size of the vegetation model bounding sphere, in order to avoid abnormal stretching during the display of the billboard, the generation of the billboard model mesh vertex information needs to be calculated based on the vegetation model bounding sphere, and the vertex position of the billboard model mesh is calculated based on the ratio of the vegetation model bounding box and the bounding sphere.

[0129] Optionally, calculating the vertex positions of the billboard model mesh may include: calculating the size of the vegetation model bounding box; converting from three dimensions to two dimensions, taking only the bounding box information on the plane, ignoring the height information, and then taking the maximum values ​​in the horizontal (X) and vertical (Z) directions; calculating a difference between the bounding boxes of the bounding sphere; calculating the billboard model mesh (billboard mesh) of the vegetation model based on the bounding sphere; and adjusting the vertex positions of the billboard model mesh calculated by the bounding sphere according to the difference calculated above.

[0130] Optionally, the vertex positions of the billboard model mesh can be calculated by the following formula:

[0131] The size of the model bounding box = the maximum vertex of the bounding box - and the minimum vertex;

[0132] The difference between the bounding sphere and the bounding box = the distance between the model and the virtual camera - the distance from the horizontal axis to the vertical axis of the model;

[0133] The maximum vertex of the model bounding box = (the center of the horizontal axis of the model bounding sphere + the radius of the model bounding sphere, the center of the vertical axis of the model bounding sphere + the radius of the model bounding sphere, the center of the vertical axis of the model bounding sphere + the radius of the model bounding sphere);

[0134] The minimum vertex of the model bounding box = (the center of the horizontal axis of the model bounding sphere - the radius of the model bounding sphere, the center of the vertical axis of the model bounding sphere - the radius of the model bounding sphere, the center of the vertical axis of the model bounding sphere - the radius of the model bounding sphere);

[0135] The vertex position of the billboard model mesh = {{minimum value of the horizontal axis of the model bounding sphere + difference, minimum value of the vertical axis of the model bounding box, 0}, {maximum value of the horizontal axis of the model bounding sphere - difference, minimum value of the vertical axis of the model bounding box, 0}, {minimum value of the horizontal axis of the model bounding sphere + difference, maximum value of the vertical axis of the model bounding box, 0}, {maximum value of the horizontal axis of the model bounding sphere - difference, maximum value of the vertical axis of the model bounding box, 0}}.

[0136] Step S309, generating two-dimensional texture coordinate information of the billboard model grid.

[0137] In the technical solution provided in the above step S309 of the present invention, the calculation of the two-dimensional texture coordinates (uv) needs to be determined based on the relevant information of the vegetation model bounding box and the bounding sphere, and the two-dimensional texture coordinate values ​​of the four vertices of the billboard model are calculated based on the ratio of the length of the billboard model to the radius of the bounding sphere and the ratio of the height of the vegetation model bounding box to the radius of the vegetation model bounding sphere.

[0138] Optionally, calculating the two-dimensional texture coordinate information of the billboard model grid may include: calculating the size of the vegetation model bounding box; calculating the diameter of the vegetation model bounding sphere; selecting the larger one of the vegetation model bounding box in the horizontal and vertical directions; calculating the ratio of the difference; ensuring that the offset values ​​of the coordinate values ​​of the horizontal and vertical axes and the two-dimensional texture coordinate values ​​are greater than 0; using the same method to calculate the offset value of the upper part in the vertical direction; calculating the offset value of the upper and lower parts in the vertical direction; and calculating the two-dimensional texture coordinate value based on the calculated offset value.

[0139] Optionally, since the value range of the two-dimensional texture coordinates is 0.0-1.0, the ratio of the difference can be calculated according to the ratio of the length of the horizontal axis and the vertical axis to the bounding sphere of the vegetation model.

[0140] Optionally, the two-dimensional texture coordinate information of the billboard model grid can be calculated by the following formula:

[0141] The size of the model bounding box = the maximum vertex of the bounding box - and the minimum vertex;

[0142] The diameter of the enclosing sphere = 2*the radius of the enclosing sphere;

[0143] The ratio of the difference = (1-(the distance between the horizontal axis and the vertical axis / the radius of the enclosing sphere)) / 2;

[0144] The 2D texture coordinates of the billboard model mesh = {{offset value of the horizontal and vertical axes, 1-vertical lower offset value}, {1-horizontal and vertical offset value, 1-vertical lower offset value}, {horizontal and vertical offset value, 1-vertical upper offset value}, {1-horizontal and vertical offset value, vertical lower offset value}}. The baking process records the self-occlusion shadow information encoded by the basis, normal and spherical harmonics of the model in eight directions. Run according to the angle between the model orientation and the camera orientation, and select a direction of the baked map for display. The calculation process when the billboard is displayed in the game is as follows: Figure 4 As shown, Figure 4 : is a flow chart of a method for rendering a vegetation model according to an embodiment of the present invention. The rendering process may include:

[0145] Step S404: Calculate the location information of the vegetation model.

[0146] In the technical solution provided in the above step S404 of the present invention, the billboard model is always facing the direction of the camera. First, the direction vector from the vegetation model to the camera is calculated, and the direction vector of the horizontal axis is calculated based on the model's vertical (Y) axis and the calculated vertical axis of the model's local space, and finally the model's position information is calculated.

[0147] Optionally, the vector from the model position to the camera position = the camera position - the model position.

[0148] Calculating the model position information, that is, calculating the horizontal axis, vertical axis and vertical axis of the billboard model, can include: obtaining the position of the camera and the model. The difference between the two is the vector from the model position to the camera position; ignoring the vertical axis component, only considering the horizontal direction, and calculating the horizontal axis through the cross product according to the vertical axis and the vertical axis; calculating the position of the model in the world coordinate system, and calculating the position of the model vertex; scaling calculation. Optionally, the following formula can be used to calculate the position of the model in the world coordinate system: the position of the model in the world coordinate system = the position of the model's horizontal axis vertex + the position of the model's vertical axis vertex + the position of the model's vertical axis vertex. Optionally, when calculating, the position of the billboard model is always made to face the camera direction.

[0149] Step S406: Select one of the baking results for display according to the orientation angle of the vegetation model.

[0150] In the technical solution provided in the above step S406 of the present invention, the angle is calculated according to the current direction and the camera direction, and then a baking result is selected from the eight baking directions for display according to the angle.

[0151] Calculating the angle according to the current orientation and the camera orientation may include: calculating the orientation from the model to the camera; ignoring the longitudinal axis component and taking only the horizontal and vertical axis directions; calculating the angle; calculating the angle within the range of 0 to 360; and calculating the speed of rendering the image.

[0152] This application brings the following beneficial effects: performance improvement. By baking the information in eight directions of the vegetation model, it is used as the last level entity of the vegetation model. Since the mesh of the billboard used to display the baked information has only four vertices and two triangles, when it is used to replace the model, the number of faces of the vegetation in the scene can be greatly reduced, improving performance; effect improvement. The baking logic of normals and shadows is added. Even if the billboard model has only two triangles, it can participate in the lighting calculation; the self-shadow information encoded by the spherical harmonic function is used to restore the shadow, without the overhead of rendering the shadow, and the effect of approximate shadow rendering can be obtained; the information in eight directions is baked at the same time, and the most appropriate direction is selected according to the current viewing angle at runtime, which can effectively avoid the problem of goofing when the entity switches; after ensuring the display effect, the display distance of the billboard can be appropriately shortened to further reduce the overhead on the mobile platform; the efficiency improvement includes: the baking process does not require the participation of artists, and there is no need for artists to make other additional information maps separately. Information such as shadows is calculated through the ray tracing solution and encoded in the spherical harmonic function, and there is no need for artists to make additional information maps such as ambient occlusion.

[0153] A novel billboard baking method provided by an embodiment of the present invention includes: calculating self-occlusion shadow information; calculating the position and orientation of the camera during baking to prevent the shift problem when the baked model is displayed; initializing the baking rendering pipeline and the size of the rendering object in the rendering pipeline, and loading the vegetation model to be baked; performing baking, supersampling, noise processing and edge expansion processing; moving the position to the next baking point, continuing the baking process until the baking is completed, and outputting the baking result map; generating billboard mesh vertex information and billboard mesh two-dimensional texture coordinate information, combining the baked normal map and the real-time shadow information map, performing real-time lighting calculation, and using the real-time shadow information obtained by baking to perform shadow calculation to ensure the rendering effect of vegetation, thereby solving the problem that the existing billboard technology cannot perform shadow calculation and leads to poor display effect, and the billboard has only four vertices and two faces. The use of the billboard can solve the technical problem of low vegetation rendering efficiency on mobile platforms.

[0154] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0155] In the present embodiment, an information processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the terms "unit" and "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0156] Figure 5 is a schematic diagram of an information processing device according to an embodiment of the present invention. Figure 5 As shown, the device includes: an acquisition unit 501, a baking unit 502, a selection unit 503 and a conversion unit 504.

[0157] The acquisition unit 501 is used to obtain a set of baking information corresponding to the vegetation model to be baked from each target orientation of multiple target orientations, and obtain multiple sets of baking information, wherein each set of baking information includes shadow information of the vegetation model at a corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation.

[0158] The baking unit 502 is used to bake the vegetation model based on the multiple sets of baking information to obtain multiple baking results, wherein the multiple baking results correspond to the multiple sets of baking information one by one.

[0159] The selection unit 503 is used to select a target baking result from multiple baking results based on a first current orientation of the vegetation model in the virtual scene.

[0160] The conversion unit 504 is used to convert the target baking result into a target image of the vegetation model, wherein the target image includes a shadow image corresponding to the first current orientation.

[0161] Optionally, the device further includes: a first determining unit, configured to determine shadow information based on a plurality of vertices of the vegetation model.

[0162] Optionally, the first determination unit includes: a first determination module, used to determine shadow information based on the vertices of the vegetation model, including: obtaining a set of rays starting from each vertex to obtain multiple groups of rays, wherein the multiple groups of rays correspond one-to-one to multiple vertices; an acquisition module, used to obtain intersection information between the multiple groups of rays; and a second determination module, used to determine shadow information based on the intersection information.

[0163] Optionally, the baking unit 502 includes: a baking module, configured to bake the vegetation model based on a set of baking information to obtain a target baking map, wherein the baking result includes the target baking map.

[0164] Optionally, the baking module includes: a first sub-baking module, used to bake the vegetation model based on color information to obtain a first map; a second sub-baking module, used to bake the vegetation model based on normal information to obtain a second map; a third sub-baking module, used to bake the vegetation model based on the encoding result of shadow information to obtain a third map, wherein the target baking map includes the first map, the second map and the third map.

[0165] Optionally, the third sub-baking module is used to bake the vegetation model based on the encoding result of the shadow information to obtain a third map through the following steps: interpolating the encoding result to obtain an interpolation result; baking the vegetation model based on the interpolation result to obtain a third map.

[0166] Optionally, the second sub-baking module is used to bake the vegetation model based on the normal information through the following steps to obtain a second map: convert the normal information from the local space of the vegetation model to the world space of the vegetation model, and bake the vegetation model based on the normal information in the local space to obtain a second map.

[0167] Optionally, the conversion unit 504 includes: a processing module, configured to render and display the first map and the second map respectively, and generate a shadow image from the encoding result of the shadow information in the third map to obtain a target image.

[0168] Optionally, the baking module includes: a baking submodule, used to bake the vegetation model based on a set of baking information to obtain an original baking image; a sampling submodule, used to supersample the original baking image to obtain a target baking image, wherein the size of the target baking image is smaller than the size of the original baking image.

[0169] Optionally, the sampling submodule is used to supersample the original baking map through the following steps to obtain a target baking map: supersample the original baking map, and expand the edge of the sampled original baking map to obtain a target baking map.

[0170] Optionally, the device further includes: a first acquisition unit, used to acquire the enclosing sphere of the vegetation model; a first division unit, used to divide the spherical surface of the enclosing sphere into a plurality of sub-spherical surfaces; and a second determination unit, used to determine the orientation corresponding to each sub-spherical surface as a target orientation.

[0171] Optionally, the acquisition unit 501 includes: an acquisition module, configured to acquire a set of baking information based on a virtual camera at each target orientation to obtain multiple sets of baking information, wherein the orientation of the virtual camera points to the center of the vegetation model.

[0172] Optionally, the selection unit 503 includes: a first acquisition module, used to obtain the angle between the first current orientation and the second current orientation, wherein the second current orientation is the orientation of the virtual camera currently facing the virtual scene; and a selection module, used to select a target baking result from multiple baking results based on the angle.

[0173] Optionally, the device also includes: a third determination unit, used to determine the grid information of the billboard model based on the size of the vegetation model; a generation unit, used to generate the billboard model based on the grid information of the billboard model; and a display unit, used to display the target baking result based on the billboard model.

[0174] Optionally, the conversion unit 504 includes: a first processing module, configured to perform lighting processing on the billboard model displaying the target baking result to obtain a target image.

[0175] Optionally, the third determination unit includes: a third determination module, configured to determine mesh vertex information and mesh texture information of the billboard model based on a bounding box and a bounding sphere of the vegetation model.

[0176] Optionally, the number of target locations is eight.

[0177] In the information processing device of this embodiment, an acquisition unit acquires a set of baking information corresponding to the vegetation model to be baked from each of the multiple target orientations to obtain multiple sets of baking information. The baking unit bakes the vegetation model based on the multiple sets of baking information to obtain multiple baking results. The selection unit selects the target baking result from the multiple baking results based on the first current orientation of the vegetation model in the virtual scene. The conversion unit converts the target baking result into a target image of the vegetation model, thereby solving the problem that the existing billboard technology cannot perform shadow calculations resulting in poor display effects, thereby achieving the technical effect of improving the efficiency of vegetation model processing and solving the technical problem of low efficiency in vegetation model processing.

[0178] It should be noted that the above-mentioned units and modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to this: the above-mentioned units and modules are all located in the same processor; or, the above-mentioned units and modules are located in different processors in any combination.

[0179] An embodiment of the present invention further provides a non-volatile storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0180] Optionally, in this embodiment, the non-volatile storage medium may be configured to store a computer program for performing the following steps:

[0181] S1, respectively acquiring a set of baking information corresponding to the vegetation model to be baked from each of the multiple target orientations, to obtain multiple sets of baking information, wherein each set of baking information includes shadow information of the vegetation model at the corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation;

[0182] S2, baking the vegetation model based on the multiple sets of baking information respectively to obtain multiple baking results, wherein the multiple baking results correspond to the multiple sets of baking information one by one;

[0183] S3, selecting a target baking result from a plurality of baking results based on a first current orientation of the vegetation model in the virtual scene;

[0184] S4, converting the target baking result into a target image of the vegetation model, wherein the target image includes a shadow image corresponding to the first current orientation.

[0185] Optionally, in this embodiment, the above-mentioned non-volatile storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0186] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0187] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0188] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0189] S1, respectively acquiring a set of baking information corresponding to the vegetation model to be baked from each of the multiple target orientations, to obtain multiple sets of baking information, wherein each set of baking information includes shadow information of the vegetation model at the corresponding target orientation, and the shadow information is used to generate a shadow image at the corresponding target orientation;

[0190] S2, baking the vegetation model based on the multiple sets of baking information respectively to obtain multiple baking results, wherein the multiple baking results correspond to the multiple sets of baking information one by one;

[0191] S3, selecting a target baking result from a plurality of baking results based on a first current orientation of the vegetation model in the virtual scene;

[0192] S4, converting the target baking result into a target image of the vegetation model, wherein the target image includes a shadow image corresponding to the first current orientation.

[0193] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0194] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0195] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0196] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0197] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0198] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0199] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0200] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. An information processing method, characterized in that: include: Acquire a set of baking information corresponding to the vegetation model to be baked from each of the multiple target positions, respectively, to obtain multiple sets of baking information, wherein each set of the baking information includes shadow information of the vegetation model at the corresponding target position, and the shadow information is self-occlusion shadow information corresponding to the self-occlusion problem generated by the vegetation model, and is used to generate a shadow image at the corresponding target position; Baking the vegetation model based on the multiple sets of baking information respectively to obtain multiple baking results, wherein the multiple baking results correspond to the multiple sets of baking information one by one; Selecting a target baking result from the plurality of baking results based on a first current orientation of the vegetation model in the virtual scene; Converting the target baking result into a target image of the vegetation model, wherein the target image includes the shadow image corresponding to the first current orientation; The step of converting the target baking result into the target image of the vegetation model includes: performing rendering and self-shadow lighting calculation on the vegetation model based on the target baking result to convert the target baking result into the target image.

2. The method according to claim 1, characterized in that The method further comprises: The shadow information is determined based on a plurality of vertices of the vegetation model.

3. The method according to claim 2, characterized in that Determining the shadow information based on the vertices of the vegetation model includes: Acquire a group of rays starting from each of the vertices to obtain multiple groups of rays, wherein the multiple groups of rays correspond one-to-one to the multiple vertices; Obtaining intersection information between the multiple groups of rays; The shadow information is determined based on the intersection information.

4. The method according to claim 1, characterized in that The vegetation model is baked based on the multiple sets of baking information respectively to obtain multiple baking results, including: The vegetation model is baked based on a set of the baking information to obtain a target baking map, wherein the baking result includes the target baking map.

5. The method according to claim 4, characterized in that The baking information includes an encoding result of the shadow information of the vegetation model at a corresponding target position, color information of the vegetation model at a corresponding target position, and normal information of the vegetation model at a corresponding target position. Baking the vegetation model based on a set of the baking information to obtain a target baking map includes: The vegetation model is baked based on the color information to obtain a first map, the vegetation model is baked based on the normal information to obtain a second map, and the vegetation model is baked based on the encoding result of the shadow information to obtain a third map, wherein the target baked map includes the first map, the second map and the third map.

6. The method according to claim 5, characterized in that Baking the vegetation model based on the encoding result of the shadow information to obtain a third map includes: Performing interpolation processing on the encoding result to obtain an interpolation result; The vegetation model is baked based on the interpolation result to obtain the third map.

7. The method according to claim 5, characterized in that Baking the vegetation model based on the normal information to obtain a second map includes: Converting the normal information from the local space of the vegetation model to the world space of the vegetation model; The vegetation model is baked based on the normal information of the local space to obtain the second map.

8. The method according to claim 5, characterized in that Rendering and self-shadowing illumination calculation are performed on the vegetation model based on the target baking result to convert the target baking result into the target image, including: Rendering and displaying the first map and the second map respectively, and generating the shadow image by encoding the shadow information in the third map; Perform self-shadow illumination calculation on the shadow image to obtain the target image.

9. The method according to claim 4, characterized in that Baking the vegetation model based on a set of the baking information to obtain a target baking graph includes: Baking the vegetation model based on a set of the baking information to obtain an original baking image; The original baking map is supersampled to obtain the target baking map, wherein a size of the target baking map is smaller than a size of the original baking map.

10. The method according to claim 9, characterized in that Supersampling the original baking map to obtain the target baking map includes: The original baking image is super-sampled, and the sampled original baking image is expanded to obtain the target baking image.

11. The method according to claim 1, characterized in that: The method further comprises: Obtaining a bounding sphere of the vegetation model; Divide the spherical surface of the enclosing sphere into a plurality of sub-spherical surfaces; The orientation corresponding to each of the sub-spherical surfaces is determined as the target orientation.

12. The method according to claim 1, characterized in that A set of baking information corresponding to the vegetation model to be baked is obtained from each of the multiple target positions, respectively, to obtain multiple sets of baking information, including: A set of the baking information is acquired based on a virtual camera at each of the target positions to obtain the multiple sets of baking information, wherein the virtual camera is oriented toward the center of the vegetation model.

13. The method according to claim 12, characterized in that Selecting a target baking result from the plurality of baking results based on a first current orientation of the vegetation model in the virtual scene includes: Obtaining an angle between the first current orientation and a second current orientation, wherein the second current orientation is an orientation of the virtual camera currently facing the virtual scene; The target baking result is selected from the plurality of baking results based on the included angle.

14. The method according to any one of claims 1 to 13, characterized in that The method further comprises: Determining grid information of a billboard model based on a size of the vegetation model; generating the billboard model based on the grid information of the billboard model; The target baking result is displayed based on the billboard model.

15. The method according to claim 14, characterized in that Converting the target baking result into a target image of the vegetation model includes: Performing lighting processing on the billboard model displaying the target baking result to obtain the target image.

16. The method according to claim 14, characterized in that Determining grid information of the billboard model based on the size of the vegetation model includes: Based on the bounding box and the bounding sphere of the vegetation model, the mesh vertex information and the mesh texture information of the billboard model are determined.

17. The method according to any one of claims 1 to 13, characterized in that The number of the target positions is eight.

18. An information processing device, characterized in that: include: An acquisition unit is used to acquire a set of baking information corresponding to the vegetation model to be baked from each target orientation of the multiple target orientations, respectively, to obtain multiple sets of baking information, wherein each set of the baking information includes shadow information of the vegetation model at a corresponding target orientation, and the shadow information is self-occlusion shadow information corresponding to the self-occlusion problem generated by the vegetation model, and is used to generate a shadow image at the corresponding target orientation; a baking unit, configured to bake the vegetation model based on the multiple sets of baking information respectively to obtain multiple baking results, wherein the multiple baking results correspond to the multiple sets of baking information one by one; A selection unit, configured to select a target baking result from the plurality of baking results based on a first current orientation of the vegetation model in the virtual scene; a conversion unit, configured to convert the target baking result into a target image of the vegetation model, wherein the target image includes the shadow image corresponding to the first current orientation; The conversion unit is used to execute the following steps to obtain the target image: based on the target baking result, the vegetation model is rendered and self-shadow illumination is calculated to convert the target baking result into the target image.

19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 17 when executed by a processor.

20. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method described in any one of claims 1 to 17.

Citation Information

Patent Citations

  • Method and device for processing normal map, storage medium, processor and terminal

    CN108447111A

  • Virtual model rendering method and device

    CN114067043A