Rendering method and device, computer equipment, computer readable storage medium and computer program product
By generating a grid model of the volumetric cloud and obtaining texture and brightness information from the reference parameter set, the problem of high computing overhead when rendering the volumetric cloud in the prior art is solved, and an efficient rendering process is achieved and visual effects are improved.
Patent Information
- Application Number
- CN202510266433.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-06-06
AI Technical Summary
The prior art requires real-time cloud density accumulation when rendering volume clouds, resulting in complex rendering process, high computing overhead and low efficiency.
By obtaining the density information of the volume cloud, the density sample values are obtained, and a grid model is generated based on these values and preset three-dimensional grid cells. Then, the texture map and brightness information are obtained from the reference parameter set based on the vertex information of the mesh model, and the rendering process is performed to generate the rendered image.
This method simplifies the process of determining texture and brightness by sampling at one time, reducing computing overhead, improving rendering efficiency, and enhancing the spatial and depth sense of rendering.
Smart Images

Figure CN120107438A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer graphics, and in particular to a rendering method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] Volumetric cloud rendering refers to the process of using computer graphics technology to simulate clouds, smoke, fog, etc. in three-dimensional space and rendering them on a two-dimensional screen in real time. Taking clouds as an example, volumetric cloud rendering technology can provide more realistic and dynamic cloud effects, making the sky in games, movies and simulation environments look more natural and beautiful. By simulating the dynamic changes of clouds, volumetric cloud rendering can enhance the realism of the entire scene.
[0003] In the process of rendering volumetric clouds using related technologies, real-time cloud density accumulation is performed, which requires computing power support, making the rendering process complicated and computationally expensive, resulting in low rendering efficiency. Summary of the invention
[0004] Embodiments of the present application provide a rendering method, apparatus, computer device, computer-readable storage medium, and computer program product, which can improve rendering efficiency.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application provides a rendering method, the method comprising:
[0007] Get the density information of the volume cloud to be rendered;
[0008] Sampling the density information to obtain a plurality of density sampling values, and generating a grid model of the volume cloud to be rendered based on the density sampling values and preset three-dimensional grid units;
[0009] Acquire the texture map and brightness information of the mesh model from a reference parameter set based on vertex information of the mesh model;
[0010] The mesh model is rendered based on the texture map and the brightness information to obtain a rendered image of the volume cloud to be rendered, and the rendered image is output.
[0011] The present application provides a rendering device, the device comprising:
[0012] A first acquisition module is used to acquire density information of a volume cloud to be rendered;
[0013] A generating module, configured to sample the density information to obtain a plurality of density sampling values, and generate a grid model of the volume cloud to be rendered based on the density sampling values and preset three-dimensional grid units;
[0014] A second acquisition module, used for acquiring the texture map and brightness information of the mesh model from a reference parameter set based on the vertex information of the mesh model;
[0015] A rendering module is used to render the mesh model based on the texture map and the brightness information to obtain a rendered image of the volume cloud to be rendered, and output the rendered image.
[0016] An embodiment of the present application provides a computer device, including:
[0017] A memory for storing computer executable instructions;
[0018] The processor is used to implement the rendering method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0019] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for implementing the rendering method provided in the embodiment of the present application when executed by a processor.
[0020] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, the rendering method provided in the embodiment of the present application is implemented.
[0021] The embodiments of the present application have the following beneficial effects:
[0022] In an embodiment of the present application, a grid model of a volume cloud to be rendered is generated based on a preset three-dimensional grid unit. Since the three-dimensional grid unit is a three-dimensional structure, the grid model has information in three dimensions. Such information based on three dimensions can increase the sense of space and depth of the rendering. In addition, an embodiment of the present application obtains texture maps and brightness information from a reference data set based on the vertex information of the grid model, that is, the texture map and brightness information are obtained from the reference data set by a one-time sampling method without the need for real-time cloud density accumulation, thereby simplifying the process of determining the texture map and brightness information and reducing computational overhead. Finally, the grid model is rendered based on the texture map and brightness information to obtain a rendered image of the volume cloud to be rendered, and the rendered image is output. Since the texture map and brightness information are obtained by a one-time sampling method, the texture image and brightness information can be quickly obtained, thereby shortening the rendering time and improving the rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a schematic diagram of a network architecture of a rendering system 100 provided in an embodiment of the present application;
[0024] Figure 2is a schematic diagram of the structure of the terminal 400 provided in an embodiment of the present application;
[0025] Figure 3 It is a first flow chart of the rendering method provided in an embodiment of the present application;
[0026] Figure 4A This is a display schematic diagram of a volume cloud to be rendered provided in an embodiment of the present application;
[0027] Figure 4B It is a schematic diagram showing a structure of a three-dimensional grid unit provided in an embodiment of the present application;
[0028] Figure 4C It is a structural display schematic diagram of a grid model of a volume cloud to be rendered provided in an embodiment of the present application;
[0029] Figure 5 It is a schematic diagram of a process of generating a grid model provided in an embodiment of the present application;
[0030] Figure 6 This is a schematic diagram of a process for obtaining a texture map of a mesh model provided in an embodiment of the present application;
[0031] Figure 7 This is a schematic diagram of a process for obtaining brightness information of a grid model provided in an embodiment of the present application;
[0032] Figure 8 is a second flow chart of the rendering method provided in an embodiment of the present application;
[0033] Fig. 9 is a third flow chart of the rendering method provided in an embodiment of the present application;
[0034] Fig.10 is a display schematic diagram of a texture atlas provided in an embodiment of the present application;
[0035] Fig.11 This is a schematic diagram of displaying a volume cloud after light attenuation provided in an embodiment of the present application;
[0036] Fig.12 This is a schematic diagram of displaying a volume cloud after light scattering provided in an embodiment of the present application;
[0037] Fig.13 This is a schematic diagram showing the transition of cloud brightness from bright to dark provided in an embodiment of the present application;
[0038] Fig.14A is a display schematic diagram of the rendering result provided in an embodiment of the present application;
[0039] Fig. 14B is a first display schematic diagram of the rendering comparison result provided in an embodiment of the present application;
[0040] Fig. 14C is a second display schematic diagram of the rendering comparison result provided in an embodiment of the present application;
[0041] Fig.14D is a third display schematic diagram of the rendering comparison result provided in an embodiment of the present application;
[0042] Fig.15A This is a schematic diagram of displaying a volume cloud with mixed and disordered effects provided by an embodiment of the present application;
[0043] Fig. 15B This is a display schematic diagram of a semi-transparent sorted volume cloud provided in an embodiment of the present application;
[0044] Fig.16 It is a schematic diagram showing the distance between the three plugs and the acquisition module provided in the embodiment of the present application.
[0045] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of superiority or inferiority of the solutions or the priority in the implementation process. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0047] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0048] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0049] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0050] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0051] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.
[0052] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0053] 1) Volumetric clouds, also known as cumulus clouds or volumetric fog, are volumetric clouds in games that use graphics engines to simulate the translucent and irregular effects of real clouds and fog.
[0054] Volumetric cloud can refer to volume phenomena such as clouds, smoke, and fog, which are composed of a large number of tiny particles or droplets. Although "cloud" literally refers to the phenomenon formed by the aggregation of water droplets or ice crystals in the atmosphere, in the field of computer graphics and visual effects, the concept of "volume cloud" is extended to describe similar structures, that is, those fuzzy aggregates that show volume characteristics in three-dimensional space. In these fields, volumetric cloud can include cloud, smoke, and fog phenomena, among which cloud refers to the natural cloud layer composed of water droplets or ice crystals; smoke refers to columnar or diffuse substances composed of particles and gaseous substances produced by combustion. Fog refers to a suspension of water droplets formed by the condensation of water vapor in the air, which reduces visibility.
[0055] Volumetric cloud rendering usually involves complex physical process simulation, including light scattering, absorption, reflection and dynamic changes of medium, etc., to create the visual effect of volume phenomena in three-dimensional space on a two-dimensional screen. This technology makes volumetric cloud rendering not only limited to static visual effects, but also includes dynamic and interactive rendering effects, which are widely used in games, movies, television, scientific visualization and other fields.
[0056] 2) Billboard: This is rendered using a patch that is always facing the camera. This patch is a rectangular patch consisting of two triangles and is usually used to implement effects such as particles and user interfaces.
[0057] A billboard can be used to simulate the appearance of a 3D object in 3D space. In fact, a 2D image is projected onto a set of planes perpendicular to the viewer's line of sight. The 2D image is usually a texture image. In this way, no matter how the viewer moves, the billboard always faces the viewer, thus creating a 3D effect.
[0058] In volumetric cloud rendering, billboards are used to represent a set of planes that are used to simulate volumetric cloud, fog, smoke, and other effects. Each billboard can contain a cloud texture, and when combined together, they can create the appearance of volumetric clouds. These billboards usually dynamically adjust their orientation as the viewer moves to keep facing the viewer.
[0059] The billboards will rotate dynamically according to the direction of the camera to always face the camera, simulating the continuity and extension of volumetric clouds. Multiple billboards can be stacked to form a layered sense of cloud layers, and each layer of billboards can have different transparency and texture details to create a more realistic effect.
[0060] 3) Render Target (RT), a render target is a surface on which the graphics application programming interface can "draw" things. In essence, a render target is a continuous memory area. Multiple such memory areas can exist at the same time, that is, multiple render targets.
[0061] In computer graphics, RT refers to an image buffer used to store rendering results. When performing graphics rendering, RT is used to receive and store the final rendered images, which can be displayed on the screen or used for subsequent image processing.
[0062] In practical applications, RT is usually associated with the frame buffer, which is a collection of buffers, including color buffer, depth buffer, template buffer, etc., which is used to store various information in the rendering process. The color buffer is the most basic buffer in RT, which is used to store the final color value of the scene, that is, the pixel color seen by the user on the screen. The depth buffer, also known as the Z buffer, is used to store the depth information of each pixel in the scene, that is, their distance from the observer, which is very important for implementing depth testing and hidden surface elimination. The template buffer is used to store template values, which is a mechanism that can perform special template tests and is often used for complex rendering techniques such as mirror reflection and shadow effects. Modern graphics application programming interfaces support multiple rendering targets, allowing simultaneous rendering to multiple color buffers, which is essential for achieving certain advanced rendering effects. RT can be not only a frame buffer on the screen, but also a texture. This means that the rendering results can be stored in an RT and then used as input in subsequent rendering stages.
[0063] In practical applications, RT can be a two-dimensional image, a cube map (for environment mapping), or three-dimensional voxel data (for volume rendering). The type and purpose of RT depends on the graphics application programming interface used and the specific rendering task. For example, the graphics application programming interface can be one of OpenGL, DirectX, and Vulkan.
[0064] In order to better understand the rendering method provided in the embodiment of the present application, the rendering method in the related art and the existing technical problems are first explained.
[0065] In the related art, volumetric cloud rendering is achieved through the following two methods: the first method is based on a grid and multi-pass rendering solution; the second method is based on a Billboard rendering solution.
[0066] For the first method mentioned above, artists create high-poly models in digital content creation software (DCC) tools, extract the outer contour mesh or directly create a simple model outer contour, render particle cloud effects, use a variety of different cloud shapes for a cloud, and render the outer contour multiple times along the normal direction. Since the cloud mesh is made manually, the cloud thickness cannot be guaranteed; and the first method uses offline lighting for rendering, so the overall rendering effect is limited.
[0067] For the second method mentioned above, artists directly stack billboard grids or make high-poly models in DCC tools, and then sample and generate billboard grids in engine tools to render particle cloud effects. A cloud uses a variety of different cloud shapes and is calculated using traditional lighting models. Since the billboard grid is built based on a two-dimensional patch, the rendering result has a weak sense of space and poor depth.
[0068] Combining the above-mentioned related technologies, it can be seen that the disadvantages of the related technologies include at least: first, the rendering process is complicated and the rendering efficiency is low; second, the calculation cost is large, the sense of space is weak, and the sense of depth is poor.
[0069] The embodiments of the present application provide a rendering method, apparatus, computer equipment, computer-readable storage medium, and computer program product, which can improve the efficiency of rendering. The following describes an exemplary application of the computer equipment provided by the embodiments of the present application. The computer equipment provided by the embodiments of the present application can be implemented as various types of terminals such as laptops, tablet computers, desktop computers, set-top boxes, smart phones, smart speakers, smart watches, smart TVs, vehicle-mounted terminals, robots, drones, medical equipment, smart wearable devices, smart mirrors, etc., and can also be implemented as a server, or a combination of the two. Below, an exemplary application when the computer equipment is implemented as a terminal will be described.
[0070] See also Figure 1 , Figure 1 1 is a schematic diagram of the network architecture of the rendering system 100 provided in an embodiment of the present application. To support a rendering application, the server 200 is connected to the terminal 400 via the network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.
[0071] Taking the game scene as an example, the terminal 400 is used to receive a rendering instruction, generate an acquisition request for a reference data set based on the rendering instruction, and send the acquisition request to the server 200. The server 200 is used to obtain the reference data set from its own storage space based on the acquisition request, and return the reference data set to the terminal 400. The terminal 400 is also used to obtain the density information of the volume cloud to be rendered; sample the density information to obtain multiple density sampling values, and generate a mesh model of the volume cloud to be rendered based on the density sampling values and preset three-dimensional mesh units; obtain the texture map and brightness information of the mesh model from the reference parameter set based on the vertex information of the mesh model; render the mesh model based on the texture map and brightness information to obtain a rendered image of the volume cloud to be rendered, and output the rendered image.
[0072] In some embodiments, the terminal 400 may generate and send a request for obtaining a reference data set when receiving a rendering instruction for the first time, so as to obtain the reference data set from the server 200. Thereafter, if the reference data set has not been updated, the terminal 400 may render based on the reference data set obtained for the first time, thereby improving rendering efficiency. If the reference data set has been updated, the server 200 will send the updated reference data set to the terminal 400, based on which the terminal 400 renders based on the updated reference data set, thereby improving rendering accuracy.
[0073] In an embodiment of the present application, the terminal 400 generates a grid model of a volume cloud to be rendered based on a preset three-dimensional grid unit. Since the three-dimensional grid unit is a three-dimensional structure, the grid model has information in three dimensions, so the information based on three dimensions can increase the sense of space and depth of the rendering. In addition, the embodiment of the present application obtains texture maps and brightness information from a reference data set based on the vertex information of the grid model, that is, the texture map and brightness information are obtained from the reference data set by a one-time sampling method without the need for real-time cloud density accumulation, thereby simplifying the determination process of the texture map and brightness information and reducing the computational overhead. Finally, the grid model is rendered based on the texture map and brightness information to obtain a rendered image of the volume cloud to be rendered, and the rendered image is output. Since the texture map and brightness information are obtained by a one-time sampling method, the texture image and brightness information can be quickly obtained, thereby shortening the rendering time and improving the rendering efficiency.
[0074] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as network services, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
[0075] In the volumetric cloud rendering technology, in addition to the volumetric cloud used in games, it can also be applied to the following scenes:
[0076] 1. Meteorological simulation and visualization: terminal devices or servers can simulate and display real meteorological phenomena such as storms, typhoons, fog and haze through volumetric cloud rendering technology, providing intuitive three-dimensional visualization tools for meteorological research and forecasting.
[0077] 2. Aircraft and car simulators, terminal devices or servers use volumetric cloud rendering to create realistic flight or driving environments for aircraft and car simulators, enhancing pilots’ flight training or drivers’ driving experience.
[0078] 3. Movie and TV visual effects: The server uses volumetric cloud rendering technology in the render farm to generate clouds, smoke and other volumetric effects in movies and TV shows to enhance the visual impact.
[0079] 4. Scientific visualization: terminal devices or servers use volumetric cloud rendering to display complex scientific data and models, such as fluid dynamics simulation, atmospheric science research, etc., to help scientists better understand the data.
[0080] 5. Virtual Reality (VR) and Augmented Reality (AR): terminal devices such as VR helmets or AR glasses provide users with an immersive natural environment experience through real-time volumetric cloud rendering, enhancing the realism of virtual reality.
[0081] 6. Urban planning and environmental simulation. Server-side volumetric cloud rendering technology can be used in urban planning to simulate environmental problems such as air pollution and smog dispersion in cities, helping planners evaluate and optimize urban design plans.
[0082] 7. Education and training: terminal devices or servers provide interactive three-dimensional atmospheric phenomenon teaching and training content for students and researchers through volumetric cloud rendering technology.
[0083] In the above applications, volumetric cloud rendering technology not only improves the realism and aesthetics of the scene, but also provides a more intuitive and interactive experience for all kinds of users, thus playing an important role in various fields.
[0084] See also Figure 2 , Figure 2 is a schematic diagram of the structure of the terminal 400 provided in an embodiment of the present application, Figure 2 The terminal 400 shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .
[0085] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0086] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0087] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0088] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0089] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0090] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0091] A network communication module 452, used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;
[0092] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);
[0093] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.
[0094] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 The rendering device 455 stored in the memory 450 is shown, which can be software in the form of a program and a plug-in, etc., and includes the following software modules: a first acquisition module 4551, a generation module 4552, a second acquisition module 4553 and a rendering module 4554. These modules are logical, and therefore can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0095] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the rendering method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), DSP, programmable logic device (Programmable Logic Device, PLD), complex programmable logic device (Complex Programmable Logic Device, CPLD), field programmable gate array (Field-Programmable Gate Array, FPGA) or other electronic components.
[0096] In some embodiments, the terminal can implement the rendering method provided in the embodiments of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be microprogram-level commands, machine instructions or software instructions. The computer program can be a native program or software module in the operating system; it can be a native application (APPlication, APP), that is, a program that needs to be installed in the operating system to run, such as a game APP, a film and television APP, and a weather APP; it can also be a small program that can be embedded in any APP, that is, a program that can be run only by downloading it to a browser environment. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.
[0097] The rendering method provided in the embodiment of the present application will be described in conjunction with the exemplary application and implementation of the terminal provided in the embodiment of the present application.
[0098] The following describes the rendering method provided by the embodiment of the present application. As mentioned above, the computer device that implements the rendering method of the embodiment of the present application may be a terminal. Therefore, the execution subject of each step will not be repeatedly described below.
[0099] It should be noted that the examples of the rendering method below are illustrated by taking volumetric clouds in games as an example. Those skilled in the art can apply the rendering method provided in the embodiments of the present application to rendering processing of volumetric clouds in other types including aircraft and car simulators, film and television visual effects, etc., based on their understanding of the following. The embodiments of the present application can also be applied to various scenarios, including but not limited to games, weather simulations, aircraft and car simulators, film and television visual effects, scientific visualization, VR, AR, urban planning and environmental simulation, education and training, etc.
[0100] See also Figure 3 , Figure 3 is a flowchart of a rendering method provided in an embodiment of the present application, which will be combined with Figure 3 The steps shown are used to illustrate the rendering method provided in the embodiment of the present application. Figure 3 The execution subject is the terminal.
[0101] In step S101 , density information of a volume cloud to be rendered is obtained.
[0102] In the embodiment of the present application, the volume cloud to be rendered may be a continuous medium in a three-dimensional space, such as cloud, smoke, fog, flame, hot air, etc.
[0103] In some embodiments, the voxel data of the volume cloud to be rendered can be determined in advance using a DCC tool. The voxel data may include density information, color information, temperature information, velocity information, lighting information, normal information, texture coordinates, emission information, absorption and scattering degree, noise information, etc.
[0104] In some embodiments, density information refers to a value specified inside each voxel, which indicates the density of the volume cloud to be rendered in the voxel or the mass per unit volume. In volume cloud rendering, density information is one of the core physical properties, and density information directly affects the visual performance of volume effects. First, in volume cloud rendering, density is usually associated with transparency. The higher the density of a voxel, the stronger the absorption of light by the voxel, and thus the more opaque it looks in visual effect. Second, density affects the way light is scattered inside the volume cloud to be rendered. High-density areas may cause more scattering, resulting in soft edges and shadow effects. Third, density information can be used to determine which parts of the volume cloud to be rendered are visible and which parts are blocked. This is usually achieved by calculating the intersection of light with voxels when passing through the volume. Fourth, in physical simulation, density can be used to calculate mass, gravity effects, and other physical behaviors in fluid dynamics. Fifth, when simulating dynamic volume effects, such as the flow of clouds or the diffusion of smoke, density information changes over time to reflect the dynamic behavior of the volume cloud to be rendered.
[0105] In practical applications, density information can be represented either continuously or discretely. In discrete representation, each voxel is assigned a fixed density value, while in continuous representation, the density can be a function of any position inside the voxel, and interpolation methods are usually required to obtain the density at a specific position. The density information of voxel data is usually generated from the original model or simulated data through the voxelization process.
[0106] In other embodiments, the color information may be a color value, which is used to represent the color of the volume effect cloud to be rendered, such as clouds, smoke, and fog. For example, the color information may include red, green, and blue color values, and may also include a transparency channel, which is used to represent transparency. Temperature information may be used to affect the rendering of the volume cloud to be rendered, such as clouds formed by rising hot air. Speed information represents the moving speed and direction of each point in the volume cloud to be rendered, and can be used to simulate fluid dynamics and wind speed effects. Lighting information may include lighting data, such as scattering coefficients, absorption coefficients, emissivity, etc., and lighting information is used to simulate the propagation and scattering of light in the volume cloud to be rendered. Normal information is used for lighting calculations and can also be used for volume shadow and lighting effect rendering. Texture coordinates can be used to map textures on voxels to increase surface details. For luminous volume effects, such as flames or hot air masses, voxel data may include emission information, and the emission information determines the lighting generated inside the volume cloud to be rendered. Absorption and scattering information may be absorption and scattering parameters, which affect the degree of absorption and scattering of light when it passes through the volume, thereby affecting the rendering effect. The noise information may be noise texture coordinates or noise values, and the noise information is used to generate a complex and irregular structure of a volume cloud to be rendered.
[0107] In some embodiments, according to set rendering requirements, the voxel data may also include customized attributes to meet specific visual effects or physical simulation requirements.
[0108] By combining the above information together, the rendering of the volumetric cloud to be rendered can be made more realistic, while providing more control means to create diverse visual effects.
[0109] In the embodiment of the present application, if the terminal determines the voxel data of the volume cloud to be rendered, the density information of the volume cloud to be rendered is directly obtained from the voxel data based on the storage space of the density information. If the voxel data of the volume cloud to be rendered is determined by another device other than the terminal, the terminal can obtain the density information of the volume cloud to be rendered from the other device based on the read instruction.
[0110] In some embodiments, Figure 4A is a display schematic diagram of a volume cloud to be rendered provided in an embodiment of the present application. Figure 4A The volume cloud to be rendered is taken as an example.
[0111] In step S102, density information is sampled to obtain a plurality of density sampling values, and a grid model of a volume cloud to be rendered is generated based on the density sampling values and preset three-dimensional grid units.
[0112] In an embodiment of the present application, the density information may be sampled based on a preset interval to obtain a plurality of density sampling values. The preset interval may be a value set in advance based on experience. For example, assuming that the size of the density information is 500*300*200 and the preset interval is 10, 50*30*20 density sampling values may be obtained through sampling.
[0113] In the embodiments of the present application, Figure 4B This is a schematic diagram showing the structure of a three-dimensional grid unit provided in an embodiment of the present application, see Figure 4B , the three-dimensional grid unit includes three rectangular facets, and any two rectangular facets are perpendicular to each other and intersect, wherein each rectangular facet is composed of two triangular sub-facets. In other embodiments, the three-dimensional grid unit may also include four or five rectangular facets, and the embodiment of the present application does not limit the number of rectangular facets in the three-dimensional grid unit.
[0114] In some embodiments, the implementation process of the above-mentioned "generating a grid model of a volume cloud to be rendered based on density sampling values and preset three-dimensional grid units" can be: for each density sampling value, when the density sampling value meets the density condition, a three-dimensional grid unit is set with the target coordinate corresponding to the density sampling value as the center; and when the density sampling value does not meet the density condition, the three-dimensional grid unit is not set, that is, no processing is performed. Thus, a grid model of a volume cloud to be rendered is generated. Among them, Figure 4C is a schematic diagram showing a structure of a grid model of a volume cloud to be rendered provided in an embodiment of the present application. Figure 4C The grid model in Figure 4B The three-dimensional grid cells in 4C are generated, and the grid model in 4C is for Figure 4A The mesh model of the volume cloud to be rendered in .
[0115] In some embodiments, a density threshold may be set in advance based on experience. When the density sampling value is greater than the density threshold, it is determined that the density sampling value meets the density condition; and when the density sampling value is less than or equal to the density threshold, it is determined that the density sampling value does not meet the density condition. Figure 5 , the "generating a grid model of the volume cloud to be rendered based on the density sampling value and the preset three-dimensional grid unit" in the above step S102 can be implemented by the following steps S1021 to S1023, which are described in detail below.
[0116] In step S1021, a target density value greater than a density threshold is determined from a plurality of density sampling values.
[0117] In some embodiments, the density threshold may be a value set in advance based on experience. For example, the density threshold may be 0.1, 0.15, 0.2, etc., wherein the density value ranges from 0 to 1, and a density value of 0 indicates that there is no density at the corresponding target coordinates, that is, there is no volume cloud to be rendered at the corresponding target coordinates; a density value of 1 indicates that the density at the corresponding target coordinates is the maximum. The density threshold may be used as a measure of whether there is a volume cloud to be rendered.
[0118] For example, assuming that the density sampling value is If the density threshold is 0.1, the target density values are 0.4, 0.6, 0.8, and 1.
[0119] In step S1022, the target coordinates of the target density value in the reference coordinate system are obtained.
[0120] In the embodiment of the present application, the reference coordinate system is a coordinate system constructed based on density information. The density information is used to characterize the density of each voxel in the volume cloud to be rendered, and each voxel in the volume cloud to be rendered is arranged in a three-dimensional order. Since the density information corresponds to the voxel, based on this, the density information is also arranged in a three-dimensional order. The density information located in the lower left corner can be determined as the original density information, and the original density information is used as the coordinate origin to construct a three-dimensional coordinate system to obtain the target coordinate system.
[0121] In some embodiments, after the target density value is determined, the target coordinates of the target density value in the reference coordinate system are also determined. For example, the target coordinates may be (10, 0, 20), (100, 60, 40), (400, 100, 160), etc.
[0122] In step S1023, a three-dimensional grid unit is set with the target coordinate as the center to obtain a grid model of the volume cloud to be rendered.
[0123] In some embodiments, following the above example, three-dimensional grid units are set with (10, 0, 20), (100, 60, 40), and (400, 100, 160) as centers, that is, the centers of the three three-dimensional grid units are respectively set at (10, 0, 20), (100, 60, 40), and (400, 100, 160), and a total of three three-dimensional grid units are set to obtain a grid model of the volume cloud to be rendered. In the example of the embodiment of the present application, the grid model of the volume cloud to be rendered includes three three-dimensional grid units.
[0124] Through the above steps S1021 to S1023, by determining the target density value from the density sampling value, the internal structure and density distribution of the volume cloud to be rendered can be accurately represented. Rendering only the part with a density greater than the threshold can reduce unnecessary rendering calculations and improve rendering efficiency. Determining the target density value and the target coordinates can better simulate the transparency and lighting effects of the volume cloud to be rendered, thereby enhancing the realism of the rendering. In dynamic scenes, the density sampling value and the threshold can be updated in real time to adapt to the dynamic changes of the volume cloud. The density and transparency of the volume cloud can be controlled by adjusting the density threshold, providing flexibility to adapt to different rendering requirements. By creating and rendering only the necessary grid cells, the use of memory and video memory can be reduced, and resource consumption can be reduced. Setting the three-dimensional grid unit centered on the target coordinates can ensure the quality and accuracy of the grid and avoid unnecessary grid distortion or deformation.
[0125] Continue to see Figure 3 , and the description continues with step S102 above.
[0126] In step S103, the texture map and brightness information of the mesh model are acquired from the reference parameter set based on the vertex information of the mesh model.
[0127] In an embodiment of the present application, the reference data set includes a reference texture atlas and a preset lookup table.
[0128] In some embodiments, the reference texture atlas may include multiple texture images, which are combined together to reduce the number of drawing calls and improve rendering efficiency. The reference texture atlas may include texture images of different textures, that is, the reference texture atlas has content diversity; the reference texture atlas displays complex data in an intuitive and easy-to-understand visual form to achieve visual display. The reference texture atlas also has an indexing and classification system, allowing users to quickly find the information they need to achieve the purpose of indexing and classification.
[0129] In other embodiments, the reference texture atlas can reduce the number of files required for the game to load textures by integrating multiple textures into a large texture atlas, thereby reducing loading time and memory usage, that is, reducing loading overhead. When multiple objects use textures in the same texture atlas, the GPU can reduce the number of texture bindings, and since the texture has been preloaded into a bound texture unit, rendering efficiency can be improved. Using a reference texture atlas, multiple objects can use one draw call (Draw Call) to complete rendering, reducing draw calls. Since multiple objects share the same texture, this reduces the communication overhead from the CPU to the GPU and improves rendering efficiency. The reference texture atlas can reduce memory fragmentation because the texture maps in the reference texture atlas are usually stored contiguously in memory, which optimizes memory usage and helps improve memory access efficiency.
[0130] In some embodiments, the preset lookup table maps pixel values through a predefined table to quickly change the color, brightness, contrast and other attributes of the image. In the embodiment of the present application, the brightness of the volume cloud to be rendered is quickly changed through a preset lookup table.
[0131] In practical applications, preset lookup tables can be used to change the overall color tone of an image, for example, mapping colors to different color spaces, or simulating the look and style of film to achieve color correction and conversion. The exposure of an image can be adjusted through a preset lookup table, so that overexposed or underexposed images can be corrected to achieve exposure adjustment. The preset lookup table can enhance the contrast of an image to make the difference between light and dark more obvious, or adjust the brightness to make the image brighter or darker as a whole, to achieve contrast and brightness adjustment. In high dynamic range image processing, a preset lookup table is used to map high dynamic range data to a display device with a low dynamic range for easy display and to achieve tone mapping. In film and video production, preset lookup tables are widely used to create specific visual styles, such as retro tones, cool tones, or warm tones, to achieve color stylization. When color matching is performed between different scenes or different devices, a preset lookup table helps to ensure color consistency and achieve color matching. In an embodiment of the present application, brightness is adjusted using a preset lookup table.
[0132] In video game scenarios, preset lookup tables can be used to simulate different lighting conditions, or to add specific color filters in game post-production to enhance the atmosphere of the game. In movie post-production scenarios, preset lookup tables are used for color grading, creating specific color styles, and ensuring that these color styles remain consistent when applied to different playback devices. In photography post-processing scenarios, preset lookup tables can be used to quickly implement color correction and improve work efficiency. In scientific imaging, medicine, and scientific research scenarios, preset lookup tables can be used to adjust the contrast of images to make the details in the image clearer.
[0133] In some embodiments, the preset lookup table works by defining the mapping relationship between input values and output values through a table. When the image processing software reads each pixel value of the image, it will look up the corresponding value in the preset lookup table and replace the original pixel value with this value. In this way, the color and other attributes of the image will change according to the definition of the preset lookup table.
[0134] In some embodiments, the reference parameter set includes a reference texture atlas, the mesh model includes a plurality of facets, and the vertex information of the mesh model includes vertex information of each facet. Based on this, see Figure 6, the "obtaining the texture map of the mesh model from the reference parameter set based on the vertex information of the mesh model" in the above step S103 can be implemented by the following steps S1031A and S1032A, which are described in detail below.
[0135] In step S1031A, for each patch in the mesh model, a texture map index is determined based on vertex information of the patch.
[0136] In the embodiment of the present application, the patch corresponds to the above-mentioned rectangular patch, the mesh model may include multiple three-dimensional mesh units, each three-dimensional mesh unit may include three patches, each patch may include four vertices, and the vertex information of the patch refers to the vertex information of the four vertices included in the patch. The vertex information may include vertex coordinates, normal vectors, and index coordinates.
[0137] The implementation process of the above-mentioned “determining the texture map index based on vertex information of the face patch” may include: obtaining the target index coordinates of the preset vertex from the index coordinates of multiple vertices in the face patch; and then determining the texture map index based on the target index coordinates.
[0138] In some embodiments, the vertex information includes index coordinates corresponding to each vertex identifier in the face patch. Based on this, the implementation process of the above step S1031A may include: obtaining target index coordinates corresponding to a preset vertex identifier from multiple index coordinates of the face patch, the target index coordinates including a first coordinate component of a first dimension and a second coordinate component of a second dimension; obtaining first parameters and second parameters for the texture map, the first parameters and the second parameters are reciprocals of each other; normalizing the first coordinate component based on the first parameter to obtain a first index of the first dimension, normalizing the second coordinate component based on the first parameter to obtain a second index of the second dimension; weighting the second index based on the second parameter to obtain a weighted index, and determining the sum of the weighted index and the first index as the texture map index of the face patch.
[0139] In some embodiments, the preset vertex identifier is used to indicate a preset vertex in the patch, and the preset vertex can be the vertex in the lower left corner of the patch, that is, among the four vertices of the patch, the target index coordinate of the preset vertex is the smallest. Since the target index coordinate includes the first coordinate component of the first dimension and the second coordinate component of the second dimension, based on this, it is also characterized that: compared with the other three vertices in the patch, the first coordinate component and the second coordinate component of the preset vertex are both the smallest. Exemplarily, the preset vertex identifier can be recorded as UA_BL, the first coordinate component can be recorded as UA_BL.x, and the second coordinate component can be recorded as UA_BL.y.
[0140] In some embodiments, the first parameter of the texture map may be a normalized size of the texture map. For example, assuming that the reference texture map set includes 4×4 texture maps, the normalized size of each texture map is 1 / 4, that is, 0.25.
[0141] Continuing with the above example, the above “normalizing the first coordinate component based on the first parameter to obtain the first index of the first dimension” can be implemented by the following formula (1).
[0142]
[0143] In the above formula (1), Index x represents the first index of the first dimension, UA_BL.x represents the first coordinate component, and 0.25 represents the first parameter.
[0144] Continuing with the above example, the above “normalizing the second coordinate component based on the first parameter to obtain the second index of the second dimension” can be implemented by the following formula (2).
[0145]
[0146] In the above formula (2), Index y represents the second index of the second dimension, UA_BL.y represents the second coordinate component, and 0.25 represents the first parameter.
[0147] Continuing with the above example, the above “performing weighted processing on the second index based on the second parameter to obtain a weighted index, and determining the sum of the weighted index and the first index as the texture map index of the patch” can be implemented by the following formula (3).
[0148] Index=Index y *4+Index x Formula (3);
[0149] In the above formula (3), Index represents the texture map index of the patch. x Indicates the first index of the first dimension, Index y represents the second index of the second dimension, and 4 represents the second parameter.
[0150] By determining the texture map index of the patch in the above manner, the mapping mode of the texture on the patch can be accurately controlled by normalizing and weighting the coordinate components, so as to better adapt to the shape and details of the patch. The use of the first parameter and the second parameter as reciprocals allows the horizontal and vertical scales of the texture on the patch to be adjusted independently, making the texture mapping more flexible. By normalizing, the index coordinates of the patch are converted into the valid index range of the texture map to ensure the correctness and validity of the texture coordinates. The introduction of the index after weighting can smooth the transition of the texture, reduce the aliasing and distortion during texture mapping, and improve the quality of the texture. The method can adapt to patches of different shapes and sizes, so that the texture image can better fit the patch and improve the visual effect of the model. By presetting the parameters and index coordinates, the real-time calculation of the texture coordinates during the rendering process is reduced, thereby improving the rendering efficiency. By associating the texture map index with the preset vertex identifier, the management and allocation process of the texture can be simplified.
[0151] In step S1032A, the texture map corresponding to the texture map index in the reference texture atlas is determined as the texture map of the patch.
[0152] In an embodiment of the present application, each texture map in the reference texture atlas corresponds to a unique texture map index. Therefore, the corresponding texture map can be determined from the reference texture atlas based on the texture map index, and the texture map corresponding to the texture map index can be determined as the texture map of the patch.
[0153] Continuing with the above example, assuming that the reference texture atlas includes 4×4 texture maps, and the texture map index is 10, the texture map in the third row and third column of the reference texture atlas is determined as the texture map of the patch.
[0154] Through the above steps S1031A and S1032A, by applying the texture map, detailed surface details such as color, pattern and texture can be provided for the patch, thereby significantly improving the visual effect and realism of the rendering. The texture map can simulate complex surface features without adding additional vertices or patches to the mesh model, which can increase the complexity and details of the model without sacrificing performance. Compared with increasing geometric details, texture mapping has higher performance because it provides details through image processing rather than increasing the complexity of the mesh. The texture map can be replaced or adjusted as needed to provide different appearances for the same model, thereby increasing the flexibility of scene construction. Using texture maps can simplify the modeling process because there is no need to manually create complex surface details, which can be simulated by textures. Texture maps can be dynamically adjusted to adapt to different scenes and lighting conditions to achieve dynamic visual effects. Texture maps in the texture atlas can be managed by indexes, which simplifies the process of loading and switching textures. Compared with storing a large amount of vertex colors or geometric details, texture mapping is usually more memory-efficient because texture maps can be compressed and can be reused.
[0155] In some embodiments, the reference parameter set also includes a preset lookup table, and the vertex information also includes the vertex coordinates of the vertex. Figure 7 , the "obtaining brightness information of the mesh model from the reference parameter set based on the vertex information of the mesh model" in the above step S103 can be implemented by the following steps S1031B to S1033B, which are described in detail below.
[0156] In step S1031B, for each patch in the mesh model, height information of the patch is determined based on multiple vertex coordinates of the patch.
[0157] In some embodiments, the vertex coordinates of each vertex are expressed in the form of (x, y, z), where y represents the height of the vertex. Since a face patch includes four vertices, based on this, the average height of the four vertices can be determined as the face patch's height information; the height of the highest vertex can also be determined as the face patch's height information; the height of the lowest vertex can also be determined as the face patch's height information.
[0158] In step S1032B, the height information and the preset constant term are combined to obtain the sampling coordinates.
[0159] In some embodiments, the preset constant term may be a set of values set based on experience. For example, the preset constant term may be (0.5, 0, 0). Assuming the height information is v, based on this, the sampling coordinates may be (v, 0.5, 0, 0).
[0160] In step S1033B, the brightness information of the patch is obtained from a preset lookup table based on the sampling coordinates.
[0161] In the embodiment of the present application, the brightness information may be a brightness value.
[0162] In some embodiments, if the preset lookup table is one-dimensional, the sampling coordinates may be directly used as indices to obtain brightness information.
[0163] In other embodiments, if the preset lookup table is two-dimensional or three-dimensional, it is necessary to index the preset lookup table according to each dimension of the sampling coordinate. For non-integer coordinates, an interpolation method may be used to obtain brightness information, such as nearest neighbor interpolation, linear interpolation, bilinear interpolation, or trilinear interpolation. This ensures the continuity and authenticity of the brightness information.
[0164] Through the above steps S1031B to S1033B, by obtaining brightness information from a preset lookup table, complex real-time calculations can be avoided and the efficiency of the rendering process can be improved. The use of a lookup table can simplify the implementation of the lighting model. There is no need to perform complex lighting calculations on each patch. The result can be obtained by simply looking up the table. Combined with the height of the patch, the impact of the ups and downs of the terrain on the lighting can be simulated more realistically, improving the realism of the scene. The use of a lookup table can reduce the space required to store the individual brightness information of each patch and optimize memory usage. The values in the preset lookup table are pre-calculated and optimized, which can reduce errors and unstable factors in real-time calculations. In scenes where the brightness needs to be adjusted dynamically, the lookup table can quickly provide new brightness information to achieve dynamic light and shadow effects. In short, this brightness acquisition method based on a lookup table and height information reduces the computational burden, improves rendering performance and flexibility while ensuring the rendering effect, and is suitable for various scenes that require dynamic lighting and complex lighting effects.
[0165] Continue to see Figure 3 , and the description continues with step S103 above.
[0166] In step S104, the mesh model is rendered based on the texture map and the brightness information to obtain a rendered image of the rendered volume cloud, and the rendered image is output.
[0167] In an embodiment of the present application, the texture map can be used as the density information of the corresponding face patch, that is, the texture map is used to represent the density of the corresponding face patch; the brightness information is also used as the brightness value of the corresponding face patch, thereby realizing the rendering processing of the mesh model.
[0168] In some embodiments, see Figure 8 The above step S104 can be implemented by the following steps S1041 to S1043, which are described in detail below.
[0169] In step S1041, the normal vector of each vertex in the mesh model is obtained from the vertex information.
[0170] In an embodiment of the present application, the vertex information includes the normal vector of the vertex. Based on this, the vertex information can be parsed first to obtain the parsed information; and then based on the storage field or storage position of the normal vector, the normal vector of the vertex can be obtained from the parsed information.
[0171] In some embodiments, before executing the above step S1041, it is necessary to first determine the normal vector of the vertex, and add the normal vector of the vertex to the vertex information of the vertex. Based on this, before executing the above step S1041, it is also possible to perform: for each vertex in the mesh model, determine the vertex vector of the vertex based on the vertex coordinates of the vertex; normalize the vertex vector to obtain the normal vector, and add the normal vector to the vertex information of the vertex.
[0172] In some embodiments, the center coordinates of the center point of the mesh model can be obtained, and then based on the center coordinates and the vertex coordinates, the vertex vector pointing from the center point to the vertex is determined; then, the vertex vector is normalized by length normalization to obtain a normal vector with a length of 1; finally, the normal vector is added to the vertex information of the vertex.
[0173] For example, assuming that the center coordinates are (5, 2, 6) and the vertex coordinates are (10, 3, 4), the vertex vector is (5, 1, -2) and the normal vector can be approximately expressed as (0.9129, 0.1826, -0.3645).
[0174] Through the above method of determining the normal vector, the normal vector is an important parameter for lighting calculation. The normal vector is used to determine the direction of light reflection at the vertex. The accurate normal vector can be determined by normalization to ensure the accuracy of lighting calculation. The normal vector directly affects the lighting effects of the surface, such as reflection, shadow and diffuse reflection. The accurate normal vector can significantly improve the realism of the rendering. The normal vector can be obtained directly based on the vertex vector, which can reduce the demand for memory and video memory during the rendering process. In this way, the normal vector of the vertex can be quickly determined, thereby reducing the computing overhead, saving rendering computing power, and improving rendering efficiency.
[0175] In step S1042, the light attenuation and light scattering of the mesh model are determined.
[0176] In some embodiments, the implementation process of "determining the light attenuation of the grid model" in the above step S1042 may include: obtaining the initial energy and the optical path length of each facet in the grid model; for each facet, determining a first attenuation value based on the first attenuation law and the optical path length of the facet; and determining a second attenuation value based on the second attenuation law and the optical path length; determining the difference between the initial energy and the second attenuation value; and determining the product of the first attenuation value and the difference as the light attenuation of the facet.
[0177] In some embodiments, the optical path length refers to the path length of light when it passes through the cloud, which directly affects the effect of the interaction between the light and the cloud, including scattering, absorption and attenuation. The optical path length of the patch can be determined by the product of the absorption coefficient and thickness of the cloud.
[0178] In some embodiments, the first attenuation law is used to describe the basic attenuation of the intensity of light when passing through a uniform cloud layer, and the first attenuation law assumes that the attenuation coefficient of the cloud layer is constant and the attenuation is only caused by the absorption of the cloud layer, wherein the first attenuation law may be the basic attenuation part of the Lambert-Beer law. The second attenuation law is used to represent the attenuation of light when passing through a cloud layer with twice the thickness, wherein the second attenuation law may be the thickness attenuation part of the Lambert-Beer law.
[0179] In some embodiments, the above “determining the first attenuation value based on the first attenuation law and the optical path length of the surface patch” can be implemented by the following formula (4).
[0180] AV1=e -sigmat Formula (4);
[0181] In the above formula (4), AV1 represents the first attenuation value, and sigmat represents the optical path length, which is the product of the absorption coefficient and the thickness.
[0182] In some embodiments, the above “determining the second attenuation value based on the second attenuation law and the optical path length” can be implemented by the following formula (5).
[0183] AV2=e -sigmat*2.0 Formula (5);
[0184] In the above formula (5), AV2 represents the second attenuation value, and sigmat represents the optical path length.
[0185] In some embodiments, the above “determining the product of the first attenuation value and the difference value as the illumination attenuation amount of the surface patch” can be implemented by the following formula (6).
[0186] AV_t=AV1*(init_energy-AV2) formula (6);
[0187] In the above formula (6), AV_t represents the light attenuation, AV1 represents the first attenuation value, AV2 represents the second attenuation value, and init_energy represents the initial energy. The initial energy is a value preset in advance based on experience, and the exemplary initial energy may be 1.
[0188] By the above method of determining the amount of light attenuation, by considering the optical path length and the attenuation law, the propagation and attenuation of light in the medium can be simulated more realistically, thereby improving the quality and realism of the rendered image. Calculating the optical path attenuation can ensure that the light energy follows the law of conservation during the propagation process and avoid the occurrence of non-physical lighting effects. By calculating the first attenuation value and the second attenuation value respectively, the illumination intensity of different patches can be more finely controlled to achieve more complex lighting effects. For the patches in the scene, by pre-calculating their light attenuation, the computational burden during real-time rendering can be reduced, thereby improving rendering efficiency. Different attenuation laws (such as exponential attenuation, linear attenuation, etc.) can be combined to more flexibly simulate the propagation of light in different types of media. The method for determining the amount of light attenuation is simple, easy to implement in the existing graphics rendering pipeline, and can be adjusted and optimized as needed.
[0189] Through the above steps, the behavior of light can be simulated more accurately during the rendering process, improving the realism and rendering efficiency of graphics, which is very valuable for the creation of high-quality graphics content and scientific computing.
[0190] In some embodiments, the implementation process of "determining the amount of light scattering of the mesh model" in the above step S1042 may include: for each facet in the mesh model, obtaining the scattering direction parameter, the angle between the incident light of the facet and the observation direction of the facet; based on the scattering law, the scattering direction parameter and the angle, determining the amount of light scattering of the facet.
[0191] In some embodiments, the scattering direction parameter may be an anisotropic parameter. The scattering law refers to the phenomenon that when light passes through an uneven cloud layer, a portion of the light deviates from the original propagation direction. This phenomenon can be described by a mathematical formula. For example, the scattering law may be one of Henyey-Greenstein scattering, Rayleigh scattering, Mie scattering, and Debye scattering.
[0192] In some embodiments, the scattering direction parameter is a parameter used to describe the light scattering characteristics in a scattering medium (such as the atmosphere, clouds, emulsions, etc.). This parameter is used in the Henyey-Greenstein phase function to simulate the angular distribution of light scattered by particles. The value of the scattering direction parameter is usually between -1 and 1, and the scattering direction parameter describes the degree of anisotropy of the scattered light: when the scattering direction parameter is -1, the scattering is anisotropic, and the light tends to scatter forward. When the scattering direction parameter is 0, the scattering is isotropic, and the probability of light scattering in all directions is the same. When the scattering direction parameter is 1, the scattering is anisotropic, and the light tends to scatter backward.
[0193] In practical applications, when simulating the transmission of light in the atmosphere, water or biological tissues, the scattering direction parameters can affect the scattering pattern of light, thereby affecting the overall lighting and visual effects. In climatology, the scattering direction parameters are very important for calculating the scattering and radiation transmission of light in the atmosphere, and the scattering direction parameters affect the amount of solar radiation received by the surface. In computer graphics, the scattering direction parameters are used in rendering techniques such as ray detection and radiosity methods to more realistically simulate the appearance of scattering materials. In the field of remote sensing, the scattering direction parameters can interpret and analyze the reflected signals received from satellite sensors to better understand the surface characteristics. In biological tissues, the scattering properties of light are very important for imaging and optical diagnosis, and the scattering direction parameters help describe the light transmission characteristics inside the tissue.
[0194] In some embodiments, the above “determining the light scattering amount of the surface based on the scattering law, scattering direction parameters and the angle” can be achieved by the following formula (7).
[0195]
[0196] In formula (7), SA represents the light scattering amount of the patch, g represents the scattering direction parameter, θ represents the angle, and pow(a,b) represents the calculation of a to the power of b.
[0197] Through the above method for determining the amount of light scattering, the embodiment of the present application provides a simple and effective scattering simulation method, which can produce a more realistic light scattering effect, so that the rendered object surface looks more natural and real. The process of calculating the scattering amount in the embodiment of the present application is relatively simple, with high calculation efficiency, and is suitable for real-time rendering applications. By adjusting the scattering direction parameter (anisotropy parameter), the directionality of the scattered light can be flexibly controlled to simulate the scattering characteristics of different types of surfaces. The above method for determining the amount of light scattering can be applied to various materials, including rough surfaces and smooth surfaces, and can adapt to different scattering effects by adjusting the parameters. The determined amount of light scattering can improve the light transition on the surface of the object, avoid areas that are too bright or too dark, and make the image smoother and more natural. In an environment with dynamic lighting changes, the amount of light scattering of the facet under the new lighting conditions can be quickly calculated to support real-time dynamic rendering. The above method for determining the amount of light scattering is easy to integrate into the existing graphics rendering pipeline because it only requires a small amount of additional information and calculations.
[0198] In step S1043, the mesh model is rendered using the texture map, brightness information, normal vector, light attenuation, and light scattering to obtain a rendered image of the volume cloud to be rendered.
[0199] In some embodiments, the grid model includes multiple three-dimensional grid units, and the implementation process of the above step S1043 may include: determining the distance between each three-dimensional grid unit and the acquisition module; sorting the multiple three-dimensional grid units in order of distance from far to near to obtain a sorted grid unit sequence; using texture maps, brightness information, normal vectors, light attenuation and light scattering, rendering each three-dimensional grid unit in the sorted grid unit sequence in turn to obtain a rendered image.
[0200] In some embodiments, it is assumed that the grid model includes six three-dimensional grid units, namely three-dimensional grid unit 1 to three-dimensional grid unit 6. If the distances from the acquisition module are 20 meters, 18 meters, 23 meters, 21 meters, 16 meters, and 22 meters, respectively, based on this, the six three-dimensional grid units are sorted in order from far to near to obtain a sorted grid unit sequence, and the sorted grid unit sequence is (three-dimensional grid unit 3, three-dimensional grid unit 6, three-dimensional grid unit 4, three-dimensional grid unit 1, three-dimensional grid unit 2, three-dimensional grid unit 5).
[0201] In some embodiments, in order to avoid the problem of confusing rendering effects caused by changes in the relative order of cloud layers in the volume cloud to be rendered, the present application determines the distance between each three-dimensional grid unit and the acquisition module when the acquisition angle of the acquisition module changes; and sorts the multiple three-dimensional grid units in order of distance from far to near to obtain a sorted grid unit sequence; finally, each three-dimensional grid unit in the sorted grid unit sequence is rendered in turn to obtain a rendered image, that is, the three-dimensional grid units are rendered in order from far to near, thereby improving the accuracy of rendering.
[0202] By using the above-mentioned method of sorting first and then rendering, sorting the three-dimensional grid units according to distance can ensure that when rendering transparent or semi-transparent objects, distant objects are rendered first and near objects are rendered later. This can avoid rendering errors, such as penetration between objects or incorrect transparency mixing. By sorting by distance, higher rendering accuracy can be used for nearby objects, while lower accuracy or simplified models can be used for distant objects, which helps to optimize rendering performance while maintaining visual effects. After sorting, the rendering priority can be determined according to the distance between the three-dimensional grid unit and the acquisition module (such as a camera), so that nearby objects that have a greater impact on visual effects can be rendered preferentially within a limited time. For distant three-dimensional grid units, fewer lighting calculations and texture details can be used, thereby saving computing resources and improving overall rendering efficiency. Using information such as texture maps, brightness information, normal vectors, light attenuation, and light scattering for rendering processing can more realistically simulate the lighting and material effects of objects, thereby enhancing the realism of the image. In dynamic scenes, the distance between objects and the acquisition module may change continuously, and pre-sorting can quickly update the rendering list to adapt to changes in the scene. Sorting allows for hierarchical rendering techniques, where, for example, objects that are farther away and contribute less to the scene can be rendered first, followed by closer, more detailed objects.
[0203] In some embodiments, the implementation process of the above-mentioned "using texture maps, brightness information, normal vectors, light attenuation and light scattering to render each three-dimensional grid unit in the sorted grid unit sequence in turn to obtain a rendered image" may include: creating a rendering buffer; for each three-dimensional grid unit in the sorted grid unit sequence, using texture maps, brightness information, normal vectors, light attenuation and light scattering, rendering the three-dimensional grid unit to obtain a rendering result of the three-dimensional grid unit; storing each rendering result in the rendering buffer; and constructing a rendered image based on each rendering result in the rendering buffer.
[0204] In some embodiments, creating a rendering buffer may be considered as initializing a rendering buffer, where the rendering buffer is used to store pixel data during the rendering process.
[0205] In some embodiments, the implementation process of "rendering the three-dimensional grid unit" can be: using texture coordinates, normal vectors and other information, rendering through vertex shaders and fragment shaders. In the vertex shader, the lighting effect is calculated based on the vertex coordinates and normal vectors of the grid unit. In the fragment shader, the texture map, brightness information and normal vector are used, combined with the light attenuation and light scattering to determine the final color of each three-dimensional grid unit, that is, to obtain the rendering result of the three-dimensional grid unit, for example, the rendering result can be color, depth information, etc.
[0206] In some embodiments, the color of the three-dimensional grid unit is also output to the frame buffer, that is, the rendering result of each three-dimensional grid unit is stored in the rendering buffer, that is, the rendering result is written into the frame buffer or texture.
[0207] In some embodiments, the data in the render buffer is used to construct the final rendered image through a final post-processing step, for example, the post-processing step includes blurring, tone mapping, etc.
[0208] Through the above rendering method based on the rendering buffer, by creating a rendering buffer and storing the rendering results, repeated rendering calculations can be avoided, especially in the case where the rendering results need to be reused multiple times, such as scene rendering when dynamic lighting changes or viewpoints move, thereby improving rendering efficiency. By using texture maps, brightness information, normal vectors, and light attenuation and light scattering, the lighting and material effects can be simulated more realistically, making the rendered three-dimensional grid units more realistic. Sorting the grid units can optimize the rendering order, avoid overlapping errors between transparent objects during rendering, and ensure the rendering effect with correct transparency; in addition, sorting can also help determine the priority of rendering, for example, objects farther away from the camera can be rendered first, so that more efficient algorithms can be applied during post-processing. By adjusting the light attenuation and scattering, the lighting effects of different grid units can be flexibly controlled to achieve more complex light and shadow effects and dynamic lighting changes. The rendering results are stored in the buffer, which can be easily post-processed, such as applying color correction, depth of field, motion blur and other effects to enhance the visual effect of the final image. The rendering results of grid cells can be processed and combined individually, providing higher flexibility and facilitating the implementation of various rendering techniques, such as ray detection, shadow rendering, etc. By centrally managing rendering results, memory and video memory resources can be used more efficiently to avoid resource waste.
[0209] Through the above steps S1041 to S1043, by using information such as normal vectors, light attenuation and light scattering, the lighting effect of the volumetric cloud can be simulated more realistically, thereby improving the quality of the rendered image. The use of texture maps and brightness information can increase the details and texture of the volumetric cloud, making the rendered image more realistic and beautiful. Determining the light attenuation and light scattering helps to optimize the lighting calculation, making the lighting effect more natural while avoiding over-calculation. When the scene or lighting conditions change, the lighting parameters can be quickly updated to achieve dynamic rendering effects. By preprocessing and calculating the lighting parameters, the amount of calculation during real-time rendering can be reduced and the rendering efficiency can be improved. By adjusting parameters such as texture maps, light attenuation and scattering, the appearance and lighting effects of the volumetric cloud can be flexibly changed. Through effective lighting calculation and rendering processing, the demand for computing resources and storage resources can be reduced.
[0210] In other embodiments, after the above step S104, the rendered image may be synthesized into a virtual scene. The virtual scene refers to a virtual scene displayed by the terminal. For example, the virtual scene may be a shooting competition scene. At this time, the rendered image is displayed in the virtual scene so that the virtual scene can present a volumetric cloud effect, thereby enriching the display elements of the virtual scene and improving the authenticity of the virtual scene.
[0211] Through the above steps S101 to S104, a grid model of the volume cloud to be rendered is generated based on the preset three-dimensional grid unit. Since the three-dimensional grid unit is a three-dimensional structure, the grid model has information in three dimensions. Such information based on three dimensions can increase the sense of space and depth of rendering. In addition, the embodiment of the present application obtains the texture map and brightness information from the reference data set based on the vertex information of the grid model, that is, the texture map and brightness information are obtained from the reference data set by a one-time sampling method without the need for real-time cloud density accumulation, thereby simplifying the determination process of the texture map and brightness information and reducing the computational overhead. Finally, the grid model is rendered based on the texture map and brightness information to obtain a rendered image of the volume cloud to be rendered, and the rendered image is output. Since the texture map and brightness information are obtained by a one-time sampling method, the texture image and brightness information can be quickly obtained, thereby shortening the rendering time and improving the rendering efficiency.
[0212] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.
[0213] The embodiment of the present application proposes a rendering method, which is used to render volumetric clouds and can improve the performance of volumetric cloud rendering. Use DCC software to shape a controllable cloud shape in advance, and with the help of VDB data structure, use density points to generate a set of three inserts and a simplified lighting model to generate a volumetric cloud that can be directly rendered to the engine. The rendering method of the embodiment of the present application is used to replace the related raymarch volumetric cloud, which solves the problems of high overhead and uncontrollable cloud shaping, and has wide hardware compatibility. Among them, the volumetric cloud corresponds to the volumetric cloud to be rendered in other embodiments, and the three inserts correspond to the preset three-dimensional grid units in other embodiments.
[0214] The key technologies adopted in the embodiments of the present application include normal information simplification, illumination model simplification and real-time semi-transparent sorting, among which, normal information simplification means that the three-piece mesh data directly records the normal information for cloud illumination calculation, which is different from the traditional billboard cloud and has a better sense of volume. Illumination model simplification means that when rendering clouds, real-time cloud density accumulation is not performed, but two-dimensional density and height lookup table (Lookup Table, LUT) texture is sampled, and density sampling is performed only once in the line of sight direction, and finally, a cloud effect with a certain sense of body is obtained through integration. Real-time semi-transparent sorting means that when rendering multiple clouds, there is a sequence for semi-transparent mixing, and real-time sorting calculation is required. For example, the central processing unit (CPU) sorting method or the graphics processing unit (GPU) sorting method can be used.
[0215] In games, cloud effects can make scenes richer and more beautiful, improving the overall look and feel and gaming experience. In addition, the distribution of clouds in nature may vary, and there are many types of clouds. Adding multiple cloud effects to a scene will add a certain burden to game performance. To this end, either reduce the types of clouds or consider reducing cloud overhead.
[0216] In order to ensure that the shape of the cloud is highly controllable, DCC software is used to implement the shaping part of the cloud, and the engine only needs to focus on the rendering part. In order to further reduce the cost of volumetric clouds, a grid method is adopted, which reduces the cost of full-screen coordinate reconstruction on the one hand, and facilitates cone cutting on the other hand. In this way, only a rough cloud template needs to be provided in DCC, and there is no need to care about too many vertex details; the thickness of the cloud can be simulated in the engine for easy control; it can also realize the interaction between the cloud and the character; it is convenient for reproduction, has low performance overhead, and can realize cone culling.
[0217] In the embodiment of the present application, the hardware environment may be a hardware device having a display chip, such as a computer, a mobile phone, a game console, etc.
[0218] Fig. 9is a third flow chart of the rendering method provided in the embodiment of the present application, see Fig. 9 , Fig. 9 The execution subject may be a terminal, and the rendering method includes the following steps:
[0219] Step S801, start rendering.
[0220] In an embodiment of the present application, rendering may be started in response to a trigger instruction for a rendering control. Exemplarily, the trigger instruction may be a touch operation, a click operation, etc. for the rendering control. In some embodiments, rendering may also be started directly through voice, gesture, posture, and other instructions.
[0221] In step S802, a VDB file is generated by digital content creation software.
[0222] In an embodiment of the present application, a cloud-like VDB file is created using DCC software for subsequent generation of a three-piece mesh, wherein the DCC software may be Houdini or EmberGen, and each three-piece mesh is composed of three Billobards.
[0223] In step S803, the point coordinates and point normal of the sampling point are obtained.
[0224] In the embodiment of the present application, by using the engine customization tool and the interval point sampling method, a point set within the preset threshold density range is obtained, and points with density values within the preset threshold density range are determined as sampling points, and the point coordinates and point normals of the sampling points are collected. The preset threshold density range is used to characterize the existence of volumetric clouds, and the preset threshold density range can be (0.1, 1).
[0225] In step S804, a three-slot grid is generated, and the process proceeds to step S806.
[0226] In the embodiment of the present application, a three-slot grid corresponding to the location of each sampling point coordinate can be generated based on the point coordinate of each sampling point. Based on this, multiple three-slot grids can constitute a grid model.
[0227] In step S805, the density texture, light attenuation, light scattering and brightness information in the line of sight direction are determined.
[0228] In the embodiment of the present application, a texture atlas including 4×4 texture maps is used for determining the density texture of the sight direction. Fig.10 is a display schematic diagram of a texture atlas provided in an embodiment of the present application, see Fig.10The texture atlas includes 16 single-channel 2D images to represent the texture map of each patch, that is, the cloud density map, so there is no need to perform real-time cloud density accumulation, and the density map can be directly sampled, thus reducing GPU calculations. The texture atlas corresponds to the reference texture atlas in other embodiments.
[0229] For light attenuation, Beer Power can be used to calculate light attenuation based on thickness along the direction of the light source. Fig.11 This is a schematic diagram of displaying a volumetric cloud after light attenuation provided in an embodiment of the present application.
[0230] For the amount of light scattering, the HG phase function can be used to express direct light scattering. Fig.12 It is a schematic diagram of displaying a volume cloud after light scattering provided in an embodiment of the present application.
[0231] For the brightness information, LUT is introduced to highlight the light and dark layers of the clouds. Fig.13 This is a schematic diagram showing the transition of cloud layer brightness from bright to dark provided in an embodiment of the present application, see Fig.13 , the clouds transition naturally from top to bottom, from bright to dark.
[0232] In step S806, the three-slice mesh is rendered using the density texture, light attenuation, light scattering and brightness information to obtain a rendering result, and the rendering result is stored in a cloud rendering target.
[0233] In some embodiments, since the three-slice grid includes multiple three-slices, the number of rendering results in the three-slice dimension is multiple. Based on this, a buffer can be created first, and then the rendering results can be stored in the cloud rendering target in the order of the three-slices from far to near, to obtain a processed cloud rendering target.
[0234] In step S807, the processed cloud rendering target is output to the screen.
[0235] In the embodiment of the present application, the processed cloud rendering target corresponds to the rendered image in other embodiments.
[0236] In some embodiments, the volumetric cloud may be output to a screen based on a cloud render target.
[0237] In some embodiments, since the three-piece insert is a three-dimensional structure, compared with the billboard normal, the volume cloud based on the three-piece insert can provide normal information with a stronger sense of body and space. Table 1 is a comparison table of normal information.
[0238] Table 1 Normal information comparison table
[0239]
[0240] In combination with the above Table 1, the first method may be a method of calculating normals based on a hemisphere, the second method may be a method of calculating normals based on a point cloud library, and the third method may be a method of calculating normals based on thickness.
[0241] In some embodiments, for the insert cloud, the normal information of the vertex can be obtained by calculating the normal of the hemisphere, and then the volume cloud rendering can be performed based on the normal information to obtain Fig.14A The rendering effect is shown in the figure; for Billboard, the normal information of the vertex can be obtained by calculating the normal of the hemisphere, and then the volume cloud rendering is performed based on the normal information to obtain Fig. 14B The rendering effect is shown in the figure; for Billboard, the normal information of the vertex can be obtained by calculating the normal through the point cloud library, and then the volume cloud rendering is performed based on the normal information to obtain Fig. 14C The rendering effect is shown in the figure; for Billboard, the normal information of the vertex can be obtained by calculating the normal through thickness, and then after volume cloud rendering based on the normal information, we can get Fig.14D The rendering shown.
[0242] In some embodiments, the above-mentioned implementation process of calculating normals based on the hemisphere may be: traversing the position information of each vertex, normalizing the position information of each vertex, that is, changing the length of the vertex vector to 1, while keeping the direction of the vertex vector unchanged, and obtaining the normal vector of the vertex. The normal vector is recorded in the mesh data.
[0243] In some embodiments, when the lens changes, the relative order in which semi-transparent objects are rendered may change, causing the effect to blend and become confusing. Fig.15A is a schematic diagram of a volume cloud with mixed and disordered effects provided by an embodiment of the present application, Fig.15A It can be seen that from the picture, the display shows some clouds behind that should be obscured, such as Fig.15A The white part in the middle, that is Fig.15A In the area where 1501 is located, the upper half of the block is actually the cloud behind and should not be displayed. Therefore, it is necessary to calculate the order of the cloud layer in real time, that is, to perform real-time semi-transparent sorting, and update the relative order of rendering based on the sorting result, and then render based on the updated order. Fig. 15B is a display schematic diagram of a semi-transparent sorted volume cloud provided in an embodiment of the present application, Fig. 15B It can be seen that Fig. 15B Corrected the white and black areas in the middle of volumetric clouds so that volumetric clouds can be displayed correctly.
[0244] In some embodiments, CPU sorting can be used, for example, based on a quick sorting algorithm, to determine the distance between each three-plug and the acquisition module, and then sort each three-plug from far to near according to the distance. Fig.16 The three three-plugs are respectively recorded as three-plug 1, three-plug 2 and three-plug 3, among which the distance between three-plug 1 and the acquisition module can be recorded as distance 1, the distance between three-plug 2 and the acquisition module can be recorded as distance 2, and the distance between three-plug 3 and the acquisition module can be recorded as distance 3. Since distance 1 is greater than distance 2, and distance 2 is greater than distance 3, the sorting result of the three plugs through CPU sorting is: three-plug 1, three-plug 2, three-plug 3.
[0245] In other embodiments, GPU sorting can also be used, for example, based on a bitonic sorting algorithm, each three-slot is sorted according to distance, with a space complexity of O(n) and a time complexity of O(n(log(n))^2). Due to the parallel computing capability of the GPU, the final time complexity can be reduced to O((log(n))^2).
[0246] Through the rendering method provided in the embodiment of the present application, the light and dark contrast and the sense of depth of the volumetric cloud can be improved, and the details and colors of the volumetric cloud can be enriched, thereby improving the visual effect of the volumetric cloud. In addition, through real-time semi-transparent sorting, the accuracy and sense of space of the rendering can be improved. And because the embodiment of the present application obtains the density map and brightness information by sampling, it can reduce the overhead, thereby improving the rendering efficiency.
[0247] It can be understood that in the embodiments of the present application, density information, vertex information, reference data set, target coordinates, preset vertex identifiers, normalized size, initial energy, optical path length, scattering direction parameters, angle and other related data are involved, and the collection, use and processing of such related data need to comply with relevant laws, regulations and standards.
[0248] The following further describes an exemplary structure of the rendering device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules stored in the rendering device 455 of the memory 450 may include:
[0249] The first acquisition module 4551 is used to obtain density information of the volume cloud to be rendered; the generation module 4552 is used to sample the density information to obtain multiple density sampling values, and generate a mesh model of the volume cloud to be rendered based on the density sampling values and preset three-dimensional mesh units; the second acquisition module 4553 is used to obtain the texture map and brightness information of the mesh model from a reference parameter set based on the vertex information of the mesh model; the rendering module 4554 is used to render the mesh model based on the texture map and the brightness information to obtain a rendered image of the volume cloud to be rendered, and output the rendered image.
[0250] In some embodiments, the generation module 4552 is also used to: determine a target density value greater than a density threshold from a plurality of density sampling values; obtain the target coordinates of the target density value in a reference coordinate system, wherein the reference coordinate system is a coordinate system constructed based on the density information; and set the three-dimensional grid unit with the target coordinates as the center to obtain a grid model of the volume cloud to be rendered.
[0251] In some embodiments, the reference parameter set includes a reference texture atlas, the mesh model includes multiple patches, and the vertex information of the mesh model includes vertex information of each patch. Based on this, the second acquisition module 4553 is also used to: for each patch in the mesh model, determine the texture map index based on the vertex information of the patch; and determine the texture map corresponding to the texture map index in the reference texture atlas as the texture map of the patch.
[0252] In some embodiments, the vertex information includes index coordinates corresponding to each vertex identifier in the face patch. Based on this, the second acquisition module 4553 is also used to: obtain target index coordinates corresponding to a preset vertex identifier from multiple index coordinates of the face patch, and the target index coordinates include a first coordinate component of a first dimension and a second coordinate component of a second dimension; obtain a first parameter and a second parameter for the texture map, and the first parameter and the second parameter are reciprocals of each other; normalize the first coordinate component based on the first parameter to obtain a first index of the first dimension, and normalize the second coordinate component based on the first parameter to obtain a second index of the second dimension; weight the second index based on the second parameter to obtain a weighted index, and determine the sum of the weighted index and the first index as the texture map index of the face patch.
[0253] In some embodiments, the reference parameter set also includes a preset lookup table, and the vertex information also includes vertex coordinates of the vertices. Based on this, the second acquisition module 4553 is also used to: for each face in the mesh model, determine the height information of the face based on the multiple vertex coordinates of the face; combine the height information and the preset constant term to obtain the sampling coordinates; and obtain the brightness information of the face from the preset lookup table based on the sampling coordinates.
[0254] In some embodiments, the rendering module 4554 is also used to: obtain the normal vector of each vertex in the mesh model from the vertex information; determine the light attenuation and light scattering of the mesh model; and render the mesh model using the texture map, the brightness information, the normal vector, the light attenuation and the light scattering to obtain a rendered image of the volume cloud to be rendered.
[0255] In some embodiments, the rendering module 4554 is also used to: obtain the initial energy and the optical path length of each facet in the mesh model; for each facet, determine a first attenuation value based on a first attenuation law and the optical path length of the facet; and determine a second attenuation value based on a second attenuation law and the optical path length; determine the difference between the initial energy and the second attenuation value; and determine the product of the first attenuation value and the difference as the light attenuation amount of the facet.
[0256] In some embodiments, the rendering module 4554 is also used to: obtain, for each facet in the mesh model, a scattering direction parameter and an angle between the incident light of the facet and the observation direction of the facet; and determine the amount of light scattering of the facet based on the scattering law, the scattering direction parameter and the angle.
[0257] In some embodiments, the grid model includes multiple three-dimensional grid units. Based on this, the rendering module 4554 is also used to: determine the distance between each three-dimensional grid unit and the acquisition module; sort the multiple three-dimensional grid units in the order of the distance from far to near to obtain a sorted grid unit sequence; use the texture map, the brightness information, the normal vector, the light attenuation and the light scattering to render each three-dimensional grid unit in the sorted grid unit sequence in turn to obtain the rendered image.
[0258] In some embodiments, the rendering module 4554 is also used to: create a rendering buffer; for each three-dimensional grid unit in the sorted grid unit sequence, use the texture map, the brightness information, the normal vector, the light attenuation and the light scattering to render the three-dimensional grid unit to obtain a rendering result of the three-dimensional grid unit; store each of the rendering results in the rendering buffer; and construct a rendered image based on each of the rendering results in the rendering buffer.
[0259] In some embodiments, the software modules stored in the rendering device 455 of the memory 450 further include:
[0260] A synthesis module is used to synthesize the rendered image into a virtual scene.
[0261] In some embodiments, the software modules stored in the rendering device 455 of the memory 450 further include:
[0262] A determination module is used to determine the vertex vector of each vertex in the mesh model based on the vertex coordinates of the vertex; a normalization module is used to normalize the vertex vector to obtain a normal vector, and add the normal vector to the vertex information of the vertex.
[0263] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer readable storage medium. The processor of the computer device reads the computer executable instruction from the computer readable storage medium, and the processor executes the computer executable instruction, so that the computer device executes the rendering method described in the embodiment of the present application.
[0264] The present application embodiment provides a computer-readable storage medium, in which computer executable instructions or computer programs are stored. When the computer executable instructions or computer programs are executed by a processor, the processor will execute the rendering method provided by the present application embodiment, for example, Figure 3 , 9 The rendering method is shown.
[0265] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0266] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0267] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0268] By way of example, computer executable instructions may be deployed to be executed on one computing device or on multiple computing devices located at one site or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0269] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A rendering method, characterized in that: The method comprises: Get the density information of the volume cloud to be rendered; Sampling the density information to obtain a plurality of density sampling values, and generating a grid model of the volume cloud to be rendered based on the density sampling values and preset three-dimensional grid units; Acquire the texture map and brightness information of the mesh model from a reference parameter set based on vertex information of the mesh model; The mesh model is rendered based on the texture map and the brightness information to obtain a rendered image of the volume cloud to be rendered, and the rendered image is output.
2. The method according to claim 1, characterized in that The step of generating a grid model of the volume cloud to be rendered based on the density sampling value and a preset three-dimensional grid unit includes: Determine a target density value greater than a density threshold from a plurality of density sampling values; Acquire target coordinates of the target density value in a reference coordinate system, where the reference coordinate system is a coordinate system constructed based on the density information; The three-dimensional grid unit is set with the target coordinate as the center to obtain a grid model of the volume cloud to be rendered.
3. The method according to claim 1, characterized in that The reference parameter set includes a reference texture atlas, the mesh model includes a plurality of face patches, and the vertex information of the mesh model includes vertex information of each of the face patches. Acquiring a texture map of the mesh model from a reference parameter set based on vertex information of the mesh model, comprising: For each of the face patches in the mesh model, determining a texture map index based on vertex information of the face patch; The texture map corresponding to the texture map index in the reference texture atlas is determined as the texture map of the patch.
4. The method according to claim 3, characterized in that The vertex information includes index coordinates corresponding to each vertex identifier in the patch, and determining the texture map index based on the vertex information of the patch includes: Acquire a target index coordinate corresponding to a preset vertex identifier from a plurality of index coordinates of the face piece, wherein the target index coordinate includes a first coordinate component of a first dimension and a second coordinate component of a second dimension; Obtaining a first parameter and a second parameter for the texture map, wherein the first parameter and the second parameter are reciprocals of each other; Normalize the first coordinate component based on the first parameter to obtain a first index of the first dimension, and normalize the second coordinate component based on the first parameter to obtain a second index of the second dimension; The second index is weighted based on the second parameter to obtain a weighted index, and the sum of the weighted index and the first index is determined as the texture map index of the patch.
5. The method according to claim 4, characterized in that The reference parameter set further includes a preset lookup table, the vertex information further includes vertex coordinates of vertices, and acquiring brightness information of the mesh model from the reference parameter set based on the vertex information of the mesh model includes: For each face patch in the mesh model, determining height information of the face patch based on a plurality of vertex coordinates of the face patch; Combining the height information and a preset constant term to obtain a sampling coordinate; The brightness information of the patch is obtained from the preset lookup table based on the sampling coordinates.
6. The method according to any one of claims 1 to 5, characterized in that: The rendering process of the mesh model based on the texture map and the brightness information to obtain a rendered image of the volume cloud to be rendered includes: Acquire the normal vector of each vertex in the mesh model from the vertex information; Determining the amount of light attenuation and light scattering of the grid model; The grid model is rendered using the texture map, the brightness information, the normal vector, the light attenuation, and the light scattering to obtain a rendered image of the volume cloud to be rendered.
7. The method according to claim 6, characterized in that Determining the illumination attenuation of the mesh model, including: Obtaining initial energy and the optical path length of each facet in the grid model; For each of the facets, determining a first attenuation value based on a first attenuation law and an optical path length of the facet; and determining a second attenuation value based on a second attenuation law and the optical path length; Determine the difference between the initial energy and the second attenuation value; and determine the product of the first attenuation value and the difference as the illumination attenuation of the surface patch.
8. The method according to claim 6, characterized in that Determining the amount of light scattering of the mesh model, including: For each facet in the grid model, obtaining a scattering direction parameter and an angle between an incident light of the facet and an observation direction of the facet; Based on the scattering law, the scattering direction parameter and the angle, the light scattering amount of the surface patch is determined.
9. The method according to claim 7 or 8, characterized in that: The grid model includes a plurality of three-dimensional grid units, and the grid model is rendered using the texture map, the brightness information, the normal vector, the light attenuation, and the light scattering to obtain a rendered image of the volume cloud to be rendered, including: Determine the distance between each three-dimensional grid unit and the acquisition module; Sorting the plurality of three-dimensional grid units in order of distance from far to near to obtain a sorted grid unit sequence; Utilizing the texture map, the brightness information, the normal vector, the light attenuation and the light scattering, rendering is performed on each three-dimensional grid unit in the sorted grid unit sequence in turn to obtain the rendered image.
10. The method according to claim 9, characterized in that The rendering process is performed on each three-dimensional grid unit in the sorted grid unit sequence in sequence by using the texture map, the brightness information, the normal vector, the light attenuation and the light scattering to obtain the rendered image, including: Create a render buffer; For each three-dimensional grid unit in the sorted grid unit sequence, rendering processing is performed on the three-dimensional grid unit by using the texture map, the brightness information, the normal vector, the light attenuation amount, and the light scattering amount to obtain a rendering result of the three-dimensional grid unit; Storing each of the rendering results in the rendering buffer; Constructing a rendered image based on each of the rendering results in the rendering buffer; The method further comprises: The rendered image is synthesized into a virtual scene.
11. The method according to any one of claims 7, 8 and 10, characterized in that: The method further comprises: For each vertex in the mesh model, determine a vertex vector of the vertex based on the vertex coordinates of the vertex; The vertex vector is normalized to obtain a normal vector, and the normal vector is added to the vertex information of the vertex.
12. A rendering device, characterized in that: The device comprises: A first acquisition module is used to acquire density information of a volume cloud to be rendered; A generating module, configured to sample the density information to obtain a plurality of density sampling values, and generate a grid model of the volume cloud to be rendered based on the density sampling values and preset three-dimensional grid units; A second acquisition module, used for acquiring the texture map and brightness information of the mesh model from a reference parameter set based on the vertex information of the mesh model; A rendering module is used to render the mesh model based on the texture map and the brightness information to obtain a rendered image of the volume cloud to be rendered, and output the rendered image.
13. A computer device, characterized in that: The computer device comprises: A memory for storing computer executable instructions; A processor, configured to implement the rendering method according to any one of claims 1 to 11 when executing the computer executable instructions stored in the memory.
14. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the rendering method according to any one of claims 1 to 11 is implemented.
15. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instruction is executed by a processor, the rendering method according to any one of claims 1 to 11 is implemented.