Method, device and electronic equipment for rendering a water body model

By generating reflection textures for water models and performing texture sampling, the problem of generating reflection effects for water models in virtual scenes without sky models has been solved, achieving efficient sky reflection effects that are suitable for various virtual scenes and strategy games.

CN116637366BActive Publication Date: 2026-08-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310493564.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-28
Publication Date
2026-08-25
Estimated Expiration
2043-04-28

AI Technical Summary

Technical Problem

In virtual scenes, especially in strategy games, due to the lack of a sky model, existing technologies struggle to efficiently generate the reflection effect of the sky in water models, and methods such as screen space reflection and lighting probes consume significant system resources.

Method used

By acquiring the texture of a specified element, a reflection effect texture of the water model is generated, and the water model is rendered based on the reflection effect texture to generate the display effect of the specified element reflected in the water. Texture sampling and noise processing are used to simulate water wave disturbance.

Benefits of technology

It efficiently generates the reflection of the sky in the water without a sky model, reducing system resource consumption and is suitable for various virtual scenes, especially games with a fixed top-down perspective.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116637366B_ABST
    Figure CN116637366B_ABST
Patent Text Reader

Abstract

The application provides a water body model rendering method and device and electronic equipment. A map of a specified element is obtained. A reflection effect map of the water body model is generated based on the map of the specified element. The water body model is rendered based on the reflection effect map to obtain a rendered water body model. The rendered water body model has a display effect of the specified element being reflected in the water. In the case that there is no sky model in the virtual scene, the reflection effect of the sky being reflected in the water is generated, and the rendering efficiency is relatively high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of rendering technology, and more specifically, to a rendering method, apparatus, and electronic device for a water model. Background Technology

[0002] In virtual game environments, screen-space reflections and lighting probes are commonly used to realistically reflect the sky onto water, creating an effect similar to how the sky appears in the water. However, these methods are resource-intensive and inefficient at generating water reflections of the sky. Furthermore, in certain game genres, such as strategy games, a sky model is often absent, making it impossible to achieve the same effect of the sky reflected in the water through reflections. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a rendering method, apparatus and electronic device for water body models, so as to generate a reflection effect of the sky in water when there is no sky model in the virtual scene.

[0004] In a first aspect, embodiments of the present invention provide a method for rendering a water body model, comprising: obtaining a texture of a specified element; generating a reflection effect texture of the water body model based on the texture of the specified element; rendering the water body model based on the reflection effect texture to obtain a rendered water body model; the rendered water body model having a display effect of the specified element being reflected in the water.

[0005] Secondly, embodiments of the present invention provide a rendering apparatus for a water body model, comprising: an element texture acquisition module for acquiring textures of specified elements; a reflection effect texture generation module for generating a reflection effect texture of the water body model based on the textures of the specified elements; and a rendering module for rendering the water body model based on the reflection effect texture to obtain a rendered water body model; the rendered water body model has a display effect of specified elements being reflected in the water.

[0006] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described water model rendering method.

[0007] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to implement the above-described water model rendering method.

[0008] The embodiments of the present invention bring the following beneficial effects:

[0009] The aforementioned method, apparatus, and electronic device for rendering a water model involve: acquiring texture maps of specified elements; generating reflection effect texture maps of the water model based on the texture maps of the specified elements; rendering the water model based on the reflection effect texture maps to obtain a rendered water model; and the rendered water model exhibiting the display effect of specified elements being reflected in the water. This method generates a reflection effect of the sky in the water even when a sky model does not exist in the virtual scene, and it boasts high rendering efficiency.

[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0013] Figure 1 A flowchart illustrating a water body model rendering method provided in an embodiment of the present invention;

[0014] Figure 2 A schematic diagram of the structure of a water body model rendering device provided in an embodiment of the present invention;

[0015] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0017] In games, water reflections are often achieved through reflections of skyboxes, such as screen-space reflections or light probes, to realistically reflect the sky. However, in certain game genres, such as simulation games (SLGs), the virtual camera's view is always top-down, meaning the camera never sees the sky. Therefore, there are no skyboxes to represent the sky in the game scene. In other words, SLGs, aside from basic lighting, do not have a sky. Consequently, reflecting water using skyboxes cannot be used to generate water reflections. Furthermore, methods like screen-space reflections and light probes are computationally expensive.

[0018] Based on this, the present invention provides a water body model rendering method, apparatus and electronic device, which can be applied to various virtual scenes that require water body rendering.

[0019] See Figure 1 First, a rendering method for a water body model provided by an embodiment of the present invention will be introduced. The method includes the following steps:

[0020] Step S102: Obtain the texture of the specified element.

[0021] The specified elements can be common elements in the sky such as the sun, moon, stars, and clouds, or any element that needs to be reflected on the water's surface. For example, in some game scenes, if there is a giant monster eye in the sky, the specified element can be a pre-drawn monster eye; or if there are falling leaves in the sky, the specified element can include falling leaves.

[0022] A texture (map) typically refers to an image created by artists in software such as Photoshop, and comes in many formats such as DDS, TGA, BMP, PNG, and JPG. In 3D graphics rendering, textures can be combined with shaders to form materials, which instruct the graphics processing unit (GPU) on how to render the image, ultimately determining the color of the 3D model's surface.

[0023] Textures are images used in materials. They are mapped onto the surface to which the material is applied, and then applied directly to places such as diffuse maps, or the texture pixel values ​​are used as masks in the material, or for other calculations. Since the texture of the specified element only displays the specified element, it cannot be directly used as a texture for rendering the water model to show the effect of the specified element being reflected in the water model in a partial or tiled manner. Further processing of the texture of the specified element is required; see the description of the implementation method in the next step for details.

[0024] Step S104: Generate a reflection effect texture for the water model based on the texture of the specified element.

[0025] To achieve the effect of a specific element being reflected in water within a water model, the texture of that element needs to be sampled based on its position within the water model. This maps the display parameters from the element's texture to the various positions on the water model, serving as their color parameters. These color parameters are stored using a reflection map, typically a texture map. The coordinates of each pixel in the texture map correspond to the positions on the water model. During rendering, the pixel values ​​can be read from the texture map and used as the color parameters for the corresponding model positions.

[0026] When sampling textures of specified elements, it is necessary to consider the reflection effect of the specified elements in the water model. For example, the reflections of the sun and moon are usually displayed in a local area of ​​the water model, while the reflections of stars, clouds, etc. are usually displayed in multiple locations of the water model, and the reflections of fallen leaves and geese can move from one area of ​​the water model to another at a set speed.

[0027] For specific elements whose reflections appear in a localized area of ​​a water model, texture mapping can be sampled using screen-space related coordinates. Specifically, the coordinate parameters of each element's position within the screen-space coordinate system can be determined first, generating texture map coordinates. The display size of the specified element can be controlled by scaling these coordinates, and its position can be controlled by offsetting them. Noise can also be added to create a perturbation effect in the reflection of the specified element.

[0028] For specific elements whose reflections are displayed at multiple locations within a water model, texture sampling can be performed using world coordinates. Specifically, the coordinate parameters of each model position within the world coordinate system can be determined first, and corresponding texture map coordinates can be generated. Furthermore, the display size of the specified element can be controlled by scaling the texture map coordinates, and noise can be added to create a perturbation effect in the reflection of the specified element.

[0029] For a specific element whose reflection moves within a water model, you can consider adding a time-varying parameter to the texture map coordinates so that the reflection of the specified element moves across the surface of the water model over time during the rendering process.

[0030] Step S106: Render the water model based on the reflection effect map to obtain the rendered water model; the rendered water model has the display effect of specified elements being reflected in the water.

[0031] During the rendering process, the color parameters saved in the reflection effect texture can be overlaid with the basic color parameters corresponding to the water model. The water model is then rendered based on the overlaid color parameters to obtain the display effect of a specified element reflected in the water. During the overlay process, the color parameters of the reflection effect and the basic color parameters can be overlaid according to a preset ratio to achieve the preset reflection effect.

[0032] The above-described method for rendering a water model involves: obtaining textures of specified elements; generating reflection textures for the water model based on these textures; rendering the water model using these reflection textures to obtain the rendered water model; and achieving the effect of the specified elements being reflected in the water. This method generates a reflection of the sky in the water even when a sky model is absent in the virtual scene, and it boasts high rendering efficiency.

[0033] The following embodiments provide an implementation method for generating a reflection effect texture of a water body model based on a texture of a specified element.

[0034] In generating the reflection texture of a water model, it is usually necessary to perform texture sampling on the texture of a specified element to obtain the texture sampling data corresponding to the specified element; then, based on the texture sampling data corresponding to the specified element, the reflection texture of the water model is generated. Generally speaking, when a specified element corresponds to different display effects, the sampling coordinates for texture sampling of its texture are usually different.

[0035] When a specified element corresponds to a tiled display effect, meaning multiple reflections of the specified element are displayed on the surface of the water model, texture sampling parameters need to be generated based on the world coordinate parameters of each model position on the surface of the water model. Typically, the world coordinate parameters need to be converted into texture map coordinates. Then, based on parameters such as the display size and perturbation effect of the specified element, the texture map coordinates are scaled and noise is added to generate texture sampling parameters. Finally, texture sampling is performed on the texture map of the specified element based on the texture sampling parameters to obtain the texture sampling data corresponding to the specified element.

[0036] When a specified element corresponds to a local display effect, meaning the specified element is only displayed in a certain area of ​​the water model, it is necessary to generate texture sampling parameters based on the screen space coordinates of each model position on the surface of the water model. Generally, the obtained screen space coordinates need to be converted into texture map coordinates. Then, based on the display size, display position, and other parameters of the specified element, the texture map coordinates are scaled and position coordinate parameters are added to generate texture sampling parameters. Furthermore, texture sampling is performed on the texture map of the specified element based on the texture sampling parameters to obtain the texture sampling data corresponding to the specified element.

[0037] Since reflections in water often differ from the original object's appearance, a perturbation effect needs to be displayed. Therefore, noise needs to be added to the texture sampling parameters to achieve this effect. Specifically, texture sampling parameters can be generated based on the position parameters of each model location on the surface of the water model and the corresponding normal parameters. The normal parameters can be considered as noise to achieve the perturbation effect. Further texture sampling is then performed on the texture map of a specified element based on these parameters to obtain the texture sampling data for that element.

[0038] When multiple specified elements are included, after obtaining the texture sampling data of each specified element, the texture sampling data corresponding to the multiple specified elements can be superimposed based on the texture coordinates corresponding to each model position on the surface of the water model, thereby obtaining the superimposed texture sampling data, and generating the reflection effect texture of the water model based on the superimposed texture sampling data.

[0039] The following embodiments provide an implementation method for rendering water models based on reflection effect maps.

[0040] In practical implementation, the color parameters saved in the reflection effect map can also be used as the self-illumination color parameters of the water model, and then the water model can be rendered without relying on the self-illumination color parameters. This rendering effect is similar to the effect of rendering by overlaying the color parameters saved in the reflection effect map with the basic color parameters corresponding to the water model, both of which can achieve the display effect of the specified element being reflected in the water.

[0041] This invention also provides another method for rendering water models, which... Figure 1 This method is implemented based on the method shown. It is mainly applied to the reflection process of water in game scenes, using elements such as the moon, stars, and clouds to enable lakes and other water bodies in the scene to achieve a good effect of water surface reflecting the sky with low performance consumption.

[0042] This method primarily aims to depict the effect of objects such as the moon, clouds, and stars in the sky reflected in water. It is achieved through the following steps:

[0043] 1. Sample the moon texture using the texture map coordinates (UV) of the screen coordinate system so that the moon is located in a corner of the water surface displayed on the screen.

[0044] Specifically, ScreenPosition can be used to obtain the UV values ​​of the screen space location, denoted as SPUV. The SPUV is then calculated as follows to finally obtain the UV values ​​MoonUV for the sampled moon image:

[0045] MoonUV = SPUV * R1 + R2 + Noise

[0046] R1 is a manually configured two-dimensional vector that can be used to control the size of the moon; R2 is a manually configured two-dimensional vector that can be used to control the position of the moon; Noise is the normal value of the water body, which can create a certain disturbance to the moon and enhance the feeling of water ripples.

[0047] Furthermore, MoonTexture is obtained by sampling the moon's texture using MoonUV.

[0048] 2. Sample the texture maps of clouds and stars using the texture map coordinates corresponding to the world coordinate system, so that clouds and stars cover the entire water surface.

[0049] Convert the world coordinates of the current rendering point in the water model to meters, and then take the G and B channels of the converted world coordinates to form a two-dimensional vector, denoted as WPUV.

[0050] The following calculations are performed on WPUV to obtain the final UV value CloudUV used for sampling the cloud texture:

[0051] CloudUV=WPUV*R3+Time*(SU1,SV1)+Noise

[0052] R3 is a manually configured parameter; SU1 and SV1 are the cloud's movement speed, respectively; and Noise is the water normal value, which causes a certain disturbance to the cloud.

[0053] CloudTexture is obtained by sampling cloud textures using CloudUV.

[0054] Repeat the process of generating texture map coordinates corresponding to the world coordinate system. By modifying parameters such as R3, a new UV value can be obtained, denoted as StarUV. StarUV is then used to sample the texture of the starry sky to obtain StarTexure.

[0055] The above method uses the normal value of water waves to perturb the coordinates of the texture map used for sampling, so that objects such as the moon and starry sky have a feeling of water wave perturbation.

[0056] 3. The sampling results of the texture are used as the output of the emissive color parameter of the water model to obtain a water surface with a reflective effect.

[0057] Specifically, the MoonTexture, CloudTexture, and StarTexture obtained in the above process can be added together, and the result can be used as the EmissiveColor of the water material to obtain a water surface with a reflective effect.

[0058] This method uses texture sampling to create the effect of water reflecting the sky. Compared to screen-space reflection and light probes, this approach has significantly lower performance overhead. Furthermore, this reflection method does not require a skybox in the scene, making it suitable for games with a fixed top-down perspective, such as strategy games.

[0059] For the above method embodiments, see Figure 2 The embodiment of the present invention shown provides a rendering apparatus for a water body model, the apparatus comprising:

[0060] The element texture acquisition module 202 is used to acquire the texture of a specified element;

[0061] The reflection effect texture generation module 204 is used to generate reflection effect textures for water models based on textures of specified elements.

[0062] The rendering module 206 is used to render the water model based on the reflection effect map to obtain the rendered water model; the rendered water model has the display effect of specified elements being reflected in the water.

[0063] The aforementioned water model rendering device acquires texture maps of specified elements; generates reflection effect texture maps of the water model based on the texture maps of the specified elements; renders the water model based on the reflection effect texture maps to obtain the rendered water model; the rendered water model has the display effect of specified elements being reflected in the water. This method generates the reflection effect of the sky in the water even when there is no sky model in the virtual scene, and has high rendering efficiency.

[0064] The aforementioned reflection effect texture generation module is also used for: performing texture sampling on the texture of a specified element to obtain texture sampling data corresponding to the specified element; and generating a reflection effect texture of the water model based on the texture sampling data corresponding to the specified element.

[0065] The specified element corresponds to the tiled display effect; the reflection effect texture generation module is also used to generate texture sampling parameters based on the world coordinate parameters of each model position on the surface of the water model; and to perform texture sampling on the texture of the specified element based on the texture sampling parameters to obtain the texture sampling data corresponding to the specified element.

[0066] The specified element corresponds to a local display effect; the reflection effect texture generation module is also used to: generate texture sampling parameters based on the screen space coordinate parameters of each model position on the surface of the water model; and perform texture sampling on the texture of the specified element based on the texture sampling parameters to obtain the texture sampling data corresponding to the specified element.

[0067] The aforementioned reflection effect texture generation module is also used to: generate texture sampling parameters based on the position parameters of each model position on the surface of the water model and the normal parameters corresponding to the model positions; and perform texture sampling on the texture of a specified element based on the texture sampling parameters to obtain the texture sampling data of the specified element.

[0068] The specified elements include multiple elements; the reflection effect texture generation module is also used to: based on the texture coordinates corresponding to each model position on the surface of the water model, perform superposition processing on the texture sampling data corresponding to multiple specified elements to obtain superimposed texture sampling data; and generate a reflection effect texture of the water model based on the superimposed texture sampling data.

[0069] The aforementioned rendering module is also used to determine the self-illumination color parameters of the water model based on the reflection effect map; and to render the water model based on the self-illumination color parameters.

[0070] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described water model rendering method. Specifically:

[0071] Get the texture of the specified element; generate a reflection effect texture for the water model based on the texture of the specified element; render the water model based on the reflection effect texture to obtain the rendered water model; the rendered water model has the display effect of the specified element being reflected in the water.

[0072] The above-described method for rendering a water model involves: obtaining textures of specified elements; generating reflection textures for the water model based on these textures; rendering the water model using these reflection textures to obtain the rendered water model; and achieving the effect of the specified elements being reflected in the water. This method generates a reflection of the sky in the water even when a sky model is absent in the virtual scene, and it boasts high rendering efficiency.

[0073] Optionally, the steps of generating a reflection effect texture of a water model based on a texture of a specified element include: performing texture sampling on the texture of the specified element to obtain texture sampling data corresponding to the specified element; and generating a reflection effect texture of the water model based on the texture sampling data corresponding to the specified element.

[0074] Optionally, the specified element corresponds to a tiled display effect; the step of performing texture sampling on the texture of the specified element to obtain the texture sampling data corresponding to the specified element includes: generating texture sampling parameters based on the world coordinate parameters of each model position on the surface of the water model; and performing texture sampling on the texture of the specified element based on the texture sampling parameters to obtain the texture sampling data corresponding to the specified element.

[0075] Optionally, the specified element corresponds to a local display effect; the step of performing texture sampling on the texture of the specified element to obtain the texture sampling data corresponding to the specified element includes: generating texture sampling parameters based on the screen space coordinate parameters of each model position on the surface of the water model; and performing texture sampling on the texture of the specified element based on the texture sampling parameters to obtain the texture sampling data corresponding to the specified element.

[0076] Optionally, the above steps of performing texture sampling on the texture of a specified element to obtain texture sampling data corresponding to the specified element include: generating texture sampling parameters based on the position parameters of each model position on the surface of the water model and the normal parameters corresponding to the model positions; and performing texture sampling on the texture of the specified element based on the texture sampling parameters to obtain texture sampling data of the specified element.

[0077] Optionally, the specified elements may include multiple elements; the step of generating a reflection effect map of the water model based on the texture sampling data corresponding to the specified elements includes: performing overlay processing on the texture sampling data corresponding to multiple specified elements based on the texture coordinates corresponding to each model position on the surface of the water model to obtain overlaid texture sampling data; and generating a reflection effect map of the water model based on the overlaid texture sampling data.

[0078] Optionally, the above steps for rendering the water model based on the reflection effect map include: determining the self-illumination color parameters of the water model based on the reflection effect map; and rendering the water model based on the self-illumination color parameters.

[0079] See Figure 3 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described water model rendering method.

[0080] Furthermore, Figure 3The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0081] The memory 101 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0082] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information in memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0083] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-described water model rendering method.

[0084] The present invention provides a method, apparatus, and electronic device for rendering a water model, including a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding embodiments. Specifically:

[0085] Get the texture of the specified element; generate a reflection effect texture for the water model based on the texture of the specified element; render the water model based on the reflection effect texture to obtain the rendered water model; the rendered water model has the display effect of the specified element being reflected in the water.

[0086] The above-described method for rendering a water model involves: obtaining textures of specified elements; generating reflection textures for the water model based on these textures; rendering the water model using these reflection textures to obtain the rendered water model; and achieving the effect of the specified elements being reflected in the water. This method generates a reflection of the sky in the water even when a sky model is absent in the virtual scene, and it boasts high rendering efficiency.

[0087] Optionally, the steps of generating a reflection effect texture of a water model based on a texture of a specified element include: performing texture sampling on the texture of the specified element to obtain texture sampling data corresponding to the specified element; and generating a reflection effect texture of the water model based on the texture sampling data corresponding to the specified element.

[0088] Optionally, the specified element corresponds to a tiled display effect; the step of performing texture sampling on the texture of the specified element to obtain the texture sampling data corresponding to the specified element includes: generating texture sampling parameters based on the world coordinate parameters of each model position on the surface of the water model; and performing texture sampling on the texture of the specified element based on the texture sampling parameters to obtain the texture sampling data corresponding to the specified element.

[0089] Optionally, the specified element corresponds to a local display effect; the step of performing texture sampling on the texture of the specified element to obtain the texture sampling data corresponding to the specified element includes: generating texture sampling parameters based on the screen space coordinate parameters of each model position on the surface of the water model; and performing texture sampling on the texture of the specified element based on the texture sampling parameters to obtain the texture sampling data corresponding to the specified element.

[0090] Optionally, the above steps of performing texture sampling on the texture of a specified element to obtain texture sampling data corresponding to the specified element include: generating texture sampling parameters based on the position parameters of each model position on the surface of the water model and the normal parameters corresponding to the model positions; and performing texture sampling on the texture of the specified element based on the texture sampling parameters to obtain texture sampling data of the specified element.

[0091] Optionally, the specified elements may include multiple elements; the step of generating a reflection effect map of the water model based on the texture sampling data corresponding to the specified elements includes: performing overlay processing on the texture sampling data corresponding to multiple specified elements based on the texture coordinates corresponding to each model position on the surface of the water model to obtain overlaid texture sampling data; and generating a reflection effect map of the water model based on the overlaid texture sampling data.

[0092] Optionally, the above steps for rendering the water model based on the reflection effect map include: determining the self-illumination color parameters of the water model based on the reflection effect map; and rendering the water model based on the self-illumination color parameters.

[0093] See Figure 3 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described water model rendering method.

[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0095] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0096] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0097] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0098] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for rendering a water body model, characterized in that, include: Get the texture of the specified element; The texture of the specified element is sampled to obtain the texture sampling data corresponding to the specified element; Based on the texture sampling data corresponding to the specified element, a reflection effect texture of the water body model is generated; The water model is rendered based on the aforementioned reflection texture to obtain a rendered water model; the rendered water model has the display effect of specified elements being reflected in the water; The specified element corresponds to a partial display effect; The step of performing texture sampling on the texture of the specified element to obtain the texture sampling data corresponding to the specified element includes: The screen space coordinate parameters of each model position on the surface of the water body model are converted into texture map coordinates; Based on the display position and display size of the specified element, the texture map coordinates are scaled and offset to obtain the processed texture sampling parameters; Based on the texture sampling parameters, texture sampling is performed on the texture map of the specified element to obtain the texture sampling data corresponding to the specified element.

2. The method according to claim 1, characterized in that, The specified element corresponds to a tiled display effect; The step of performing texture sampling on the texture of the specified element to obtain the texture sampling data corresponding to the specified element includes: Based on the world coordinate parameters of each model position on the surface of the water body model, texture sampling parameters are generated; Based on the texture sampling parameters, texture sampling is performed on the texture map of the specified element to obtain the texture sampling data corresponding to the specified element.

3. The method according to claim 1, characterized in that, The step of performing texture sampling on the texture of the specified element to obtain the texture sampling data corresponding to the specified element includes: Based on the position parameters of each model position on the surface of the water body model and the normal parameters corresponding to the model positions, texture sampling parameters are generated. Based on the texture sampling parameters, texture sampling is performed on the texture map of the specified element to obtain the texture sampling data of the specified element.

4. The method according to claim 1, characterized in that, The specified element includes multiple elements; The step of generating the reflection effect texture of the water body model based on the texture sampling data corresponding to the specified element includes: Based on the texture coordinates corresponding to each model position on the surface of the water body model, the texture sampling data corresponding to multiple specified elements are superimposed to obtain the superimposed texture sampling data. Based on the superimposed texture sampling data, a reflection effect texture map of the water body model is generated.

5. The method according to claim 1, characterized in that, The steps of rendering the water model based on the reflection effect texture include: Based on the reflection effect map, the self-illumination color parameters of the water body model are determined; The water model is rendered based on the self-illuminating color parameters.

6. A rendering device for a water body model, characterized in that, include: The element texture acquisition module is used to acquire the texture of a specified element; The reflection effect texture generation module is used to: perform texture sampling on the texture of the specified element to obtain the texture sampling data corresponding to the specified element; Based on the texture sampling data corresponding to the specified element, a reflection effect texture of the water body model is generated; The rendering module is used to render the water model based on the reflection effect map to obtain the rendered water model; the rendered water model has the display effect of specified elements being reflected in the water; The specified element corresponds to a partial display effect; The reflection effect texture generation module is also used for: The screen space coordinate parameters of each model position on the surface of the water body model are converted into texture map coordinates; Based on the display position and display size of the specified element, the texture map coordinates are scaled and offset to obtain the processed texture sampling parameters; Based on the texture sampling parameters, texture sampling is performed on the texture map of the specified element to obtain the texture sampling data corresponding to the specified element.

7. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the rendering method of the water model according to any one of claims 1-5.

8. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the rendering method of the water model according to any one of claims 1-5.

Citation Information

Patent Citations

  • Water body surface rendering method and device, equipment and storage medium

    CN113617024A