Method, device and equipment for rendering laser effect, and storage medium

By transforming vertex normals and sampling laser maps in the lighting model, the problem of high performance consumption in laser material generation was solved, achieving efficient rendering effects and improving game performance and smoothness.

CN116503537BActive Publication Date: 2026-07-10NETEASE (HANGZHOU) NETWORK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2023-03-16
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing laser material generation solutions consume too much power, have low controllability and rendering efficiency, and affect game smoothness, especially in mobile game development.

Method used

By acquiring the light reflection characteristics of the model to be rendered, a lighting model is constructed, vertex normals are converted to view space, and laser maps are sampled based on the lighting model to obtain texture maps. These texture maps are then combined with the lighting model for rendering to simulate laser effects.

Benefits of technology

It reduces sampling and computation, lowers performance overhead, improves game frame rate, and enhances rendering efficiency and game smoothness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116503537B_ABST
    Figure CN116503537B_ABST
Patent Text Reader

Abstract

The application provides a laser effect rendering method, device and equipment and a storage medium, which are characterized in that the method determines the vertex normal in the line-of-sight space based on the vertex normal of the light model, samples the laser map with the vertex normal in the line-of-sight space, obtains a first texture map, and then renders the model with the sampled first texture map and a second texture map in the light model, so as to simulate the laser material through the light model. In this way, the sampling and calculation amount is greatly reduced, the performance overhead is reduced, the frame rate of game running is improved, the rendering efficiency is improved, and a basis is provided for the development of a mobile game.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer graphics processing technology, and in particular to a method, apparatus, device, and storage medium for rendering laser effects. Background Technology

[0002] In the creation of game scenes, in order to improve the realism and polygonality of the scenes, different materials are applied to the surfaces of different models in the scene. The application of different materials is mainly achieved by adjusting the light reflection to create corresponding color changes, so as to realize the material's characteristics, such as laser material, especially for character clothing.

[0003] Current methods for creating laser materials primarily employ thin-film interference (TFT) to simulate multiple reflections of light on a thin film on a model's surface. For example, in two reflections, some light is reflected from the upper layer of the film, while some passes through the upper surface, reflects from the lower layer, and then re-emerges from the upper surface. This extra light travels a longer distance, causing a phase difference between the two reflected beams. When the crests and troughs of the light wave coincide, they cancel each other out; when the crests coincide, the light is amplified. This results in some wavelengths of white light being amplified while others are attenuated, creating a colorful effect. However, calculating the material's effect based on such a high number of reflections places a heavy burden on performance, especially for current mobile game development. This significantly reduces development efficiency and impacts game smoothness after release. Summary of the Invention

[0004] The main objective of this invention is to solve the problems of excessive performance consumption, low controllability, and low rendering efficiency in existing laser material generation schemes.

[0005] The first aspect of this invention provides a method for rendering laser effects, the method comprising:

[0006] Obtain the light reflection characteristics of the model to be rendered, and construct the lighting model of the model to be rendered in world space based on the light reflection characteristics;

[0007] The vertex normals of the model to be rendered in the model space are obtained through the lighting model, and the vertex normals in the model space are converted into vertex normals in the view space.

[0008] Using the vertex normals in the view space as sampling coordinates, the texture in the laser map is sampled to obtain the first texture map;

[0009] The second texture map of the model to be rendered is obtained based on the lighting model;

[0010] The model to be rendered is rendered based on the first texture map and the second texture map to obtain a laser-effect model.

[0011] A second aspect of the present invention provides a laser effect rendering apparatus, the laser effect rendering apparatus comprising:

[0012] The acquisition module is used to acquire the light reflection characteristics of the model to be rendered, and to construct the lighting model of the model to be rendered in world space based on the light reflection characteristics.

[0013] The transformation module is used to obtain the vertex normals of the model to be rendered in the model space through the lighting model, and to convert the vertex normals in the model space into vertex normals in the view space.

[0014] The sampling module is used to sample the texture in the laser map by taking the vertex normals in the view space as sampling coordinates to obtain a first texture map; and to obtain a second texture map of the model to be rendered based on the lighting model.

[0015] The rendering module is used to render the model to be rendered based on the first texture map and the second texture map to obtain a model with a laser effect.

[0016] A third aspect of the present invention provides a laser effect rendering apparatus, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a circuit; the at least one processor invokes the instructions in the memory to cause the laser effect rendering apparatus to perform the various steps of the laser effect rendering method described above.

[0017] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the steps of the above-described laser effect rendering method.

[0018] In summary, this method obtains the light reflection characteristics of the model to be rendered, constructs a lighting model of the model in world space based on these characteristics, obtains the vertex normals of the model in model space using the lighting model, and converts these vertex normals into vertex normals in view space. Using the vertex normals in view space as sampling coordinates, texture sampling is performed on the laser map to obtain a first texture map. A second texture map of the model to be rendered is obtained based on the lighting model. The model is then rendered based on the first and second texture maps to obtain a model with a laser effect. By using the vertex normals of the lighting model as a basis to determine the vertex normals in view space, and sampling the laser map using these vertex normals, and then rendering the model using the sampled laser texture map and the texture map from the lighting model, the method simulates laser materials using the lighting model. This significantly reduces sampling and computation, reduces performance overhead, improves the frame rate of game operation, and enhances rendering efficiency, providing a foundation for mobile game development.

[0019] 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.

[0020] 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

[0021] Figure 1 This is a schematic diagram of the first embodiment of the laser effect rendering method in the present invention;

[0022] Figure 2 This is a schematic diagram of a second embodiment of the laser effect rendering method in this invention.

[0023] Figure 3 This is a schematic diagram illustrating the effect of laser mapping in an embodiment of the present invention;

[0024] Figure 4 This is a schematic diagram illustrating the effect of the first texture map in an embodiment of the present invention;

[0025] Figure 5 This is a schematic diagram of the lighting model in an embodiment of the present invention;

[0026] Figure 6 This is a schematic diagram illustrating the effect of the laser material in an embodiment of the present invention;

[0027] Figure 7 This is a schematic diagram of one embodiment of the laser effect rendering device in the present invention;

[0028] Figure 8 This is a schematic diagram of one embodiment of a laser effect rendering device in this invention. Detailed Implementation

[0029] This invention provides a laser effect rendering method, apparatus, device, and storage medium. By using a lighting model, the vertex normals in world space are transformed to vertex normals in view space, and then the sampled laser map is applied to the vertex normals in view space, thereby simulating a layer of laser material effect. Then, the lighting model material of BRDF itself is superimposed to finally obtain a laser effect similar to two layers of material, reducing performance consumption and improving rendering efficiency.

[0030] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0031] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 The first embodiment of the laser effect rendering method in this invention includes:

[0032] 101. Obtain the light reflection characteristics of the model to be rendered, and construct the lighting model of the model to be rendered in world space based on the light reflection characteristics.

[0033] In this embodiment, the light reflection characteristic refers to the position coordinates of the vertex normals in the model to be rendered, i.e., UV. The position coordinates of the collected vertex normals are mapped onto the surface of the lighting model to construct the lighting model corresponding to the rendering model.

[0034] This lighting model records the reflection characteristics of light energy in the model to be rendered from any incident direction to any viewpoint direction, that is, how the incident light rays are distributed in various outgoing directions after being reflected by a certain surface.

[0035] 102. Obtain the vertex normals of the model to be rendered in model space through the lighting model, and convert the vertex normals in model space into vertex normals in view space.

[0036] Obtain the vertex normal positions of the lighting model in world space, and transform the vertex normals of the lighting model to vertex normals in view space based on the position coordinates of each vertex normal on the lighting model.

[0037] Specifically, by adjusting the view direction in the lighting model, the vertex normal is constructed based on the position of the extension line of the view direction on the surface of the lighting model to determine the position coordinates of the vertex normal. Then, by using the coordinate correspondence between the model space where the lighting model is located and the visual space corresponding to the rendering view of the model to be rendered, the obtained vertex normal of the lighting model is converted into the vertex normal in the visual space, which is to obtain the vertex coordinate information of the vertex normal in the visual space.

[0038] 103. Using the vertex normals in the view space as sampling coordinates, sample the texture in the laser map to obtain the first texture map.

[0039] The position of vertex normals in the model to be rendered is recorded using a lighting model. Then, the texture in the pre-sampled laser map is sampled based on the vertex normals in the lighting model as sampling coordinates. The light reflection that produces the laser effect is simulated using the vertex normals in the lighting model. To do this, the normals of each vertex on the lighting model are first determined, which are the incident and reflection positions of the light. Based on the coordinates of these positions, a spatial transformation is performed to transform them into a projection that is consistent with or similar to the space in which the light in the laser map is located.

[0040] In practical applications, after determining the lighting model for simulating laser textures, all vertex normals in the lighting model are extracted. A world coordinate system is then constructed using the lighting model to determine the position coordinates of each vertex normal, which is the vertex normal position. Then, the position of each vertex normal is transformed to the space corresponding to the laser map through coordinate transformation, thereby obtaining the vertex normals corresponding to the laser map.

[0041] For example, the vertex normals in the lighting model are vertex normals in world space, while the laser map is in view space. To address this, a matrix transformation algorithm is used to transform the vertex normals of the lighting model to vertex normals in view space, thereby enabling the sampling and mapping of the laser map texture using the lighting model.

[0042] In this embodiment, the vertex normals in view space are used as the sampling granularity to sample the texture in the laser map, resulting in a laser texture layer. Specifically, a sampling coordinate system is constructed using the vertex normals in view space. Based on the coordinates in the sampling coordinate system, the laser map is sampled one dimension at a time. Then, the sampled textures in each one dimension are merged to obtain a laser texture layer containing laser textures. Here, the laser map is a pre-sampled map based on existing laser materials. When sampling the laser map, the laser map to be sampled is directly selected and placed in the coordinate system corresponding to the vertex normals in view space to achieve sampling.

[0043] 104. Obtain the second texture map of the model to be rendered based on the lighting model.

[0044] In this embodiment, the texture on the lighting model is obtained to obtain a second texture map, which is the texture map of the model to be rendered. Specifically, the vertex normals in the model to be rendered are collected through the second texture map.

[0045] 105. Render the model to be rendered based on the first texture map and the second texture map to obtain a laser effect model.

[0046] In this embodiment, during the rendering process, the vertex normals recorded in the first texture map and the vertex normals in the second texture map are combined to obtain a fused texture map, thereby simulating the laser material on the surface of the model to be rendered.

[0047] Specifically, the laser texture layer is converted into the world space under the corresponding lighting model, and then the texture map is applied to the surface of the lighting model, thereby simulating the effect of laser texture on the lighting model and thus obtaining laser material.

[0048] In summary, based on the lighting model, the sampled normals of the texture are obtained from the vertex normals of the lighting model. Then, the simulated laser texture is projected onto the model in view space to simulate the effect of thin film reflection, thus rendering it as a material layer onto the lighting model to achieve the effect of simulating laser material. This method not only achieves low sampling and low computation but also reduces performance overhead, which can improve the frame rate, heat generation, and power consumption of the game, greatly enhancing the smoothness of the game.

[0049] Reference Figure 2 This is a second embodiment of the laser effect rendering method provided by the present invention, which specifically includes the following steps:

[0050] 201. Obtain the light reflection characteristics of the model to be rendered, construct the corresponding lighting model, and obtain the position of the normal of each vertex of the lighting model in world space.

[0051] In this step, the vertex normal position (VertexNormalWS) is actually the position data output based on the current vertex normal, which represents the direction the model is facing. Vertex normal information can be obtained directly from the surface of the lighting model.

[0052] 202. Using a matrix transformation algorithm, the vertex normals in the model space are transformed to obtain the vertex normals of the model to be rendered in the view space.

[0053] In this embodiment, the position coordinates of the vertex normals in the model space are determined, and the position coordinates are transformed using the view matrix and projection matrix to obtain the vertex normals of the model to be rendered in the view space.

[0054] By setting up a lighting model, the normal positions of each vertex in the lighting model are extracted. These vertex normal positions are the vertex normal positions in world space. After extracting the vertex normal positions from the lighting model, their actual vertex normal positions in local space are transformed using a model matrix, specifically implemented through the rendering pipeline. In the rendering pipeline, the coordinates of the vertex normal positions are transformed from local space to world space via the model matrix (M).

[0055] After transforming it to world space, it is necessary to transform the world space to view space. The transformation to view space is achieved using the view matrix and projection matrix. Specifically, based on the position of each vertex normal, the view matrix and projection matrix are used in sequence to transform the vertex normals of the lighting model in view space.

[0056] In practical applications, the vertex normals in the lighting model are transformed from world space to view space (also known as eye space) through the view matrix (V), then to clip space through the projection matrix (the vertex shader needs to calculate the coordinates of the clip space), and finally to screen space through the viewport transform, thus obtaining the vertex normals in the view space.

[0057] 203. Determine the sampling channel based on the UV coordinates of the vertex normal in the view space.

[0058] In this step, the coordinates of the vertex normals in the view space are directly used to construct the UV, and the UV is used as the sampling granularity, that is, the corresponding sampling channels are constructed with U and V respectively.

[0059] In practical applications, the determined sampling channels can also be based on different coordinate axes of the three-dimensional coordinate system as one sampling channel, thus obtaining three sampling channels.

[0060] 204. Based on the sampling channels, the textures in the laser map are sampled sequentially, and the sampled textures from each channel are synthesized to obtain the first texture map.

[0061] In this embodiment, the sampling channels include a first sampling channel and a second sampling channel, which correspond to the horizontal and vertical coordinates in the UV mapping. Based on the first sampling channel, the texture along the horizontal axis of the laser map is sampled to obtain a first channel texture. Based on the second sampling channel, the texture along the vertical axis of the laser map is sampled to obtain a second channel texture. One of the first channel texture and the second channel texture is flipped and then combined with the other unflipped channel texture to obtain a first texture texture. Specifically, during compositing, either the first channel texture or the second channel texture is flipped and then combined with either the second channel texture or the first channel texture to obtain the second texture texture.

[0062] In practical applications, after transforming VertexNormalWS (vertex normal position) through Transform (MVP) matrix transformation to transform VertexNormalWS from world space to view space and then obtaining the vertex normal in view space, the sampling process is divided into two sampling branches. Each sampling branch samples the laser map with one sampling channel to obtain the corresponding texture map. Then, the texture maps obtained from the two branches are combined to obtain the laser texture map layer.

[0063] In practical applications, the mask node splits the data into two float1 floating-point numbers, representing the first CIA channel and the second sampling channel, respectively. Since the second sampling channel in the Messiah engine needs to be flipped, it is multiplied by -1. The flipped second sampling channel and the first sampling channel are then combined into a float2 floating-point number using the merge node. The resulting float2 floating-point number represents the vertex normals in view space. Now, these view space normals are used as UVs for texture sampling.

[0064] The following uses a spherical BRDF (Bidirectional Reflectance Distribution Function) as an example.

[0065] The lighting model uses vertex normals in the transformed view space as UVs to sample laser maps, for example, for... Figure 3The texture in the laser map is sampled to obtain a laser texture layer, which is represented by the shape of the lighting model, such as... Figure 4 As shown.

[0066] 205. Using a matrix transformation algorithm, the normals in the first texture map are transformed into normals in world space. The transformed first texture map is then merged with the second texture map and added to the surface of the lighting model to obtain a laser-effect model.

[0067] That is, by using a matrix transformation algorithm, the normals in the first texture map are transformed into normals in world space, and the transformed first texture map is added to the second texture map on the surface of the lighting model to obtain the laser material.

[0068] In this embodiment, the matrix transformation algorithm is the same as the vertex normal transformation algorithm described above. After sampling the laser texture layer, spatial transformation is performed sequentially based on the vertex normals in the view space at the time of sampling to obtain the expression of the vertex normals of the laser texture layer in world space, thereby obtaining the laser texture layer in world space. The transformed laser texture layer is then merged with the lighting model to obtain the laser material, thus realizing the rendering of the laser material based on the lighting model. Specifically, as follows... Figure 5 and 6 As shown.

[0069] In summary, by determining the vertex normals of the texture for acquiring the laser map based on the lighting model, determining the sampling channels based on these vertex normals, and sampling the laser map based on the sampling channels, the effect of directly rendering the laser material using the model is achieved. This method does not require rewriting a lighting model to create the effect, and it features low sampling and low computation, which saves a lot of performance overhead for mobile game development and can improve game running speed.

[0070] The rendering method for laser effects in the embodiments of the present invention has been described above. The rendering apparatus for laser effects in the embodiments of the present invention will be described below. Please refer to [link / reference]. Figure 7 One embodiment of the laser effect rendering device in this invention includes:

[0071] The acquisition module 710 is used to acquire the light reflection characteristics of the model to be rendered, and to construct the lighting model of the model to be rendered in world space based on the light reflection characteristics.

[0072] The transformation module 720 is used to obtain the vertex normals of the model to be rendered in the model space through the lighting model, and convert the vertex normals in the model space into vertex normals in the view space.

[0073] The sampling module 730 is used to use the vertex normals in the view space as sampling coordinates to sample the texture in the laser map to obtain a first texture map; and to obtain a second texture map of the model to be rendered based on the lighting model.

[0074] The rendering module 740 is used to render the model to be rendered based on the first texture map and the second texture map to obtain a model with a laser effect.

[0075] The aforementioned transformation module 720 is specifically used for:

[0076] Using a matrix transformation algorithm, the vertex normals in the model space are transformed to obtain the vertex normals of the model to be rendered in the view space.

[0077] The aforementioned transformation module 720 is specifically used for:

[0078] Determine the position coordinates of the vertex normals in the model space, and transform the position coordinates using the view matrix and projection matrix to obtain the vertex normals of the model to be rendered in the view space.

[0079] The aforementioned sampling module 730 is specifically used for:

[0080] The sampling coordinates are determined based on the UV coordinates of the vertex normal in the view space, wherein the sampling coordinates include at least two sampling channels;

[0081] Based on at least one of the sampling channels, the textures in the laser map are sampled sequentially, and the sampled textures from each channel are synthesized to obtain the first texture map.

[0082] The aforementioned sampling module 730 is specifically used for:

[0083] The UV coordinates of the vertex normals in the view space are weighted and calculated, and the sampling coordinates are determined based on the calculated UV coordinates of the vertex normals in the view space.

[0084] The aforementioned sampling module 730 is specifically used for:

[0085] The sampling channel includes a first sampling channel and a second sampling channel;

[0086] Based on the first sampling channel, the texture in the horizontal axis direction of the laser map is sampled to obtain the first channel map;

[0087] Based on the second sampling channel, the texture along the vertical axis of the laser map is sampled to obtain the second channel map;

[0088] One of the first channel texture and the second channel texture is flipped and then combined with the other unflipped channel texture to obtain the first texture map.

[0089] The aforementioned rendering module 740 is specifically used for:

[0090] Using a matrix transformation algorithm, the normals in the first texture map are transformed into normals in world space. The transformed first texture map is then merged with the second texture map and added to the surface of the lighting model to obtain a laser-effect model.

[0091] In this embodiment of the invention, the laser effect rendering device runs the aforementioned laser effect rendering method. It acquires the vertex normal positions of the lighting model in world space and transforms these vertex normals to vertex normals in view space based on these positions. Based on the vertex normals in view space, it sequentially samples the texture in the laser map to obtain a first texture map. It then obtains a second texture map of the model to be rendered based on the lighting model. Finally, it renders the model based on the first and second texture maps to obtain a laser effect model. By determining the vertex normals in view space based on the vertex normals of the lighting model, sampling the laser map using these vertex normals, and then superimposing the sampling results onto the lighting model, the laser material can be simulated using the lighting model. This method significantly reduces sampling and computation, decreases performance overhead, increases the frame rate of the game, and improves rendering efficiency, providing a foundation for mobile game development.

[0092] This embodiment also provides a laser effect rendering 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 laser effect rendering method described above. This laser effect rendering device can be a server or a terminal device.

[0093] See Figure 8 As shown, the laser effect rendering device includes a processor 800 and a memory 8101. The memory 801 stores machine-executable instructions that can be executed by the processor 800. The processor 800 executes the machine-executable instructions to implement the laser effect rendering method described above.

[0094] Furthermore, Figure 8 The rendering device for the laser effect shown also includes a bus 802 and a communication interface 803. The processor 800, the communication interface 803, and the memory 801 are connected via the bus 802.

[0095] The memory 801 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 803 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 802 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 8 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.

[0096] The processor 800 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 the processor 800 or by instructions in software form. The processor 800 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 random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the field. This storage medium is located in memory 801. The processor 800 reads the information from memory 801 and, in conjunction with its hardware, completes the following steps:

[0097] Obtain the light reflection characteristics of the model to be rendered, and construct the lighting model of the model to be rendered in world space based on the light reflection characteristics;

[0098] The vertex normals of the model to be rendered in the model space are obtained through the lighting model, and the vertex normals in the model space are converted into vertex normals in the view space.

[0099] Using the vertex normals in the view space as sampling coordinates, the texture in the laser map is sampled to obtain the first texture map;

[0100] The second texture map of the model to be rendered is obtained based on the lighting model;

[0101] The model to be rendered is rendered based on the first texture map and the second texture map to obtain a laser-effect model.

[0102] The above-mentioned conversion of vertex normals in the model space to vertex normals in the view space includes:

[0103] Using a matrix transformation algorithm, the vertex normals in the model space are transformed to obtain the vertex normals of the model to be rendered in the view space.

[0104] The above-described matrix transformation algorithm transforms the spatial position of the vertex normals in the model space to obtain the vertex normals of the model to be rendered in the view space, including:

[0105] Determine the position coordinates of the vertex normals in the model space, and transform the position coordinates using the view matrix and projection matrix to obtain the vertex normals of the model to be rendered in the view space.

[0106] The above-mentioned sampling of the texture in the laser map by using the vertex normals in the view space as sampling coordinates to obtain the first texture map includes:

[0107] The sampling coordinates are determined based on the UV coordinates of the vertex normal in the view space, wherein the sampling coordinates include at least two sampling channels;

[0108] Based on at least one of the sampling channels, the textures in the laser map are sampled sequentially, and the sampled textures from each channel are synthesized to obtain the first texture map.

[0109] The above determination of sampling coordinates based on the UV coordinates of vertex normals in view space includes:

[0110] The UV coordinates of the vertex normals in the view space are weighted and calculated, and the sampling coordinates are determined based on the calculated UV coordinates of the vertex normals in the view space.

[0111] The aforementioned sampling coordinates include a first sampling channel and a second sampling channel; the step of sequentially sampling the texture in the laser map based on at least one of the sampling channels, and synthesizing the sampled textures from each channel to obtain the first texture map includes:

[0112] Based on the first sampling channel, the texture in the horizontal axis direction of the laser map is sampled to obtain the first channel map;

[0113] Based on the second sampling channel, the texture along the vertical axis of the laser map is sampled to obtain the second channel map;

[0114] One of the first channel texture and the second channel texture is flipped and then combined with the other unflipped channel texture to obtain the first texture map.

[0115] The above-mentioned model, which renders the model to be rendered based on the first texture map and the second texture map to obtain a laser effect, includes:

[0116] Using a matrix transformation algorithm, the normals in the first texture map are transformed into normals in world space. The transformed first texture map is then merged with the second texture map and added to the surface of the lighting model to obtain a laser-effect model.

[0117] In summary, by using a lighting model, transforming the vertex normal positions in world space to vertex normals in view space, and then applying the sampled laser map to the vertex normals in view space, a layer effect of a laser material is simulated. Finally, the BRDF's own lighting model material is superimposed to obtain a laser effect similar to two layers of material, reducing performance consumption and improving rendering efficiency.

[0118] This embodiment also provides 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 perform the following steps:

[0119] Obtain the light reflection characteristics of the model to be rendered, and construct the lighting model of the model to be rendered in world space based on the light reflection characteristics;

[0120] The vertex normals of the model to be rendered in the model space are obtained through the lighting model, and the vertex normals in the model space are converted into vertex normals in the view space.

[0121] Using the vertex normals in the view space as sampling coordinates, the texture in the laser map is sampled to obtain the first texture map;

[0122] The second texture map of the model to be rendered is obtained based on the lighting model;

[0123] The model to be rendered is rendered based on the first texture map and the second texture map to obtain a laser-effect model.

[0124] The above-mentioned conversion of vertex normals in the model space to vertex normals in the view space includes:

[0125] Using a matrix transformation algorithm, the vertex normals in the model space are transformed to obtain the vertex normals of the model to be rendered in the view space.

[0126] The above-described matrix transformation algorithm transforms the spatial position of the vertex normals in the model space to obtain the vertex normals of the model to be rendered in the view space, including:

[0127] Determine the position coordinates of the vertex normals in the model space, and transform the position coordinates using the view matrix and projection matrix to obtain the vertex normals of the model to be rendered in the view space.

[0128] The above-mentioned sampling of the texture in the laser map by using the vertex normals in the view space as sampling coordinates to obtain the first texture map includes:

[0129] The sampling coordinates are determined based on the UV coordinates of the vertex normal in the view space, wherein the sampling coordinates include at least two sampling channels;

[0130] Based on at least one of the sampling channels, the textures in the laser map are sampled sequentially, and the sampled textures from each channel are synthesized to obtain the first texture map.

[0131] The above determination of sampling coordinates based on the UV coordinates of vertex normals in view space includes:

[0132] The UV coordinates of the vertex normals in the view space are weighted and calculated, and the sampling coordinates are determined based on the calculated UV coordinates of the vertex normals in the view space.

[0133] The aforementioned sampling coordinates include a first sampling channel and a second sampling channel; the step of sequentially sampling the texture in the laser map based on at least one of the sampling channels, and synthesizing the sampled textures from each channel to obtain the first texture map includes:

[0134] Based on the first sampling channel, the texture in the horizontal axis direction of the laser map is sampled to obtain the first channel map;

[0135] Based on the second sampling channel, the texture along the vertical axis of the laser map is sampled to obtain the second channel map;

[0136] One of the first channel texture and the second channel texture is flipped and then combined with the other unflipped channel texture to obtain the first texture map.

[0137] The above-mentioned model, which renders the model to be rendered based on the first texture map and the second texture map to obtain a laser effect, includes:

[0138] Using a matrix transformation algorithm, the normals in the first texture map are transformed into normals in world space. The transformed first texture map is then merged with the second texture map and added to the surface of the lighting model to obtain a laser-effect model.

[0139] In summary, based on the lighting model, the sampled normals of the texture are obtained from the vertex normals of the lighting model. Then, the simulated laser texture is projected onto the model in the view space to simulate the effect of thin film reflection. This is then superimposed onto a material layer on the lighting model to achieve the effect of simulating laser material. This method not only achieves low sampling and low computation but also reduces performance overhead, which can improve the frame rate, heat generation, and power consumption of the game, greatly enhancing the smoothness of the game.

[0140] The computer program product of the laser effect rendering method and related equipment provided in the embodiments of the present invention includes 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 method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0141] 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.

[0142] 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.

[0143] 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, essentially, or the part that contributes to the prior art, or a portion 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.

[0144] 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.

[0145] 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 laser effects, characterized in that, The method includes: Obtain the light reflection characteristics of the model to be rendered, and construct the lighting model of the model to be rendered in world space based on the light reflection characteristics; The vertex normals of the model to be rendered in the model space are obtained through the lighting model, and the vertex normals in the model space are converted into vertex normals in the view space. Using the vertex normals in the view space as sampling coordinates, the texture in the laser map is sampled to obtain the first texture map; The second texture map of the model to be rendered is obtained based on the lighting model; The model to be rendered is rendered based on the first texture map and the second texture map to obtain a laser-effect model.

2. The laser effect rendering method according to claim 1, characterized in that, The step of converting the vertex normals in the model space to vertex normals in the view space includes: Using a matrix transformation algorithm, the vertex normals in the model space are transformed to obtain the vertex normals of the model to be rendered in the view space.

3. The laser effect rendering method according to claim 2, characterized in that, The step of using a matrix transformation algorithm to transform the spatial position of the vertex normals in the model space to obtain the vertex normals of the model to be rendered in the view space includes: Determine the position coordinates of the vertex normals in the model space, and transform the position coordinates using the view matrix and projection matrix to obtain the vertex normals of the model to be rendered in the view space.

4. The laser effect rendering method according to claim 1, characterized in that, The step of using the vertex normals in the view space as sampling coordinates to sample the texture in the laser map to obtain the first texture map includes: The sampling coordinates are determined based on the UV coordinates of the vertex normal in the view space, wherein the sampling coordinates include at least two sampling channels; Based on at least one of the sampling channels, the textures in the laser map are sampled sequentially, and the sampled textures from each channel are synthesized to obtain the first texture map.

5. The laser effect rendering method according to claim 4, characterized in that, The determination of sampling coordinates based on the UV coordinates of the vertex normal in the view space includes: The UV coordinates of the vertex normals in the view space are weighted and calculated, and the sampling coordinates are determined based on the calculated UV coordinates of the vertex normals in the view space.

6. The laser effect rendering method according to claim 5, characterized in that, The sampling coordinates include a first sampling channel and a second sampling channel; the step of sequentially sampling the texture in the laser map based on at least one of the sampling channels, and synthesizing the sampled textures from each channel to obtain the first texture map includes: Based on the first sampling channel, the texture in the horizontal axis direction of the laser map is sampled to obtain the first channel map; Based on the second sampling channel, the texture along the vertical axis of the laser map is sampled to obtain the second channel map; One of the first channel texture and the second channel texture is flipped and then combined with the other unflipped channel texture to obtain the first texture map.

7. The method for rendering laser effects according to any one of claims 1-6, characterized in that, The process of rendering the model to be rendered based on the first texture map and the second texture map to obtain a laser effect includes: Using a matrix transformation algorithm, the normals in the first texture map are transformed into normals in world space. The transformed first texture map is then merged with the second texture map and added to the surface of the lighting model to obtain a laser-effect model.

8. A laser effect rendering device, characterized in that, The laser effect rendering device includes: The acquisition module is used to acquire the light reflection characteristics of the model to be rendered, and to construct the lighting model of the model to be rendered in world space based on the light reflection characteristics. The transformation module is used to obtain the vertex normals of the model to be rendered in the model space through the lighting model, and to convert the vertex normals in the model space into vertex normals in the view space. The sampling module is used to sample the texture in the laser map by taking the vertex normals in the view space as sampling coordinates to obtain a first texture map; and to obtain a second texture map of the model to be rendered based on the lighting model. The rendering module is used to render the model to be rendered based on the first texture map and the second texture map to obtain a model with a laser effect.

9. A laser effect rendering device, characterized in that, The laser effect rendering device includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor invokes the instructions in the memory to cause the laser effect rendering device to perform the steps of the laser effect rendering method as described in any one of claims 1-7.

10. A computer-readable storage medium storing instructions thereon, characterized in that, When the instructions are executed by the processor, they implement the various steps of the laser effect rendering method as described in any one of claims 1-7.