Virtual scene rendering method and device, storage medium and electronic device

CN115526976BActive Publication Date: 2026-09-22NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211211116.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2026-09-22
Estimated Expiration
2042-09-30

AI Technical Summary

Benefits of technology

上述虚拟场景渲染方法,通过从预先烘焙渲染得到的贴图资源库中选择与当前虚拟场景中虚拟对象对应的预处理贴图;确定预处理贴图对应的初始光照信息;基于当前虚拟场景中的当前光照信息与初始光照信息对预处理贴图进行光照渲染,得到目标贴图。该方法预先对虚拟场景中虚拟对象进行预先烘焙渲染以构建贴图资源库,在对当前虚拟场景的虚拟对象进行渲染时,仅需在贴图资源库中快速获取与虚拟对象对应的贴图,并结合当前虚拟场景中的当前光照信息实时计算出渲染后的虚拟场景。该方法避免传统方法中需要制作更多的颜色查找表,并在实时渲染时从颜色查找表查询与当前虚拟场景的光照方向相适配的颜色所导致的对虚拟场景的渲染效率低的技术问题,进而实现了提高虚拟场景渲染效率的技术效果。同时,该方法避免制作更多的颜色查找表导致的渲染性能消耗增加的技术问题,从而降低了性能消耗的技术效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115526976B_ABST
    Figure CN115526976B_ABST
Patent Text Reader

Abstract

The present disclosure provides a virtual scene rendering method, a virtual scene rendering device, a computer storage medium and an electronic device, and relates to the technical field of computer graphics. The virtual scene rendering method comprises: selecting a preprocessed map corresponding to a virtual object in a current virtual scene from a map resource library obtained by pre-baking rendering; determining initial illumination information corresponding to the preprocessed map; performing illumination rendering on the preprocessed map based on current illumination information in the current virtual scene and the initial illumination information to obtain a target map. The present disclosure can achieve the technical effect of improving the rendering efficiency of the virtual scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer graphics technology, and in particular to a virtual scene rendering method, a virtual scene rendering device, a computer storage medium, and an electronic device. Background Technology

[0002] With the rapid development of game technology, the creation of virtual game scenes has become increasingly sophisticated. To provide players with a realistic gaming experience, virtual scene rendering technology is typically used to optimize virtual scenes. For example, rendering technology can be used to make the clouds in the sky of a virtual scene change with the weather and the time of day.

[0003] Currently, the sky and clouds are usually pre-made and composited onto a sky sphere texture, and then the colors of the sky and clouds are responded to by a color lookup table pre-made by the artists in response to the color changes of the sky and clouds during the day and night.

[0004] However, for virtual scenes with complex lighting changes, the above method requires creating more color lookup tables to look up colors that match the current lighting direction of the virtual scene during real-time rendering, resulting in low rendering efficiency for the virtual scene. Summary of the Invention

[0005] This disclosure provides a virtual scene rendering method, a virtual scene rendering device, a computer storage medium, and an electronic device, thereby improving the rendering efficiency of virtual scenes.

[0006] In a first aspect, one embodiment of this disclosure provides a virtual scene rendering method, which involves selecting a pre-processed texture corresponding to a virtual object in the current virtual scene from a texture resource library obtained by pre-baking rendering; determining the initial lighting information corresponding to the pre-processed texture; and performing lighting rendering on the pre-processed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain a target texture.

[0007] Secondly, one embodiment of this disclosure provides a virtual scene rendering apparatus, which includes: a texture selection module for selecting a preprocessed texture corresponding to a virtual object in the current virtual scene from a texture resource library obtained by pre-baked rendering; an information determination module for determining the initial lighting information corresponding to the preprocessed texture; and a lighting rendering module for performing lighting rendering on the preprocessed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain a target texture.

[0008] Thirdly, one embodiment of this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the virtual scene rendering method described above.

[0009] Fourthly, one embodiment of this disclosure provides an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the virtual scene rendering method described above by executing the executable instructions.

[0010] The technical solution disclosed herein has the following beneficial effects: The aforementioned virtual scene rendering method selects a pre-processed texture corresponding to a virtual object in the current virtual scene from a pre-baked texture resource library; determines the initial lighting information corresponding to the pre-processed texture; and performs lighting rendering on the pre-processed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain the target texture. This method pre-baks and renders virtual objects in the virtual scene to build a texture resource library. When rendering virtual objects in the current virtual scene, it only needs to quickly retrieve the texture corresponding to the virtual object from the texture resource library and calculate the rendered virtual scene in real time by combining it with the current lighting information in the current virtual scene. This method avoids the technical problem of low rendering efficiency caused by the need to create more color lookup tables and look up colors that match the lighting direction of the current virtual scene during real-time rendering, thus improving the rendering efficiency of virtual scenes. At the same time, this method avoids the technical problem of increased rendering performance consumption caused by creating more color lookup tables, thereby reducing performance consumption.

[0011] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0012] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0013] Figure 1 This schematic diagram illustrates a cloud rendering process in the form of a static texture in this exemplary embodiment. Figure 2 This schematic diagram illustrates the architecture of a virtual scene rendering system in this exemplary embodiment. Figure 3 This schematically illustrates a flowchart of a virtual scene rendering method in this exemplary embodiment; Figure 4 This schematic diagram illustrates an initial target voxel model of a cloud in this exemplary embodiment. Figure 5 This schematic diagram illustrates a target voxel model in this exemplary embodiment. Figure 6 This schematic diagram illustrates multiple initial textures under different lighting directions in this exemplary embodiment. Figure 7 This schematically illustrates a flowchart of a method for constructing an intermediate texture map in this exemplary embodiment; Figure 8 This illustration schematically shows a diagram of an intermediate texture in this exemplary embodiment; Figure 9 This illustration schematically shows a diagram of a texture resource library in this exemplary embodiment; Figure 10 This illustration schematically shows a diagram of determining UV information for a preprocessed texture in this exemplary embodiment. Figure 11 This schematically illustrates a process of perturbing the UV information of a preprocessed texture using a noise map in this exemplary embodiment. Figure 12 This illustration schematically shows a target texture diagram under current lighting information in this exemplary embodiment; Figure 13 This schematically illustrates a target texture diagram under another current lighting information in this exemplary embodiment; Figure 14 This illustration schematically shows a masking mapping diagram in this exemplary embodiment; Figure 15 This schematically illustrates a target texture diagram of a scattering effect in this exemplary embodiment; Figure 16 This schematic diagram illustrates a virtual scene rendering under sunlight in this exemplary embodiment. Figure 17 This schematic diagram illustrates a virtual scene rendering under moonlight in this exemplary embodiment. Figure 18 This schematic diagram illustrates the structure of a virtual scene rendering device in this exemplary embodiment. Figure 19 This schematic diagram illustrates another virtual scene rendering device structure in this exemplary embodiment; Figure 20 The schematic diagram illustrates the structure of an electronic device in this exemplary embodiment. Detailed Implementation

[0014] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0015] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0016] The flowchart shown in the attached diagram is merely an illustrative example and does not necessarily include all steps. For example, some steps may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0017] In existing technologies, with the rapid development of game technology, the creation of virtual game scenes has become increasingly sophisticated. To provide players with a realistic gaming experience, virtual scene rendering technology is typically used to optimize virtual scenes. For example, rendering technology can be used to make the clouds in the sky of a virtual scene change with the weather and day / night cycles. Currently, the sky and clouds are usually pre-made and composited onto a sky sphere texture, and then a pre-made color lookup table is used by artists to respond to the color changes of the sky and clouds during day and night. However, for virtual scenes with complex lighting changes, the above method requires the creation of more color lookup tables to look up colors that match the current lighting direction of the virtual scene during real-time rendering, resulting in low rendering efficiency for virtual scenes.

[0018] Therefore, this disclosure provides a virtual scene rendering method to improve the rendering efficiency of virtual scenes. To facilitate a better understanding of the technical solutions of this disclosure by those skilled in the art, the relevant content involved in the technical solutions of this disclosure will be described below.

[0019] (1) UV: A type of information describing the position coordinates of a two-dimensional image projected onto a three-dimensional model.

[0020] (2) Voxel model: also known as volume pixel model, it uses an ordered combination of a large number of regular voxels (such as cubes) to represent a three-dimensional object model. It is often used to describe the Signed Distance Field (SDF) model or objects containing volume information (e.g., density).

[0021] (3) Baking: refers to storing information of fixed, static visual effects using specific technical means, and restoring the data and presenting the effect before baking through specific algorithms during game operation.

[0022] (4) Houdini: A procedural 3D software commonly used for movie special effects production.

[0023] (5) Shader: A general term for programming languages ​​used to create material effects.

[0024] (6) Material: A data structure in a game engine that describes the appearance of an object according to certain rules.

[0025] (7) Interpolation: The intermediate value is obtained by calculating two discrete values ​​through a certain algorithm.

[0026] The virtual scene rendering method provided by the exemplary embodiments of this disclosure can be applied to application scenarios that render virtual objects in game scenes. For example, game scenes typically contain dynamic virtual objects, such as the day-night changes of clouds in the sky, flowing water, swaying tree branches, etc. Taking clouds in the sky as an example, due to the refraction and scattering of sunlight by clouds, they gradually exhibit different shapes and colors over time.

[0027] To simulate the effects of real-world scenes in virtual environments, developers typically render virtual objects within the game engine. This allows players to experience the dynamic transformations of virtual objects in a real-world setting, thereby enhancing their gaming experience.

[0028] It should be understood that when rendering virtual scenes in a game environment, any game engine can be used to process virtual objects. This disclosure does not impose any restrictions on the game engine used; any game engine capable of implementing virtual scene rendering methods is within the scope of this disclosure.

[0029] In existing mobile game scene rendering, the rendering of sky clouds is often done for the purpose of optimizing game performance. Static textures are usually used in the game scene, and a color lookup table pre-made by the artists is used to apply the colors of the corresponding clouds during the 24-hour change to the static textures to adapt to the cloud rendering effect under the day and night change.

[0030] Figure 1 This diagram schematically illustrates a cloud rendering process in the form of a static texture in this exemplary embodiment. (Reference) Figure 1 , Figure 1 (a) in the image is a panoramic high-dynamic range image (HDRI) taken in a real-world scene. Figure 1 (b) in the text is a pair Figure 1 The hemispherical image generated after hemispherical UV projection of the image shown in (a) is shown in the figure; Figure 1 (c) in the image shows the rendering effect of the cloud layer.

[0031] For example, will Figure 1 The pre-captured 2D image shown in (a) is used as a static texture for the virtual scene, specifically a panoramic HDRI. This static texture is then used for hemispherical UV projection to obtain a 3D model of the sky within the virtual scene. The colors corresponding to the clouds during the 24-hour change are applied to this static texture, thus providing a more realistic representation of the sky in the static scene (e.g., ...). Figure 1 (as shown in (c)).

[0032] The above approach achieves good custom art effects without altering the game scene, making it well-suited for static virtual scenes. However, for more complex virtual scenes, more color lookup tables are needed to adapt to the changing virtual scene, increasing rendering performance overhead. For example, in a virtual scene of the sky and clouds, to make the sky and clouds respond to 24-hour changes in lighting conditions and environments, it's necessary to collect data on sky and cloud changes under different environments (e.g., lighting) and create more color lookup tables for matching. Furthermore, during art production, it's impossible to view cloud rendering effects in real-time, making it difficult to adapt to the current game scene's lighting. This necessitates repeated modifications to color lookup tables and adjustments to game scene lighting, resulting in low rendering efficiency for virtual scenes and increased user complexity.

[0033] This exemplary embodiment addresses the aforementioned problems and proposes a virtual scene rendering method. This method pre-bakes and renders voxel models of virtual objects in different virtual scenes to obtain a texture resource library for the virtual scene. When adjusting the rendering effect of the game scene, it is only necessary to select a pre-processed texture corresponding to the virtual object in the current virtual scene from the texture resource library; determine the initial lighting information corresponding to the pre-processed texture; and finally calculate the rendering effect of the virtual scene in real time based on the direct light direction in the current game scene and the determined initial lighting information, thereby better adapting to the needs of dynamically changing game scenes that operate 24 hours a day. Furthermore, users can view the rendering effect in real time, reducing the complexity of user operations.

[0034] In the virtual scene rendering method disclosed herein, the texture resource library of the virtual scene is pre-baked and rendered, eliminating the need for repeated baking and rendering of texture resources during real-time rendering of virtual objects using a game engine. Therefore, the performance consumption of real-time rendering by the engine is low. Furthermore, this virtual scene rendering method can calculate the rendering effect of clouds in real-time based on the current lighting information (e.g., current lighting direction) and initial lighting information of the current game scene. This avoids the process of repeatedly modifying color lookup tables and adjusting game scene lighting to adapt to the lighting information of the current game scene, which is a traditional technique. This virtual scene rendering method can improve the rendering efficiency of virtual scenes.

[0035] Figure 2 An architecture diagram of a virtual scene rendering system provided in an exemplary embodiment of this disclosure is shown below. Figure 2 As shown, the virtual scene rendering system 200 includes a game server 201 and multiple clients 203. The server 201 is configured with a database 202.

[0036] The database 202 stores a library of pre-baked and rendered texture resources. The game server 201 selects a pre-processed texture from this library that corresponds to a virtual object in the current virtual scene. Then, the game server 201 determines the initial lighting information corresponding to the pre-processed texture; finally, it performs lighting rendering on the pre-processed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain the target texture. Multiple clients 203 establish connections with the game server to start the game process, thereby viewing the target texture, i.e., the rendered image of the virtual scene, in real time within the game scene.

[0037] It should be noted that game server 201 contains a game engine, and game server 201 can be a single server or a server cluster composed of multiple servers.

[0038] It should be understood that, in Figure 2In the architecture diagram of the virtual scene rendering system shown, the number of game server 201, database 202, and client 203 is merely exemplary; more or fewer numbers are within the scope of protection of this application. Furthermore, in the above example running scenario, client 203 can be a personal computer, server, PDA, laptop, or any other computing device with network connectivity. The network for communication between game server 201 and client 203 can include various types of wired and wireless networks.

[0039] After understanding the architecture diagram of the virtual scene rendering system disclosed herein, we will combine it with Figure 3 The scheme of the virtual scene rendering method disclosed herein is described in detail.

[0040] The following explanation uses the aforementioned game server 201 as the execution subject, and illustrates the application of this virtual scene rendering method to game server 201. (See also...) Figure 3 The virtual scene rendering method provided by the exemplary embodiments of this disclosure includes the following steps S301-S303.

[0041] Step S301: Select a preprocessed texture from the texture resource library obtained from pre-baked rendering that corresponds to the virtual object in the current virtual scene.

[0042] The texture resource library contains multiple texture resources generated through baking and rendering operations on various forms (voxel models) of virtual objects in the virtual scene. Currently, the virtual objects in the virtual scene are mainly virtual objects that change over time, such as clouds in the sky and flowing water.

[0043] For example, textures of virtual objects in a virtual scene can be pre-created, rendered, and exported in Houdini software.

[0044] Step S302: Determine the initial lighting information corresponding to the preprocessed texture.

[0045] The initial lighting information refers to the virtual object information under different pre-defined lighting data (such as the direction, intensity, and color of the light). For example, if left-direction lighting is added to the voxel model of a cloud, then the pixel values ​​corresponding to the voxel model under left-direction lighting are determined as the initial lighting information.

[0046] Step S303: Perform lighting rendering on the preprocessed texture based on the current lighting information and initial lighting information in the current virtual scene to obtain the target texture.

[0047] The current illumination information may include information such as the direction, intensity, and color of the current illumination.

[0048] In some embodiments of this disclosure, the technical solutions involve selecting a pre-processed texture corresponding to a virtual object in the current virtual scene from a pre-baked and rendered texture resource library; determining the initial lighting information corresponding to the pre-processed texture; and performing lighting rendering on the pre-processed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain the target texture. This method pre-baks and renders the virtual objects in the virtual scene to build a texture resource library. When rendering the virtual objects in the current virtual scene, it only needs to quickly obtain the texture corresponding to the virtual object from the texture resource library and calculate the rendered virtual scene in real time by combining it with the current lighting information in the current virtual scene. This method avoids the technical problem of low rendering efficiency caused by the need to create more color lookup tables and look up colors that match the lighting direction of the current virtual scene during real-time rendering, thus improving the rendering efficiency of the virtual scene. Simultaneously, this method avoids the technical problem of increased rendering performance consumption caused by creating more color lookup tables, thereby reducing performance consumption.

[0049] Virtual objects in a virtual scene can be any object capable of dynamic effects. To illustrate the virtual scene rendering provided in this disclosure, clouds will be used as an example for explanation. First, before implementing step S301 above, the clouds can be pre-baked to obtain textures for each voxel model, thereby constructing a texture resource library for the clouds.

[0050] In an exemplary embodiment of this disclosure, the initial voxel model is subjected to noise permutation processing to obtain an intermediate voxel model; the intermediate voxel model is subjected to noise scrambling processing to obtain the initial target voxel model.

[0051] The initial voxel model serves as the basic shape for virtual objects in the virtual scene, such as the basic shape of a cloud. This basic shape sets the foundation for subsequent cloud shapes. The basic shape of virtual objects in the virtual scene can be a randomly generated model or a custom model provided by the artist. Noise scrambling can be achieved by adding noise to intermediate voxel models, causing their shapes to change.

[0052] For example, after subdividing the initial voxel model of the cloud, noise replacement processing is performed, and then noise scrambling processing is added to scramble the voxel model of the cloud.

[0053] Figure 4 This schematically illustrates an initial target voxel model of a cloud in this exemplary embodiment. Figure 4As shown, the basic shape of a cloud can be composed of multiple basic graphic shapes (circles, ellipses, etc.), which are then converted into corresponding three-dimensional shapes and subjected to noise replacement and noise scrambling to form the initial target voxel model of the cloud.

[0054] By using noise replacement and noise scrambling on the initial voxel model, the cloud model can be made closer to the effect of real clouds, thereby improving the realism and lifelikeness of the rendered virtual scene.

[0055] In an exemplary embodiment of this disclosure, the initial target voxel model is normalized to obtain the target voxel model.

[0056] Normalizing the initial target voxel model involves normalizing the coordinates of the initial target voxel model.

[0057] For example, the volume density of the obtained initial target voxel model is uniformly distributed. However, in real-world scenarios, clouds are subject to gravity, and their volume density typically increases from top to bottom. To simulate realistic clouds in a virtual scene, the coordinates of the initial target voxel model can be normalized to ensure the height of the initial target voxel model is consistent with the actual height. Within the range of 0 to 1, a volume density distribution similar to that of clouds in a real-world scenario is obtained.

[0058] Figure 5 The diagram illustrates a target voxel model in this exemplary embodiment. Figure 5 shows the target voxel model obtained after normalizing the initial target voxel model.

[0059] The initial target voxel model coordinates of the cloud can be normalized according to the following formula (1): (1) In formula (1), The volume density distribution is used to normalize the coordinates of the initial target voxel model. The volume density distribution of the initial target voxel model. The height information of the initial target voxel model. The thickness of the initial target voxel model used to determine the cloud.

[0060] By default The value is 2. This can be increased when developers believe the initial target voxel model of the current cloud is too thin. The numerical value; conversely, when developers believe the initial target voxel model of the current cloud is too thick, they can reduce it. The value.

[0061] By normalizing the initial target voxel model of virtual objects in the virtual scene, the volume density distribution effect of clouds in the real sky can be simulated, thereby improving the realism and lifelikeness of the clouds in the rendered virtual scene.

[0062] To enhance the richness of sky clouds, when building the cloud texture resource library, multiple target voxel models of different shapes can be built simultaneously for pre-baking rendering.

[0063] The following section will provide a detailed explanation of the process of baking and rendering multiple voxel models of virtual objects to obtain a texture resource library.

[0064] In an exemplary embodiment of this disclosure, for multiple target voxel models of a virtual object, image rendering is performed on each target voxel model under different lighting directions to obtain multiple initial textures; intermediate textures of each target voxel model are constructed based on the multiple initial textures; and a texture resource library is constructed based on each intermediate texture.

[0065] For example, for each target voxel model of the virtual object, image rendering is performed on each target voxel model under different lighting directions.

[0066] It should be understood that for each target voxel model of a virtual object, image rendering can be performed on each target voxel model under any lighting direction.

[0067] According to some embodiments of this disclosure, direct lighting in four directions—left, right, up, and back—can be simulated, and then the target voxel model of the virtual object can be illuminated by the direct lighting in the four directions respectively, so as to perform image rendering on each target voxel model under the direct lighting in the four directions.

[0068] Rendering target voxel models under arbitrary lighting directions inevitably increases the performance consumption of the game server. According to some embodiments of this disclosure, since the target voxel models of clouds are irregular, the correlation between target voxel models under left- and right-direct lighting is low. Therefore, image rendering can be performed on target voxel models under direct left- and right-direct lighting respectively. However, the correlation between target voxel models under upward and downward lighting is high, so image rendering can be performed on target voxel models under either upward or downward direct lighting. The correlation between target voxel models under forward and backward lighting is also high, and the backward target voxel model can be used to simulate the scattering effect of clouds; therefore, image rendering is performed on target voxel models under backward direct lighting.

[0069] exist Figure 5 Based on the target voxel model of the cloud shown. Figure 6These are multiple initial textures obtained after rendering images of the target voxel model under direct lighting from four directions: left, right, top, and back.

[0070] in, Figure 6 (a) in the image is the initial texture obtained after rendering the target voxel model under direct left-side lighting. Figure 6 (b) in the image is the initial texture obtained after rendering the target voxel model under direct right-side lighting. Figure 6 (c) in the image is the initial texture obtained after rendering the target voxel model under direct upward lighting; Figure 6 In the image, (d) represents the initial texture obtained after rendering the target voxel model under direct backlighting.

[0071] For example, when acquiring the initial textures under direct lighting from the four directions mentioned above, a alpha channel information texture is also obtained simultaneously. Thus, for a target voxel model of a cloud, five images can be obtained: the initial texture under direct lighting from the left, the initial texture under direct lighting from the right, the initial texture under direct lighting from the top, the initial texture under direct lighting from the back, and a alpha channel information texture.

[0072] After obtaining five initial textures, these textures can be stored in different color channels of traditional texture resources to construct intermediate textures for each target voxel model. A texture resource library is then built based on these intermediate textures.

[0073] By rendering images of multiple target voxel models of virtual objects under different lighting directions and then constructing a texture resource library, the richness of the cloud layer can be improved. Furthermore, by pre-building the resource library, when rendering virtual objects in a virtual scene, only the corresponding texture needs to be selected, eliminating the need to repeatedly re-bake the target voxel models of virtual objects under different lighting conditions, thereby reducing the real-time rendering performance consumption of the game server.

[0074] When storing the initial textures into different color channels of traditional texture resources, the traditional texture resources can only store a maximum of four color channels, i.e., RGBA. Since each target voxel model yields five initial textures, and the aforementioned transparency information textures are stored in the A transparency channel by default, it is necessary to process the four initial textures in four directions to store them into the R, G, and B color channels respectively.

[0075] The RGBA channels represent the color space of red (Red, R), green (Green, G), blue (Blue, B), and transparency (Alpha, A), respectively, and the color of each intermediate texture can be formed by superimposing the RGBA channels.

[0076] In an exemplary embodiment of this disclosure, when constructing intermediate textures for each target voxel model based on multiple initial textures, for each target voxel model, the first initial texture in the first lighting direction and the second initial texture in the second lighting direction are merged to obtain a merged texture for each target voxel model; and intermediate textures are constructed based on the initial textures and merged textures in other directions of each target voxel model except for the first and second lighting directions.

[0077] In this context, the first and second illumination directions are axially symmetric. For example, the first illumination direction could be direct light from the left, and the second illumination direction could be direct light from the right, symmetric about the x-axis of a planar coordinate system. It is understandable that a certain angular error may exist in determining the axial symmetry of the first and second illumination directions; within a preset angle threshold, they can be considered axially symmetric. This preset angle threshold can be adjusted according to actual needs.

[0078] For example, initial textures symmetrical to the lighting direction can be merged to obtain an image. Then, the initial textures in directions other than the first and second lighting directions are combined with the merged textures to construct an intermediate texture. For instance, merging the initial textures in the left and right directions results in four textures: the merged textures in the left and right lighting directions, the initial texture in the top lighting direction, the initial texture in the back direction, and the alpha channel information texture. These four textures can then be stored in the R, G, B, and A color channels respectively to construct the intermediate texture.

[0079] Selecting an initial texture that is symmetrical about the lighting direction for image merging facilitates the calculation of the merged pixel values, thereby quickly obtaining the merged texture.

[0080] In one optional embodiment of this disclosure, the combination Figure 7 , Figure 8 The process of constructing intermediate textures for each target voxel model based on multiple initial textures is explained in detail. Figure 7 This schematically illustrates a flowchart of a method for constructing an intermediate texture map in this exemplary embodiment. See also... Figure 7 This includes the following steps S701-S704: Step S701: Calculate the product of the pixel value of the first initial texture and the preset value to obtain the feature pixel value for the first initial texture.

[0081] The preset value can be set according to the actual situation. The preset value can be -1 to adjust the pixel value of the first initial texture to a certain range.

[0082] For example, each pixel value in the first initial texture in the first illumination direction can be multiplied by a preset value.

[0083] Step S702: Calculate the sum of the feature pixel value and the pixel value of the second initial texture to obtain the target pixel value; It should be understood that the number of pixel values ​​in the first initial texture is the same as the number of pixel values ​​in the second initial texture, and the pixel values ​​at corresponding positions are added together. For example, if the pixel values ​​are stored in matrix form, the pixel values ​​in the first row and first column of the first initial texture can be added together with the pixel values ​​in the first row and first column of the second initial texture.

[0084] Step S703: Obtain a merged texture based on the target pixel values ​​corresponding to each pixel unit in the first initial texture and the second initial texture; The following is a detailed explanation of the process of merging the first initial texture map of the first lighting direction with the second initial texture map of the second lighting direction, taking the first lighting direction as an example where the first lighting direction can be a direct light from the left and the second lighting direction can be a direct light from the right.

[0085] As shown in formula (2), the pixel values ​​of the first initial texture can be multiplied by -1 and added to the pixel values ​​of the second initial texture, so that the pixel values ​​of the merged texture can be remapped from -1 to 0 to 1 in order to be stored in the color channel.

[0086] (2)

[0087] In formula (2), R To merge the pixel values ​​of the texture; b These are the pixel values ​​of the first initial texture; a These are the pixel values ​​of the second initial texture.

[0088] Step S704: Construct intermediate textures based on the initial textures and merged textures in each target voxel model, except for the first and second lighting directions.

[0089] For example, the initial textures and merged textures for directions other than the first and second lighting directions can be stored in the color channels of a traditional texture resource to construct intermediate textures.

[0090] For example, the merged textures under the left and right lighting directions are written to the R channel, the initial texture under the top lighting direction is written to the G channel, the initial texture under the back lighting direction is written to the B channel, and the texture retaining the alpha channel information is written to the A channel, thus obtaining... Figure 8 The diagram shows the intermediate texture constructed.

[0091] For each virtual object's target voxel model, the pixel values ​​of the initial texture are merged into a texture, and the pixel values ​​of the merged texture are mapped to the range of 0-1 so that they can be stored in the color channel to form a texture resource library, thereby further improving the rendering efficiency of the virtual scene.

[0092] In an exemplary embodiment of this disclosure, after determining the intermediate textures of multiple target voxel models of a virtual object, the intermediate textures can be merged into a single image using an image mosaicking method. This increases the richness of virtual objects in the virtual scene while reducing the number of sampling instructions for each intermediate texture in the game engine later, thereby reducing the performance consumption of the game server.

[0093] Figure 9 This illustration schematically shows a texture resource library according to this exemplary embodiment, such as... Figure 9 As shown, the texture resource library contains 16 intermediate textures of clouds. These 16 intermediate textures are then mosaicked in a 4x4 format to obtain a pre-baked image.

[0094] It is understood that the number of intermediate textures for clouds in the texture resource library is arbitrary, and this disclosure does not impose any restrictions on this.

[0095] After building the texture resource library, you can select the pre-processed texture corresponding to the virtual object in the current virtual scene from the pre-baked and rendered texture resource library.

[0096] In an exemplary embodiment of this disclosure, a texture number is added to each texture in the texture resource library; based on the texture number of the virtual object in the current virtual scene, the U-coordinate offset and V-coordinate offset of the corresponding texture of the virtual object in the texture resource library are calculated; and based on the U-coordinate offset and V-coordinate offset, a preprocessed texture corresponding to the virtual object in the current virtual scene is selected.

[0097] The texture number is used to determine the position information of each texture.

[0098] For example, since the texture resource library stitches together intermediate textures from multiple virtual object target voxel models into a single image, a shader is needed to remap the UV information of each intermediate texture. This allows for quick location of the preprocessed texture corresponding to the virtual object in the current virtual scene based on the UV information. Furthermore, during the remapping of the UV information of each intermediate texture, each intermediate texture can be numbered to calculate the U-coordinate offset and V-coordinate offset based on the number.

[0099] A texture resource library is created by tiling together multiple intermediate images, numbered from left to right and top to bottom. Typically, the UV mapping range is 0~1; however, during image tiling, the UV information needs to be mapped from 0~1 to 0~n. Therefore: (3) In formula (3), This is the U-coordinate offset. This is the number of the intermediate image, which is composed of n×n intermediate images pieced together. The result is Divide by The remainder. For 4x4 intermediate textures, then... Take 4.

[0100] (4)

[0101] In formula (4), This is the V-coordinate offset. This is the number of the intermediate image, which is composed of n×n intermediate images pieced together. Yes The result is rounded down.

[0102] When determining the preprocessed texture corresponding to a virtual object in the current virtual scene, the position of the preprocessed texture can be calculated using the intermediate texture number, U-coordinate offset, and V-coordinate offset.

[0103] Next, with Figure 9 Taking the 4x4 intermediate texture library shown as an example, combined with... Figure 10 The method for determining the UV value range of the preprocessed texture is explained in detail.

[0104] like Figure 10 As shown, firstly, we can... Figure 10 The 4x4 intermediate textures shown in (a) are numbered 0-15 in order from left to right and from top to bottom.

[0105] Assuming the preprocessed texture corresponding to the virtual object in the current virtual scene is intermediate texture number 6 (i.e., the 7th intermediate texture), then we need to obtain the range of intermediate texture number 6, which means calculating the row and column of this intermediate texture in the image mosaic. As we know from 4x4 textures, each texture occupies 16 equal parts of the entire image, that is, each row and each column is divided into 4 equal parts. For example... Figure 10 As shown in (b), the middle texture of number 6 should be in the second row and third column. From the above formula (3), the U coordinate offset can be obtained as: (5) The V-coordinate offset is: (6) According to the above formulas (5) and (6), the UV value range of the middle texture of number 6 should be U: 0.5~0.75(0.5+0.25), V: 0.25~0.5(0.25+0.25).

[0106] According to some embodiments of this disclosure, after determining the preprocessed texture corresponding to the virtual object in the current virtual scene, in order to make the clouds more dynamic, a noise texture can be used to perform noise perturbation processing on the UV information of the preprocessed texture, thereby creating a dynamic effect of the clouds flowing horizontally over time.

[0107] Figure 11 This illustration schematically depicts a process in this exemplary embodiment of perturbing the UV information of a preprocessed texture using a noise map. For example... Figure 11 As shown, for the unperturbed Figure 11 Add a sheet like (a) in the middle. Figure 11 After noise perturbation of the noise map shown in (b), the result is as follows: Figure 11 The image (c) shows the dynamic effect of clouds moving horizontally over time.

[0108] Furthermore, after building the texture resource library, the corresponding pre-processed texture can be determined from the texture resource library in real time based on the virtual objects in the current virtual scene, and then the initial lighting information corresponding to the pre-processed texture can be determined.

[0109] In an exemplary embodiment of this disclosure, when determining the initial illumination information corresponding to the preprocessed texture, the product of the pixel value of the preprocessed texture and a preset value is calculated to obtain the first illumination information in the first illumination direction and the second illumination information in the second illumination direction; illumination information in other illumination directions besides the first illumination information in the first illumination direction and the second illumination information in the second illumination direction is extracted from the preprocessed texture to obtain the third illumination information; and the initial illumination information corresponding to the preprocessed texture is determined based on the first illumination information, the second illumination information, and the third illumination information.

[0110] The first and second lighting directions are axially symmetrical. For example, the first lighting direction could be a left lighting direction, the second lighting direction could be a right lighting direction, and other lighting directions could be an upward lighting direction or a backward lighting direction. The lighting information can be represented by the pixel values ​​of the image under the corresponding lighting direction.

[0111] For example, after obtaining the preprocessed texture, the information of each R, G, B, and A color channel in the preprocessed texture can be extracted again in the Shader. The extraction process is the reverse of the process of constructing each intermediate texture.

[0112] For example, when constructing the intermediate textures, the first lighting direction is the left lighting direction and the second lighting direction is the right lighting direction. The first initial texture and the second initial texture are merged using formula (2) to map the pixel values ​​of the merged texture to the range of 0-1 and store them in the R channel. When the initial lighting information is re-extracted for the R channel in the Shader, the pixel values ​​of the merged texture are re-mapped from the range of 0-1 to the range of -1-1 to obtain the first lighting information under the left lighting direction and the second lighting information under the right lighting direction, respectively.

[0113] The third lighting information can be obtained directly from the G channel under the upper lighting direction and from the B channel under the lower lighting direction.

[0114] This method allows for the direct acquisition of lighting information from pre-baked texture resources, avoiding the low rendering efficiency and increased performance costs associated with traditional techniques that require creating color lookup tables. This approach enables rapid rendering of virtual scenes, significantly improving their rendering efficiency.

[0115] Furthermore, by determining the initial lighting information of virtual objects in the current virtual environment, the current lighting information in the current virtual environment can be combined to render the current virtual environment.

[0116] According to some embodiments of this disclosure, when performing lighting rendering on a preprocessed texture based on current lighting information and initial lighting information in the current virtual scene to obtain a target texture, an interpolation variable between the current lighting information and the initial lighting information is calculated; the preprocessed texture is then rendered based on the interpolation variable to obtain the target texture.

[0117] The current lighting information can include the lighting direction, intensity, and color of the current game scene. The lighting direction is usually the direction of sunlight or moonlight in the current game scene.

[0118] For example, the current lighting information in the current game scene can be obtained in the Shader, and then the interpolation variable between the current lighting information and the aforementioned determined initial lighting information can be calculated. This allows control over the interpolation effect of the preprocessed texture of the virtual object under different lighting directions, based on the current lighting information. Figure 12 , 13 As shown, the arrow indicates the current lighting information. Figure 12 , Figure 13 The illustration shows a target texture diagram under different current lighting conditions.

[0119] By determining the initial lighting information of the virtual object, the final target texture can be calculated in real time based on the current lighting information, resulting in the rendering effect of the virtual scene under the current lighting conditions. This method avoids the technical problem of low rendering efficiency caused by the inability to see the rendering effect of the virtual scene in real time in traditional methods, which makes it difficult to quickly determine the required color lookup table based on the lighting information in the current virtual scene. This further improves the technical efficiency of virtual scene rendering.

[0120] In an exemplary embodiment of this disclosure, when calculating the interpolation variable between the current illumination information and the initial illumination information, the current illumination information can be multiplied by the tangent of the world space vertex to obtain the initial interpolation variable; the initial interpolation variable and the initial illumination information are interpolated based on the interpolation function to obtain the interpolation variable.

[0121] Taking the initial lighting information mentioned above, which includes lighting information from the left, right, top, and back lighting directions, as an example: (7) In formula (7), Used as the initial interpolation variable; This refers to the lighting information under the current lighting direction; is the tangent vector to the vertex in world space.

[0122] Based on the above formula (7), the initial interpolation variable and the initial illumination information are interpolated using the interpolation function to obtain the interpolation variable as shown in formula (8): (8) In formula (8), For interpolation variables; Used as the initial interpolation variable; It is an interpolation function; These correspond to the lighting information under the top lighting direction, the lighting information under the left lighting direction, and the lighting information under the right lighting direction in the initial lighting information, respectively. It is a function used to control the range of the output value to be within the range of [0, d] or [d, 0].

[0123] Among them, the interpolation function For output and The values ​​between these ranges, and the specific output value, are determined by the weight parameters. Decide.

[0124] For example, if the input parameters of the interpolation function The value can be: Then the interpolation function The output value is 2.

[0125] In formula (8), the illumination information under the top illumination direction and the illumination information under the left illumination direction are usually represented in matrix form. In the calculation... At that time, the data at the corresponding positions in the matrix are assigned weight parameters.

[0126] By using an interpolation function to calculate the rendering effect under the influence of initial and current lighting information, the final target texture can be calculated in real time based on the current lighting information, thus obtaining the virtual scene rendering effect under the current lighting conditions. This method further improves the efficiency of virtual scene rendering.

[0127] According to some other embodiments of this disclosure, when performing lighting rendering on a preprocessed texture based on current lighting information and initial lighting information to obtain a target texture, the current lighting information and the lighting information in the direction of the virtual camera can be multiplied to obtain a mask mapping; the product of the mask mapping and the initial lighting information is calculated to perform lighting rendering on the preprocessed texture to obtain the target texture.

[0128] The virtual camera direction refers to the viewing direction presented by the terminal device in the current virtual scene, that is, the viewing direction seen by the player.

[0129] For example, when the light direction is opposite to the current light direction in the virtual scene, the edges of clouds will scatter light due to reduced density. To simulate the scattering effect of realistic clouds, the preprocessed texture can be rendered using the initial lighting information under the subsequent lighting direction.

[0130] By performing a dot product operation between the lighting information in the current lighting direction and the lighting information in the direction of the virtual camera, we can obtain, for example: Figure 14 The masking mapping is shown below. Then, the product of the masking mapping and the initial lighting information under the subsequent lighting direction is calculated to obtain the following... Figure 15 The target texture shown.

[0131] The values ​​of each color channel in the mask mapping range from black (R = G = B = 0) to white (R = G = B = 255). The values ​​of the mask mapping reflect the relative position of the current lighting direction and the clouds. The larger the value calculated by the dot product operation, the closer the current lighting direction is to the direction of the virtual camera, and vice versa.

[0132] It should be understood that all the above lighting information is represented in matrix form, and calculations can be performed according to matrix calculation rules.

[0133] By using lighting information from the backlight direction, the scattering effect of real clouds can be simulated, thereby achieving the effect of the virtual scene dynamically changing with the day and night cycle, improving the realism of the virtual scene rendering, and thus enhancing the player's gaming experience.

[0134] In an exemplary embodiment of this disclosure, interpolation processing is performed on the region where the pixel value of the mask mapping is a first preset pixel value to obtain a first target texture with a first illumination color; interpolation processing is performed on the region where the pixel value of the mask mapping is a second preset pixel value to obtain a second target texture with a second illumination color; the first target texture and the second target texture are fused to obtain a target texture with a target color.

[0135] The first preset pixel value can be a pixel value superimposed with R = G = B = 255, and the second preset pixel value can be a pixel value superimposed with R = G = B = 0. The first lighting color can be the current lighting color, and the second lighting color can be the sky / atmosphere color.

[0136] By obtaining the color information of the target texture, the colors of the sky and clouds in the virtual scene can be made closer to the colors of the actual sky and clouds, thereby improving the realism of the virtual scene rendering.

[0137] According to some embodiments of this disclosure, Figure 12 , Figure 13 The target texture obtained under the current lighting information and Figure 15 By overlaying the target texture and its color information, we can obtain... Figure 16 , Figure 17 The rendering effect of the virtual scene shown. Figure 16 , Figure 17 The images shown are virtual scene renderings with sky and atmospheric colors overlaid, representing daytime and nighttime scenarios, respectively. During the day, the current lighting information primarily comes from sunlight, while at night, it primarily comes from moonlight.

[0138] To implement the above-mentioned virtual scene rendering method, one embodiment of this disclosure provides a virtual scene rendering apparatus. Figure 18 A schematic diagram of the architecture of a virtual scene rendering device is shown.

[0139] like Figure 18 As shown, the virtual scene rendering device 1800 includes a texture selection module 1801, an information determination module 1802, and a lighting rendering module 1803.

[0140] The texture selection module 1801 is used to select a preprocessed texture corresponding to a virtual object in the current virtual scene from the texture resource library obtained by pre-baking and rendering; the information determination module 1802 is used to determine the initial lighting information corresponding to the preprocessed texture; the lighting rendering module 1803 is used to perform lighting rendering on the preprocessed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain the target texture.

[0141] The virtual scene rendering apparatus 1800 provided in this embodiment can execute the technical solution of the virtual scene rendering method in any of the above embodiments, and its implementation principle and beneficial effects are similar to those of the virtual scene rendering method. The virtual scene rendering apparatus 1800 can pre-bake and render virtual objects in the virtual scene to build a texture resource library. When rendering virtual objects in the current virtual scene, it only needs to quickly obtain the texture corresponding to the virtual object from the texture resource library, and calculate the rendered virtual scene in real time by combining it with the current lighting information in the current virtual scene. This method pre-baks and renders virtual objects in the virtual scene to build a texture resource library. When rendering virtual objects in the current virtual scene, it only needs to quickly obtain the texture corresponding to the virtual object from the texture resource library, and calculate the rendered virtual scene in real time by combining it with the current lighting information in the current virtual scene. This method avoids the technical problem of low rendering efficiency caused by the need to create more color lookup tables in traditional methods and look up colors that match the lighting direction of the current virtual scene during real-time rendering, thereby achieving the technical effect of improving the rendering efficiency of virtual scenes. At the same time, this method avoids the technical problem of increased rendering performance consumption caused by creating more color lookup tables, thus reducing performance consumption.

[0142] Furthermore, in order to implement the above-mentioned virtual scene rendering method, one embodiment of this disclosure also provides another virtual scene rendering apparatus. Figure 19 A schematic diagram of the architecture of a virtual scene rendering device is shown.

[0143] like Figure 19 As shown, the virtual scene rendering device 1900 includes an image rendering module 1901, a resource construction module 1902, an image processing module 1903, a texture selection module 1904, and a lighting rendering module 1905.

[0144] In an optional embodiment, the image rendering module 1901 is specifically used to perform image rendering on multiple target voxel models of a virtual object under different lighting directions to obtain multiple initial textures; the resource construction module 1902 is used to construct intermediate textures for each target voxel model based on the multiple initial textures; and to construct the texture resource library based on each intermediate texture. By performing image rendering on multiple different voxel models of a virtual object under different lighting directions and finally constructing the texture resource library, the richness of the cloud layer can be improved. At the same time, by pre-constructing the resource library, when rendering virtual objects in a virtual scene, only the corresponding texture needs to be selected, without repeatedly re-baking the voxel models of virtual objects under different lighting conditions, thereby reducing the real-time rendering performance consumption of the game server.

[0145] In an optional embodiment, the image processing module 1903 performs noise replacement processing on the initial voxel model to obtain an intermediate voxel model; and performs noise scrambling processing on the intermediate voxel model to obtain an initial target voxel model. By using noise replacement and noise scrambling processing on the established initial voxel model, the established cloud model can be made closer to the effect of real clouds, thereby improving the realism and lifelikeness of the rendered virtual scene.

[0146] In an optional embodiment, the image processing module 1903 is used to normalize the initial target voxel model to obtain a target voxel model. Normalization is performed to make the virtual object simulate the effect in a real scene; that is, in a real scene, clouds are subject to gravity, and the volume density of clouds typically increases from top to bottom. To simulate realistic clouds in a virtual scene, the coordinates of the initial target voxel model of the cloud can be normalized.

[0147] In an optional embodiment, the resource construction module 1902 is used to merge the first initial texture in the first lighting direction and the second initial texture in the second lighting direction for each target voxel model to obtain a merged texture for each target voxel model; wherein the first lighting direction and the second lighting direction are axially symmetric; and to construct intermediate textures based on the initial textures and merged textures in other directions of each target voxel model besides the first and second lighting directions. Selecting the initial textures with axially symmetric lighting directions for image merging facilitates the calculation of the merged pixel values, thereby quickly obtaining the merged texture.

[0148] In an optional embodiment, the resource construction module 1902 is used to calculate the product of the pixel values ​​of the first initial texture and a preset value to obtain the feature pixel values ​​for the first initial texture; calculate the sum of the feature pixel values ​​and the pixel values ​​of the second initial texture to obtain the target pixel values; and obtain a merged texture based on the target pixel values ​​corresponding to each pixel unit in the first and second initial textures. For each target voxel model of a virtual object, the pixel values ​​of the initial textures are merged into a texture, and the pixel values ​​of the merged texture are mapped to the range of 0-1 so as to be stored in the color channel to form a texture resource library, thereby further improving the rendering efficiency of the virtual scene.

[0149] In an optional embodiment, the resource construction module 1902 is used to calculate the product of the pixel values ​​of the preprocessed texture and a preset value to obtain first lighting information in a first lighting direction and second lighting information in a second lighting direction; extract lighting information in other lighting directions besides the first lighting information in the first lighting direction and the second lighting information in the second lighting direction from the preprocessed texture to obtain third lighting information; and determine the initial lighting information corresponding to the preprocessed texture based on the first lighting information, second lighting information, and third lighting information. This method allows for direct acquisition of lighting information based on pre-baked texture resources, avoiding the technical problems of low rendering efficiency and increased rendering performance consumption caused by the need to create color lookup tables in traditional techniques. This method enables rapid rendering of virtual scenes, improving the rendering efficiency of virtual scenes.

[0150] In an optional embodiment, the texture selection module 1904 is used to add texture numbers to each texture in the texture resource library; based on the texture numbers, the horizontal and vertical offsets of the texture corresponding to the virtual object in the texture resource library are calculated respectively; the position information of the texture corresponding to the virtual object is determined according to the horizontal and vertical offsets; and the texture corresponding to the position information is determined as the preprocessed texture corresponding to the virtual object in the current virtual scene. This method avoids the technical problem of low rendering efficiency of the virtual scene caused by the need to create more color lookup tables in traditional methods and look up colors that match the lighting direction of the current virtual scene during real-time rendering, thereby achieving the technical effect of improving the rendering efficiency of the virtual scene.

[0151] In an optional embodiment, the image processing module 1903 is used to perform noise perturbation processing on the preprocessed texture based on the acquired noise texture. This method can enable virtual objects in the virtual scene to be dynamic.

[0152] In an optional embodiment, the lighting rendering module 1905 calculates the interpolation variable between the current lighting information and the lighting information; based on the interpolation variable, it performs lighting rendering on the preprocessed texture to obtain the target texture. By determining the initial lighting information of the virtual object, the final target texture can be calculated in real time in conjunction with the current lighting information, thus obtaining the virtual scene rendering effect under the current lighting information. This method avoids the technical problem of low rendering efficiency caused by the inability to see the rendering effect of the virtual scene in real time in traditional methods, making it difficult to quickly determine the required color lookup table in conjunction with the lighting information in the current virtual scene. This further improves the technical effect of enhancing the rendering efficiency of virtual scenes.

[0153] In an optional embodiment, the lighting rendering module 1905 performs a dot product operation between the current lighting information and the tangents of the world space vertices to obtain an initial interpolation variable; based on an interpolation function, it performs an interpolation operation between the initial interpolation variable and the initial lighting information to obtain an interpolation variable. By calculating the rendering effect under the influence of the initial lighting information and the current lighting information through the interpolation function, the final target texture can be calculated in real time based on the current lighting information, thus obtaining the virtual scene rendering effect under the current lighting information. This method further improves the efficiency of virtual scene rendering.

[0154] In an optional embodiment, the lighting rendering module 1905 performs a dot product operation between the current lighting information and the lighting information in the direction of the virtual camera to obtain a mask mapping of the preprocessed texture; calculates the product of the mask mapping and the initial lighting information, and performs lighting rendering on the preprocessed texture to obtain the target texture. The lighting information in the subsequent lighting direction can simulate the scattering effect of real clouds, thereby achieving a dynamic change of the virtual scene with day and night changes, improving the realism of the virtual scene rendering, and thus enhancing the player's gaming experience.

[0155] In an optional embodiment, the image processing module 1903 is used to perform interpolation processing on the region where the pixel value of the mask mapping is a first preset pixel value to obtain a first target texture with a first illumination color; to perform interpolation processing on the region where the pixel value of the mask mapping is a second preset pixel value to obtain a second target texture with a second illumination color; and to fuse the first target texture and the second target texture to obtain a target texture with a target color. By obtaining the color information of the target texture, the color of the sky and clouds in the virtual scene can be made closer to the color of the actual sky and clouds, thereby improving the realism of the virtual scene rendering.

[0156] The virtual scene rendering apparatus 1900 provided in this embodiment can execute the technical solution of the virtual scene rendering method in any of the above embodiments, and its implementation principle and beneficial effects are similar to those of the virtual scene rendering method.

[0157] The virtual scene rendering device 1900 can pre-bake and render virtual objects in the virtual scene to build a texture resource library. When rendering virtual objects in the current virtual scene, it only needs to quickly retrieve the texture corresponding to the virtual object from the texture resource library, and calculate the rendered virtual scene in real time by combining it with the current lighting information in the current virtual scene. This method avoids the technical problem of low rendering efficiency caused by the need to create more color lookup tables in traditional methods and look up colors that match the lighting direction of the current virtual scene during real-time rendering, thus improving the rendering efficiency of virtual scenes. At the same time, this method avoids the technical problem of increased rendering performance consumption caused by creating more color lookup tables, thereby reducing performance consumption.

[0158] Exemplary embodiments of this disclosure also provide a computer-readable storage medium that can be implemented as a program product including program code, which, when run on an electronic device, causes the electronic device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. In one embodiment, the program product can be implemented as a portable compact disc read-only memory (CD-ROM) and include program code, and can run on an electronic device, such as a personal computer. However, the program product of this disclosure is not limited thereto. In this document, the readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0159] The aforementioned virtual scene rendering method pre-baks and renders virtual objects in the virtual scene to build a texture resource library. When rendering virtual objects in the current virtual scene, it only needs to quickly retrieve the texture corresponding to the virtual object from the texture resource library and calculate the rendered virtual scene in real time by combining it with the current lighting information in the current virtual scene. This method avoids the technical problem of low rendering efficiency caused by the need to create more color lookup tables in traditional methods and look up colors that match the lighting direction of the current virtual scene during real-time rendering, thus improving the technical effect of virtual scene rendering efficiency. At the same time, this method avoids the technical problem of increased rendering performance consumption caused by creating more color lookup tables, thereby reducing the technical effect of performance consumption.

[0160] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0161] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0162] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0163] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider). In embodiments of this disclosure, when the program code stored in the computer-readable storage medium is executed, it can implement the following steps in the virtual scene rendering method described above: The aforementioned virtual scene rendering method selects a pre-processed texture corresponding to a virtual object in the current virtual scene from a pre-baked texture resource library; determines the initial lighting information corresponding to the pre-processed texture; and performs lighting rendering on the pre-processed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain the target texture. This virtual scene rendering method can pre-bake render virtual objects in the virtual scene to build a texture resource library. When rendering virtual objects in the current virtual scene, it only needs to quickly retrieve the texture corresponding to the virtual object from the texture resource library and calculate the rendered virtual scene in real time by combining it with the current lighting information in the current virtual scene. This method avoids the technical problem of low rendering efficiency caused by the need to create more color lookup tables and look up colors that match the lighting direction of the current virtual scene during real-time rendering, thus achieving the technical effect of improving the rendering efficiency of virtual scenes.

[0164] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.

[0165] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as “circuit,” “module,” or “system.”

[0166] The following reference Figure 20 To describe an electronic device 2000 according to this embodiment of the present invention. Figure 20 The electronic device 2000 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0167] like Figure 20 As shown, the electronic device 2000 is manifested in the form of a general-purpose computing device. The components of the electronic device 2000 may include, but are not limited to: at least one processing unit 2010, at least one storage unit 2020, a bus 2030 connecting different system components (including storage unit 2020 and processing unit 2010), and a display unit 2040.

[0168] The storage unit stores program code, which can be executed by the processing unit 2010 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 2010 can perform, as follows: Figure 3 Steps S301 to S303 are shown in the diagram.

[0169] Storage unit 2020 may include readable media in the form of volatile storage units, such as random access memory (RAM) 20201 and / or cache memory 20202, and may further include read-only memory (ROM) 20203.

[0170] The storage unit 2020 may also include a program / utility 20204 having a set (at least one) program module 20205, such program module 20205 including but not limited to: an operating system, one or more applications, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0171] Bus 2030 can represent one or more of several types of bus structures, including memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processing unit, or local bus using any of the multiple bus structures.

[0172] Electronic device 2000 can also communicate with one or more external devices 2100 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with electronic device 2000, and / or any device that enables electronic device 2000 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 2050. Furthermore, electronic device 2000 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 2060. As shown, network adapter 2060 communicates with other modules of electronic device 2000 via bus 2030. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 2000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0173] In this embodiment of the disclosure, when the program code stored in the electronic device 2000 is executed, it can implement the following steps in the virtual scene rendering method described above: This method selects a pre-processed texture corresponding to a virtual object in the current virtual scene from a pre-baked and rendered texture resource library; determines the initial lighting information corresponding to the pre-processed texture; and performs lighting rendering on the pre-processed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain the target texture. This method pre-baks and renders virtual objects in the virtual scene to build a texture resource library. When rendering virtual objects in the current virtual scene, it only needs to quickly retrieve the texture corresponding to the virtual object from the texture resource library and calculate the rendered virtual scene in real time by combining it with the current lighting information in the current virtual scene. This method avoids the technical problem of low rendering efficiency caused by the need to create more color lookup tables and look up colors that match the lighting direction of the current virtual scene during real-time rendering, thus improving the rendering efficiency of the virtual scene. At the same time, this method avoids the technical problem of increased rendering performance consumption caused by creating more color lookup tables, thus reducing performance consumption.

[0174] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0175] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0176] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0177] Those skilled in the art will understand that various aspects of this disclosure can be implemented as systems, methods, or program products. Therefore, various aspects of this disclosure can be embodied in entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as “circuit,” “module,” or “system.” Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0178] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is defined only by the appended claims.

Claims

1. A virtual scene rendering method, characterized in that, include: Based on the texture numbers of each texture in the texture resource library obtained from pre-baked rendering, the horizontal and vertical offsets of the textures corresponding to virtual objects in the current virtual scene in the texture resource library are calculated respectively; the position information of the textures corresponding to the virtual objects is determined according to the horizontal and vertical offsets, and the textures corresponding to the position information are determined as the pre-processed textures corresponding to the virtual objects in the current virtual scene; Determine the initial lighting information corresponding to the preprocessed texture; The current lighting information in the current virtual scene is multiplied by the tangent of the world space vertex to obtain an initial interpolation variable; the initial interpolation variable and the initial lighting information are interpolated based on a pre-configured interpolation model to obtain an interpolation variable; the pre-processed texture is then rendered based on the interpolation variable to obtain a target texture.

2. The virtual scene rendering method according to claim 1, characterized in that, The pre-baking rendering step includes: For multiple target voxel models of the virtual object, image rendering is performed on each target voxel model under different lighting directions to obtain multiple initial textures; Based on the multiple initial textures, intermediate textures are constructed for each of the target voxel models; The texture resource library is constructed based on each of the intermediate textures.

3. The virtual scene rendering method according to claim 2, characterized in that, Before rendering images of multiple target voxel models of the virtual object under different lighting directions to obtain multiple initial textures, the pre-baking rendering step further includes: The initial voxel model is subjected to noise replacement processing to obtain an intermediate voxel model; The intermediate voxel model is subjected to noise scrambling to obtain the initial target voxel model.

4. The virtual scene rendering method according to claim 3, characterized in that, The pre-baking rendering step also includes: The initial target voxel model is normalized to obtain the target voxel model.

5. The virtual scene rendering method according to claim 2, characterized in that, The process of constructing intermediate textures for each target voxel model based on the plurality of initial textures includes: For each target voxel model, the first initial texture map in the first lighting direction and the second initial texture map in the second lighting direction are merged to obtain the merged texture map of each target voxel model; wherein, the first lighting direction and the second lighting direction are axially symmetric. The intermediate texture is constructed based on the initial textures in each of the target voxel models, excluding the first and second lighting directions, and the merged texture.

6. The virtual scene rendering method according to claim 5, characterized in that, The step of merging the first initial texture map in the first lighting direction and the second initial texture map in the second lighting direction to obtain the merged texture map of each target voxel model includes: Calculate the product of the pixel values ​​of the first initial texture and the preset value to obtain the feature pixel values ​​for the first initial texture; The target pixel value is obtained by summing the feature pixel value with the pixel value of the second initial texture. The merged texture is obtained based on the target pixel values ​​corresponding to each pixel unit in the first initial texture and the second initial texture.

7. The virtual scene rendering method according to claim 5, characterized in that, Determining the initial lighting information corresponding to the preprocessed texture includes: Calculate the product of the pixel value of the preprocessed texture and the preset value to obtain the first illumination information in the first illumination direction and the second illumination information in the second illumination direction; The third lighting information is obtained by extracting lighting information from the preprocessed texture in other lighting directions besides the first lighting information in the first lighting direction and the second lighting information in the second lighting direction. Based on the first lighting information, the second lighting information, and the third lighting information, the initial lighting information corresponding to the preprocessed texture is determined.

8. The virtual scene rendering method according to claim 1, characterized in that, After determining the texture corresponding to the location information as the preprocessed texture corresponding to the virtual object in the current virtual scene, the virtual scene rendering method further includes: The preprocessed texture is subjected to noise perturbation processing based on the acquired noise texture.

9. The virtual scene rendering method according to claim 1, characterized in that, The step of rendering the preprocessed texture based on the current lighting information and the initial lighting information in the current virtual scene to obtain the target texture includes: The current lighting information is multiplied by the lighting information in the direction of the virtual camera to obtain the mask mapping of the preprocessed texture; Calculate the product of the mask mapping and the initial lighting information, and perform lighting rendering on the preprocessed texture to obtain the target texture.

10. The virtual scene rendering method according to claim 9, characterized in that, Also includes: Interpolation processing is performed on the region where the pixel value of the mask mapping is a first preset pixel value to obtain a first target texture with a first lighting color. Interpolation processing is performed on the region where the pixel value of the mask mapping is a second preset pixel value to obtain a second target texture with a second illumination color; The first target texture and the second target texture are merged to obtain a target texture of the target color.

11. A virtual scene rendering device, characterized in that, include: The texture selection module is used to calculate the horizontal and vertical offsets of the texture corresponding to the virtual object in the current virtual scene in the texture resource library based on the texture number of each texture in the pre-baked and rendered texture resource library; determine the position information of the texture corresponding to the virtual object based on the horizontal and vertical offsets, and determine the texture corresponding to the position information as the preprocessed texture corresponding to the virtual object in the current virtual scene; The information determination module is used to determine the initial lighting information corresponding to the preprocessed texture; The lighting rendering module is used to perform a dot product operation between the current lighting information in the current virtual scene and the tangent of the world space vertex to obtain an initial interpolation variable; based on a pre-configured interpolation model, the initial interpolation variable and the initial lighting information are interpolated to obtain an interpolation variable; and the preprocessed texture is rendered based on the interpolation variable to obtain a target texture.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the virtual scene rendering method according to any one of claims 1 to 10.

13. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the virtual scene rendering method according to any one of claims 1 to 10 by executing the executable instructions.

Citation Information

Patent Citations

  • Scene rendering method and device, computer storage medium and electronic equipment

    CN113144611A

  • Virtual model rendering method and device

    CN114067043A