Light emitting rendering method and apparatus, electronic device, and computer readable storage medium

By constructing and offsetting the vertices of the initial luminous model, the luminous rendering effect at different angles is achieved, solving the hardware performance requirements of low-end and mid-range devices and adapting to the display problem of objects at different angles.

CN116310058BActive Publication Date: 2026-11-27NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310264171.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-10
Publication Date
2026-11-27
Estimated Expiration
2043-03-10

AI Technical Summary

Technical Problem

In existing technologies, the rendering methods for object luminescence effects require high hardware performance, making them unsuitable for low- to mid-range devices and unable to adapt to the display requirements of objects at different angles.

Method used

By obtaining the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model of the object to be rendered in the two-dimensional texture coordinate system, the vertex offset of the initial glow model is performed according to the stretch offset information to construct the target glow model, and pixel shading is performed to achieve the glow effect.

Benefits of technology

It reduces the hardware performance requirements, making it suitable for low- to mid-range devices, and can adapt to the lighting rendering needs of objects at different angles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116310058B_ABST
    Figure CN116310058B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a light emitting rendering method and device, electronic equipment and computer readable storage medium. The method comprises: obtaining pixel information corresponding to target texture coordinates of each vertex in an initial light emitting model of a to-be-rendered object in a two-dimensional texture coordinate system; obtaining stretching offset information of each vertex in the initial light emitting model according to the pixel information corresponding to the target texture coordinates of each vertex in the initial light emitting model in the two-dimensional texture coordinate system and a target light emitting region of the to-be-rendered object; performing stretching offset on each vertex in the initial light emitting model according to the stretching offset information of each vertex in the initial light emitting model to obtain a target light emitting model; and performing pixel shading on the target light emitting model according to the pixel information corresponding to the target texture coordinates of each vertex in the initial light emitting model in the two-dimensional texture coordinate system to render a light emitting special effect of the to-be-rendered object. The method can be applied to low-end devices and is suitable for different angles of objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and specifically to a light-emitting rendering method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] In modern video game graphics rendering, there is often a need to depict objects with external glowing effects, such as dazzling particles or eye-catching character weapons. Current technology typically employs a post-processing "Bloom" method, where the glowing area is extracted after the image rendering is complete, Gaussian blurred, and then superimposed onto the original rendered image. Alternatively, existing technology can use special effects patches, where glowing patches corresponding to the glowing areas are pre-made. Once the object's 3D model is determined, the glowing patch is attached to the side of the object facing the virtual camera. During subsequent rendering, the pixel information corresponding to the glowing patch is simultaneously superimposed with the pixel information of the surrounding object to achieve the glowing effect.

[0003] However, the aforementioned post-processing "Bloom" method requires high hardware performance and cannot be applied to low-end devices. For example, when extracting the luminous area and applying Gaussian blur, multiple rendering images are required, which consumes a lot of video memory bandwidth. Secondly, when applying Gaussian blur, multiple nearest neighbor sampling calculations are required, which places a huge computational burden on the shader. The method of attaching special effect patches is not applicable because the luminous area is fixed and cannot be changed. Since the display area and shape of an object are different at different angles, the required luminous area is also different. Summary of the Invention

[0004] This application provides a light-emitting rendering method, apparatus, electronic device, and computer-readable storage medium, which can improve the problems of the prior art requiring high hardware performance and being unable to be applied to different angles of objects.

[0005] This application provides a method for rendering luminescence, the method comprising: obtaining pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model of the object to be rendered in a two-dimensional texture coordinate system; obtaining stretching offset information of each vertex in the initial luminescence model based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in a two-dimensional texture coordinate system and the target luminescence region of the object to be rendered; stretching and offsetting each vertex in the initial luminescence model based on the stretching offset information of each vertex in the initial luminescence model to obtain a target luminescence model; and performing pixel shading on the target luminescence model based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in a two-dimensional texture coordinate system to render the luminescence effect of the object to be rendered.

[0006] This application embodiment also provides a light-emitting rendering apparatus, the apparatus comprising:

[0007] The data acquisition unit is used to acquire the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model of the object to be rendered in the two-dimensional texture coordinate system.

[0008] The offset information unit is used to obtain the stretch offset information of each vertex in the initial luminescence model based on the pixel information corresponding to the target texture coordinates of each vertex in the two-dimensional texture coordinate system and the target luminescence area of ​​the object to be rendered.

[0009] The vertex offset unit is used to stretch and offset each vertex in the initial luminescence model according to the stretching offset information of each vertex in the initial luminescence model to obtain the target luminescence model;

[0010] The pixel shading unit is used to perform pixel shading on the target luminous model according to the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model in the two-dimensional texture coordinate system, so as to render the luminous effect of the object to be rendered.

[0011] This application also provides an electronic device, including a processor and a memory, wherein the memory stores multiple instructions; the processor loads instructions from the memory to execute any of the luminescence rendering methods provided in this application.

[0012] This application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute any of the luminescence rendering methods provided in this application.

[0013] In the luminescence rendering method provided in this application embodiment, an initial luminescence model corresponding to the object to be rendered can be pre-constructed. This initial luminescence model can move or rotate with the object to be rendered. When it is necessary to perform luminescence rendering on the object to be rendered, the target texture coordinates of each vertex in the initial luminescence model and the pixel information corresponding to the target texture coordinates can be obtained. Based on the target texture coordinates and the target luminescence area required by the object to be rendered, the stretching offset information of each vertex in the initial luminescence model is obtained. Then, based on the stretching offset information, each vertex in the initial luminescence model is stretched and offset to obtain the target luminescence model. Finally, based on the pixel information corresponding to the target texture coordinates, each vertex in the target luminescence model is pixel-colored to achieve the luminescence effect. It does not require multiple rendering images or multiple nearest neighbor sampling calculations, thus it does not have high requirements for hardware performance and can be applied to low-end and mid-range devices. Since the target luminescence model is obtained by vertex offset based on the initial luminescence model corresponding to the object to be rendered, the initial luminescence model can meet the shape requirements of the target luminescence area, and the vertex offset can meet the area requirements of the target luminescence area. Therefore, the final target luminescence model can be applied to different angles of the object to be rendered. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1a This is a scene diagram of the luminescence rendering method provided in the embodiments of this application;

[0016] Figure 1b This is a schematic flowchart of a light emission rendering method provided in an embodiment of this application;

[0017] Figure 1c This is a schematic diagram of a two-dimensional texture coordinate system provided in an embodiment of this application;

[0018] Figure 1d This is a schematic diagram of the initial light-emitting model pixel after coloring according to an embodiment of this application;

[0019] Figure 1e This is a schematic diagram of the target luminous model pixel coloring obtained after vertex offset according to an embodiment of this application;

[0020] Figure 1f This is a schematic diagram of a target rendered image provided in an embodiment of this application;

[0021] Figure 2This is a schematic flowchart of a light emission rendering method provided in another embodiment of this application;

[0022] Figure 3 This is a schematic diagram of a light-emitting rendering device provided in an embodiment of this application;

[0023] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] This application provides a method, apparatus, electronic device, and storage medium for luminescent rendering.

[0026] Specifically, this luminescence rendering method can be integrated into electronic devices, such as terminals or servers. The terminal can be a mobile phone, tablet, smart Bluetooth device, laptop, or personal computer (PC); the server can be a single server or a server cluster consisting of multiple servers.

[0027] In some embodiments, the luminescence rendering method can also be integrated into multiple electronic devices. For example, the luminescence rendering method can be integrated into multiple servers, and the luminescence rendering method of this application can be implemented by multiple servers.

[0028] In some embodiments, the server may also be implemented as a terminal.

[0029] For example, see Figure 1aIn some embodiments, the electronic device can be a mobile terminal. This embodiment can obtain the target texture coordinates of each vertex in the initial luminescence model of the object to be rendered in a two-dimensional texture coordinate system, as well as the pixel information corresponding to the target texture coordinates; based on the target texture coordinates of each vertex in the initial luminescence model in a two-dimensional texture coordinate system and the target luminescence region of the object to be rendered, obtain the stretching offset information of each vertex in the initial luminescence model; based on the stretching offset information of each vertex in the initial luminescence model, stretch and offset each vertex in the initial luminescence model to obtain the target luminescence model; based on the target texture coordinates of each vertex in the initial luminescence model in a two-dimensional texture coordinate system and the pixel information corresponding to the target texture coordinates, perform pixel shading on the target luminescence model to obtain the luminescence rendering color information of the object to be rendered.

[0030] One embodiment of the luminescence rendering method disclosed in this application can run on a terminal device or a server. The terminal device can be a local terminal device. When the luminescence rendering method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and client devices.

[0031] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separated. The storage and execution of the luminescence rendering method are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a terminal, television, computer, or PDA; however, the terminal device performing luminescence rendering is the cloud gaming server in the cloud. When playing the game, the user operates the client device to send operation commands to the cloud gaming server, such as touch operation commands. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.

[0032] In an optional implementation, the terminal device can be a local terminal device. Taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the user through a graphical user interface, that is, conventionally downloading, installing, and running the game program via an electronic device. The local terminal device can provide the graphical user interface to the user in various ways, such as rendering it on the terminal's display screen, or providing it to the user through holographic projection. For example, the local terminal device can include a display screen for displaying the graphical user interface, which includes game screens, and a processor for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.

[0033] A game scene (or virtual scene) is a virtual environment displayed (or provided) by an application while it is running on a terminal or server. Optionally, this virtual scene can be a simulation of the real world, a semi-simulated / semi-fictional virtual environment, or a purely fictional virtual environment. A virtual scene can be either a two-dimensional or three-dimensional virtual scene. The virtual environment can be sky, land, ocean, etc., where land includes environmental elements such as deserts and cities. The virtual scene is the scene where the user controls the complete game logic of the virtual user. For example, in a sandbox-style 3D shooting game, the virtual scene is a 3D game world used for users to control virtual users in combat. Instances of virtual scenes can include at least one element selected from: mountains, plains, rivers, lakes, oceans, deserts, sky, plants, buildings, and vehicles.

[0034] A game interface refers to the interface of an application provided or displayed through a graphical user interface. This interface includes a graphical user interface for user interaction and game screens, which are the scenes in the game.

[0035] In an optional implementation, the UI (User Interface) may include game controls (e.g., skill controls, behavior controls, function controls, etc.), indicator icons (e.g., direction indicator icons, character indicator icons, etc.), information display area (e.g., number of kills, match time, etc.), or game settings controls (e.g., system settings, shop, gold coins, etc.).

[0036] In an optional implementation, the game screen is the display screen corresponding to the virtual scene displayed on the terminal device. The game screen may include virtual users such as game users who execute game logic in the virtual scene, non-player characters (NPCs), and artificial intelligence (AI) characters.

[0037] For example, in some embodiments, the content displayed in the graphical user interface at least partially includes a game scene, wherein the game scene contains at least one game object.

[0038] In some embodiments, game objects in a game scene include virtual objects controlled by the player, i.e., user objects.

[0039] Game objects refer to virtual objects within a virtual scene, including game characters. Game characters are controllable, dynamic objects, i.e., dynamic virtual objects. Optionally, these dynamic objects can be virtual characters, virtual animals, anime characters, etc. These virtual objects are characters controlled by the user through input devices, or AI trained and set up for battles in a virtual environment, or NPCs set up for battles in a virtual scene.

[0040] Optionally, the virtual object is a virtual character competing in a virtual scene. Optionally, the number of virtual objects in the virtual scene battle is preset, or dynamically determined according to the number of clients joining the battle; this embodiment of the application does not limit this.

[0041] In one possible implementation, the user can control virtual objects to perform game behaviors in the virtual scene. Game behaviors can include moving, casting skills, using items, and talking. For example, the user can control the virtual object to run, jump, crawl, etc., and can also control the virtual object to use skills and virtual items provided by the application to fight against other virtual objects.

[0042] Virtual cameras are an essential component of game scene visuals, used to present game scene visuals. Each game scene corresponds to at least one virtual camera, and depending on actual needs, there can be two or more. As a game rendering window, they capture and present the game world visuals to the user. By setting the parameters of the virtual camera, the user's viewing angle of the game world can be adjusted, such as first-person view or third-person view.

[0043] In one optional implementation, this invention provides a luminescence rendering method that provides a graphical user interface through a terminal device, wherein the terminal device may be the aforementioned local terminal device or a client device in the aforementioned cloud interaction system.

[0044] The following sections provide detailed descriptions of each example. It should be noted that the sequence numbers of the following embodiments are not intended to limit the preferred order of the embodiments.

[0045] In this embodiment, a luminescence rendering method is provided, such as... Figure 1b As shown. The specific process of this method may include the following steps 110 to 140:

[0046] 110. Obtain the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model of the object to be rendered in the two-dimensional texture coordinate system.

[0047] The initial glow model is pre-built, and its vertex coordinates correspond to the vertex coordinates of the object to be rendered. In other words, the position and shape of the initial glow model correspond to the object to be rendered. For example, in a game scene, a player can control a virtual character to swing a weapon. If the weapon is the object to be rendered (i.e., the weapon needs to glow), the pre-built initial glow model will be synchronously swung along with the weapon model in the background. Furthermore, the player can control the viewpoint, such as viewing the back of the virtual character as the first-person perspective and viewing the front as the second-person perspective. The player can switch between the first and second perspectives. During the viewpoint switch, the way the virtual player holds the weapon does not change, so the weapon's display changes with the viewpoint. Since the initial glow model is built corresponding to the object to be rendered, its display will also change with the viewpoint in this case.

[0048] Taking a bow and arrow as an example of a weapon held by a virtual character, the bowstring is the object to be rendered. The initial glow model is a strip-shaped model with an extremely thin width, similar or identical in shape to the bowstring. After vertex offsetting and pixel shading, this strip-shaped model can be superimposed on the bowstring to serve as the bowstring's glow effect. The object to be rendered and the initial glow model are independent, both having corresponding vertex structures, but their functions are different. The object to be rendered is used to represent the object itself, such as the bowstring, while the initial glow model is used to represent the glow effect of the bowstring. Through subsequent processing steps, the initial glow model is ultimately superimposed on the object to be rendered, thereby realizing the glow effect of the object to be rendered.

[0049] Vertex coordinates are the coordinates in the object's coordinate system. They depend on the model itself and do not change with the model's viewpoint. In other words, each vertex of the model corresponds to only one vertex coordinate.

[0050] Texture coordinates are the coordinates of each vertex in a two-dimensional texture coordinate system after the model is flattened. In the two-dimensional texture coordinate system, the pixel information of each vertex can be defined, which makes it easy to query the pixel information corresponding to the vertex according to the two-dimensional texture coordinate system for pixel shading and texture mapping. Like vertex coordinates, texture coordinates depend on the model itself and do not change with the model's viewpoint. That is, each vertex of the model has only one vertex coordinate. (It should be noted that since texture coordinates are used to query the pixel information corresponding to the vertex during subsequent pixel shading, this limitation only applies to a certain shading effect. For example, if the surface of a model includes red and white, under this shading effect, the pixel information corresponding to each vertex can only be red or white. If under other shading effects, the surface of the model can also include yellow and blue, then under this shading effect, the pixel information corresponding to each vertex can be yellow or blue.)

[0051] Corresponding to vertex coordinates and texture coordinates are screen coordinates, which are the coordinates in the screen coordinate system under the screen view. Screen coordinates depend on the viewpoint. In different viewpoints, the same vertex will correspond to different screen coordinates. Taking the virtual character holding a weapon as an example, if the virtual character holds the weapon in its right hand, in the first viewpoint, the screen coordinates corresponding to the weapon are located to the right of the screen coordinates corresponding to the virtual character. In the second viewpoint, the screen coordinates corresponding to the weapon are located to the left of the screen coordinates corresponding to the virtual character.

[0052] Pixel information is the color value. Taking a three-channel RGB color model as an example, pixel information includes R, G, and B values. In other embodiments, other types of color models can also be used.

[0053] Since the initial luminescence model is pre-constructed, and the target texture coordinates and corresponding pixel information are also pre-obtained through flattening, the method further includes the following steps before step 110:

[0054] A1. In response to the developer's model building instructions, the initial luminescence model is obtained.

[0055] Developers can create an initial glowing model using modeling software such as 3ds Max / Maya.

[0056] A2. Flatten the initial luminous model in a two-dimensional texture coordinate system to obtain the target texture coordinates of each vertex in the initial luminous model.

[0057] A3. In response to the developer's color determination instructions, determine the pixel information corresponding to each of the target texture coordinates.

[0058] For example, taking the bowstring mentioned above, developers can determine the pixel information corresponding to the target texture coordinates as white responsible for the highlight in the middle and light color responsible for the outer glow, based on actual needs.

[0059] Optionally, before step 110 and after step A1, the method further includes:

[0060] B1. Obtain the first bone vertex of the object to be rendered and the target bone bound to the first bone vertex.

[0061] The model consists of a large number of vertices. Manually moving such a large number of vertices to specific positions every frame is clearly an impossible task. Therefore, drawing inspiration from the relationship between animal bones and skin, virtual skeletons were designed for the model. Skeletons, sometimes called the framework, are composed of individual bones, just like the human skeleton. Vertices bound to the skeleton move along with the skeleton.

[0062] For example, taking the bowstring mentioned above as an example, when a virtual character needs to use a bow and arrow, it needs to perform a bow-drawing operation by hand. For example, the fingers hold a certain part of the bowstring and then pull it backward. In this process, the vertex corresponding to the part of the bowstring that is held is the first bone vertex. The first bone vertex is bound to the target bone corresponding to the fingers. When the bone corresponding to the fingers moves, the first bone vertex will move accordingly, thereby driving other vertices to move, realizing the entire bow-drawing process.

[0063] B2. Determine the corresponding second bone vertex in the initial luminous model based on the first bone vertex in the object to be rendered.

[0064] The vertex coordinates of the initial glow model correspond to those of the object to be rendered. Therefore, the second bone vertex in the initial glow model corresponding to the first bone vertex can be determined based on the first bone vertex.

[0065] B3. Bind the second bone vertex in the initial luminous model to the target bone.

[0066] Once the second bone vertex in the initial luminous model is bound to the target bone, the initial luminous model can also move with the target bone, thus achieving synchronous movement between the initial luminous model and the object to be rendered, thereby realizing luminous rendering of the object in different motion states.

[0067] 120. Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system and the target luminescence area of ​​the object to be rendered, the stretching offset information of each vertex in the initial luminescence model is obtained.

[0068] The stretch offset information represents the offset of a vertex in a certain direction by a certain distance. For example, if vertex a moves a distance c in the direction b, then this information is the stretch offset information of vertex a.

[0069] The target luminous area is the luminous area that the object to be rendered is ultimately intended to achieve. Taking the bowstring as an example, the target luminous area includes the highlight part of the bowstring area and the glow parts on both sides of the bowstring.

[0070] 130. Based on the stretching and offset information of each vertex in the initial luminescence model, stretch and offset each vertex in the initial luminescence model to obtain the target luminescence model.

[0071] like Figure 1c As shown, in the two-dimensional texture coordinate system, the pixel information corresponding to each target texture coordinate is white in the middle representing the highlight and gray on both sides representing the glow. If the pixel information corresponding to the target texture coordinate is directly used to color each vertex in the initial luminescence model, without considering the luminescence of the two bottom surfaces of the bowstring, the result may be as follows due to different viewing angles: Figure 1d The four scenarios are shown. Figure 1d In the image, from left to right, are the first, second, third, and fourth viewpoints. It can be seen that in the first viewpoint, the effect barely meets the requirement of a bright center with glowing sides. However, in the second to fourth viewpoints, the effect does not meet this requirement. Therefore, the initial size of the luminous model can be set to be smaller than the target luminous area. Then, the size can be adjusted to match the area of ​​the target luminous area by stretching and offsetting the vertices. In this method, by using a reasonable stretching strategy, a target luminous model that meets the above luminous effect requirements can be obtained from any viewpoint.

[0072] Taking the bowstring as an example, the object to be rendered is the bowstring, and the initial glow model is the initial glow effect corresponding to the bowstring. As can be seen from the above analysis, the initial glow effect only has the strip-like characteristics of the bowstring, but does not yet have the width characteristics of the glow effect, that is, it cannot achieve a glowing area with the desired area. The target glow model is the target glow effect corresponding to the bowstring. The target glow model is obtained by offsetting the vertex of the initial glow model. Specifically for the bowstring, the vertices on the left and right sides of the initial glow model are offset, so that the obtained target glow model has the width effect of the glow effect, that is, it can achieve a glowing area with the desired area.

[0073] If Figure 1d By stretching, offsetting, and recoloring the initial luminescence models under the first and second viewpoints, we can obtain the following: Figure 1e As shown, Figure 1e The left-hand coloring effect image corresponds to Figure 1dThe first perspective in the text, Figure 1e The right-hand side coloring effect image corresponds to Figure 1d The second perspective in the text shows that by stretching and offsetting each vertex in the initial luminous model to obtain the target luminous model, and then coloring the target luminous model, the above luminous effect requirements can be met regardless of the perspective, namely, the center is bright and the sides are glowing.

[0074] based on Figure 1e Based on the rendered image, it can be confirmed that the principle of vertex offset is: offset the vertices responsible for the glow to the outermost edge, and offset the vertices responsible for the highlights to the inner edge within a small range; for details, please refer to... Figure 1d and Figure 1e The white part responsible for the highlight in the initial luminescence model can be used as the reference point, and the gray parts responsible for the glow on both sides can be stretched and shifted to both sides.

[0075] Accordingly, in step 120, the pixel information corresponding to the target texture coordinates can be determined based on the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system. If the determined pixel information indicates that the vertex is responsible for the highlight part, then the vertex should be stretched and offset slightly inward. If the determined pixel information indicates that the vertex is responsible for the glow part, then the vertex should be stretched and offset outward so that the outermost vertex is stretched to the boundary of the target luminescence area. Of course, in other embodiments, when determining the pixel information of each vertex in the two-dimensional texture coordinate system, it can be directly based on the distribution of the target texture coordinates, such as... Figure 1c As shown, in this method, it can be determined that the vertex corresponding to the target texture coordinate on the left side in the two-dimensional texture coordinate system is responsible for the glow part, so this vertex can be directly stretched and offset to the left and outward. The vertex corresponding to the target texture coordinate on the right side in the two-dimensional texture coordinate system is responsible for the glow part, so this vertex can be directly stretched and offset to the right and outward. Similarly, the vertex corresponding to the target texture coordinate in the middle in the two-dimensional texture coordinate system is responsible for the highlight part, so this vertex can be directly stretched and offset within a small range inward.

[0076] When the vertices of the initial luminous model are stretched and offset from different perspectives, the resulting highlight may not be located in the center of the target luminous model, but may move slightly to the sides. However, as mentioned above, the size of the initial luminous model is smaller than the size of the target luminous area, and the error mentioned above depends on the size of the initial luminous model. Therefore, the smaller the size of the initial luminous model relative to the size of the target luminous area, the smaller the error after stretching and offsetting.

[0077] In step 130, before stretching and offsetting each vertex in the initial luminous model in the vertex shader, it is necessary to perform coordinate transformation to convert it from vertex coordinates to screen coordinates, i.e., Pos coordinates. Specifically, the transformation can be performed using the MVP matrix. After the transformation, according to the stretching and offset information determined in step 120, each vertex in the initial luminous model is stretched and offset to obtain the target luminous model. Then, the coordinates of each vertex in the target luminous model are output to the clip space. In the clip space, vertices that cannot be displayed on the screen can be removed, including vertices that exceed the screen boundary and vertices that are occluded according to the hierarchy.

[0078] It is important to note that the number of vertices in the initial luminescence model is fixed. If only the vertices in the initial luminescence model are stretched and offset, the spacing between the offset vertices will increase, making it impossible to achieve the continuity of subsequent shading. Therefore, in this embodiment, when stretching and offsetting vertices, new vertices are automatically filled between adjacent vertices to ensure that while the area increases, the number of vertices also increases. The pixel information corresponding to the added vertices is the pixel information between the pixel information of adjacent vertices. In the two-dimensional texture coordinate system, a continuous and dense pixel matrix is ​​usually given.

[0079] Optionally, step 120 may specifically include steps 121 to 123 as follows:

[0080] 121. Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, determine the stretching offset direction of each vertex in the initial luminescence model.

[0081] As mentioned above, for each vertex, it is necessary to query its target texture coordinates in the two-dimensional coordinate system to determine the pixel information corresponding to the vertex. Based on the pixel information, the display part that the vertex is responsible for is determined. Taking the bowstring as an example, if it is responsible for the glow part on the left outer side, then the stretching offset direction of the vertex is to the left. Conversely, if it is responsible for the glow part on the right outer side, then the stretching offset direction of the vertex is to the right.

[0082] Optionally, step 121 specifically includes the following steps 1211 to 1212:

[0083] 1211. Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, determine the reference texture coordinates in the two-dimensional texture coordinate system.

[0084] The reference texture coordinates are determined based on the target texture coordinates of the vertices responsible for highlighting the inner part. Since the vertices responsible for highlighting usually do not require extensive stretching, they can be used as reference points. The reference texture coordinates can be the target texture coordinates of the vertices located at the very center of the inner part responsible for highlighting. Figure 1c As shown, the set of target texture coordinates on the symmetrical axes dividing the left and right sides of the figure can be directly determined as the reference texture coordinates.

[0085] 1212. Based on the relative positions of the target texture coordinates and the reference texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, determine the stretching offset direction of each vertex in the initial luminescence model.

[0086] Using the reference texture coordinates as a reference point, its position is fixed during stretching and offsetting, such as... Figure 1c As shown, if the target texture coordinates of a vertex are to the left relative to the reference texture coordinates, then whether the vertex is responsible for the highlight or the glow, its corresponding stretch offset direction can be determined to the left. Similarly, if the target texture coordinates of a vertex are to the right relative to the reference texture coordinates, then whether the vertex is responsible for the highlight or the glow, its corresponding stretch offset direction can be determined to the right.

[0087] Optionally, the initial luminescence model and the object to be rendered are strip-shaped; correspondingly, step 1212 specifically includes the following steps 12121 to 12123:

[0088] 12121. Based on the relative positions of the target texture coordinates and the reference texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, determine the first vertex and the second vertex among the vertices in the initial luminescence model.

[0089] The first vertex and the second vertex are symmetric based on the reference texture coordinates.

[0090] The initial glow model and the object to be rendered are in the form of strips, corresponding to... Figure 1c In the embodiments described, the reference texture coordinates are... Figure 1c The set of target texture coordinates on the left and right axes of symmetry. The vertex corresponding to the target texture coordinate on the left side of the axis of symmetry is the first vertex, and the vertex corresponding to the target texture coordinate on the right side of the axis of symmetry is the second vertex.

[0091] It is important to note that this method is based on the pixel information corresponding to each target texture coordinate in the two-dimensional texture coordinate system, which corresponds to the glow effect, i.e., a bright center and glowing sides. In other extreme cases, the pixel information corresponding to each target texture coordinate in the two-dimensional texture coordinate system does not directly correspond to the glow effect. For example, if the glowing sides and the bright center are divided into three regions, the two glowing regions may be on the left or right side at the same time (i.e., the bright area is on the right or left side), or they may be in the middle at the same time (i.e., the bright area is divided into two sub-regions, located on the left and right sides respectively). Under this method, it is not possible to directly determine the first vertex and the second vertex based on the axis of symmetry.

[0092] 12122. The direction in which the target texture coordinates of the first vertex in the two-dimensional texture coordinate system are far away from the reference texture coordinates is determined as the stretching offset direction of the first vertex.

[0093] 12123. The direction in which the target texture coordinates of the second vertex in the two-dimensional texture coordinate system are far away from the reference texture coordinates is determined as the stretching offset direction of the second vertex.

[0094] The target texture coordinates corresponding to the first and second vertices are on the left and right sides of the axis of symmetry, respectively. Therefore, the direction away from the reference texture coordinates is the left or right.

[0095] 122. Based on the stretch offset direction of each vertex in the initial luminescence model and the target luminescence area of ​​the object to be rendered, determine the stretch offset distance of each vertex in the initial luminescence model.

[0096] Optionally, the width of the initial luminescence model is smaller than the width of the object to be rendered.

[0097] As mentioned in the above embodiments, the size of the initial luminescence model is smaller than the size of the target luminescence area, and the smaller the size, the smaller the error. Therefore, in this embodiment, taking a strip-shaped bowstring as an example, since only the width needs to be considered, the width of the initial luminescence model can be limited to be smaller than the width of the object to be rendered. Since the width of the object to be rendered is necessarily smaller than the width of the target luminescence area, the width of the initial luminescence model is further reduced, thus reducing the error after subsequent stretching and offsetting. Optionally, the width of the initial luminescence model is 0.01 times the width of the object to be rendered.

[0098] The purpose of stretching and offsetting is to meet the area requirements of the target luminous area. Therefore, after determining the stretching and offset direction to each vertex, each vertex needs to be stretched and offset according to the stretching and offset direction to cover the target luminous area; for example... Figure 1cAs shown, the vertices corresponding to the target texture coordinates on the left need to be stretched to the left, and the vertices corresponding to the target texture coordinates on the right need to be stretched to the right. The vertices stretched to the left and right are responsible for covering the left and right parts of the target luminous area, respectively. Therefore, for the vertices stretched to the left, after stretching, they need to cover the left part of the target luminous area. One of these vertices can be identified as the left boundary vertex, meaning this vertex needs to be stretched to the left boundary of the target luminous area. The distance between the left boundary of the target luminous area and the vertex corresponding to the reference texture coordinates is the stretching distance of this left boundary vertex. Then, based on this left boundary vertex, the stretching distance is determined according to the positional relationship between the other vertices stretched to the left and the left boundary vertex. The spacing is determined by dividing the distance between the left boundary vertex and the right boundary vertex, thereby determining the stretching offset distance to other vertices that are stretched to the left. Similarly, for vertices that are stretched to the right, after stretching, they need to cover the right side of the target luminous area. For these vertices, one of them can be identified as the right boundary vertex, that is, this vertex needs to be stretched to the right boundary of the target luminous area. The distance between the right boundary of the target luminous area and the vertex corresponding to the reference texture coordinate is the stretching offset distance of the right boundary vertex. Then, based on the right boundary vertex, the spacing is divided according to the positional relationship between the other right-stretched vertices and the right boundary vertex, as well as the stretching offset distance of the right boundary vertex, thereby determining the stretching offset distance to other right-stretched vertices.

[0099] Optionally, step 122 specifically includes the following steps 1221 to 1223:

[0100] 1221. Determine multiple target vertices in the initial luminescence model that are adjacent and have different stretching offset directions.

[0101] like Figure 1c and Figure 1d As shown in the figure, the vertices responsible for the left glow and the vertices responsible for the right glow are connected in the initial luminescence model. Then, the stretching and offset directions of these two vertices are opposite. Therefore, in this embodiment, these two vertices can be directly determined as target vertices (which can also be understood as the boundary vertices mentioned in the above embodiment, used to stretch and offset to the boundary of the target luminescence area). After the vertices responsible for the left glow and the vertices responsible for the right glow are respectively designated as target vertices, since the target vertices need to be stretched and offset to both ends, other vertices can be offset between the two types of target vertices, that is, between the two ends, offset to the corresponding position according to the corresponding expected spacing.

[0102] 1222. Based on the stretching offset direction of each target vertex, the current position of each target vertex, and the boundary position of the target luminous area, the stretching offset distance of each target vertex is obtained.

[0103] If the target vertex is responsible for the left glow, then the stretching offset direction of the target vertex is to the left, and the target distance from the current position of the target vertex to the boundary of the target glowing area is the distance that the target vertex needs to offset; the same applies to the target vertex responsible for the right glow.

[0104] 1223. Based on the stretching offset direction and stretching offset distance of each target vertex, determine the stretching offset distance of the vertex in the initial luminescence model that has the same stretching offset direction as each target vertex.

[0105] like Figure 1c and Figure 1d It can be seen that there are two points where the vertices with opposite stretching offset directions meet in the initial luminescence model. One is the part of the vertices responsible for the left glow and the part of the vertices responsible for the right glow mentioned in the above steps. The other is the part of the vertices responsible for the left highlight and the part of the vertices responsible for the right highlight. For the vertices responsible for highlighting, they do not need to be offset over a large range. Since the vertices responsible for highlighting in the connected part can be used as reference points with fixed positions, the connected vertices responsible for highlighting and the connected vertices responsible for glowing are respectively used as the two ends of the offset. The distance between the two ends can be reasonably distributed to the other vertices between the connected vertices responsible for highlighting and the connected vertices responsible for glowing.

[0106] 123. Based on the stretching offset direction and stretching offset distance of each vertex in the initial luminescence model, obtain the stretching offset information of each vertex in the initial luminescence model.

[0107] After obtaining the stretch offset direction and stretch offset distance, a mapping relationship can be established based on the corresponding vertices to bind the three together, thus obtaining the stretch offset information.

[0108] 140. Based on the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system and the pixel information corresponding to the target texture coordinates, pixel coloring is performed on the target luminescence model to render the luminescence effect of the object to be rendered.

[0109] In the pixel shader, the target luminous model can be pixel-shaded according to the pixel information of each vertex. After the shading is completed, the corresponding luminous rendering color information can be output. The color information corresponds to each vertex with spatial coordinates.

[0110] It should be noted that the glow rendering color information is the glow effect. Specifically, the glow rendering color information includes the position and color value of each pixel required for the glow effect. After the glow rendering color information is output to the display unit, the display unit displays the desired glow effect in the image based on the glow rendering color information.

[0111] Optionally, after step 140, the method further includes:

[0112] C1. Obtain the basic rendering color information corresponding to the object to be rendered.

[0113] The basic rendering color information corresponding to the object to be rendered, taking the bowstring as an example, includes the color information of the bow and arrow, the color information of the virtual character using the bow and arrow, and the color information of the background environment in which the virtual character is located.

[0114] The specific steps to obtain the basic rendering color information are similar to those for obtaining the luminous rendering color information described above. The difference is that the basic rendering color information does not need to be obtained through vertex offset. For specific details, please refer to existing technologies, which will not be elaborated here.

[0115] C2. The base rendering color information and the luminous rendering color information are superimposed to obtain the target rendering image.

[0116] As mentioned above, the vertices of the glowing model correspond to the vertices of the object to be rendered, meaning their coordinate positions overlap. If color overlay is performed directly, the color of the object to be rendered and the color of the glowing model will interfere with each other, thus failing to achieve the glowing effect. Therefore, in this embodiment, when performing pixel shading on the basic model including the object to be rendered, only the object to be rendered (which can be understood as the corresponding highlight part) and the surrounding area (which can be understood as the corresponding glow part) are shading. This ensures that the obtained basic rendering color information does not include the color information of the object to be rendered and its surrounding area. Based on this method, after color overlay, the glowing rendering color information will occupy the area separately, thus avoiding interference and achieving the glowing effect. In a game scene, the obtained target rendering image is as follows: Figure 1f As shown in the image, the part indicated by the arrow is the achieved lighting effect.

[0117] It is important to note that both the base rendering color information and the emissive rendering color information need to be mixed using the ADD blending mode in the pixel shader. This means that other areas that are not shaded according to the vertex pixel information are not filled with default pixels.

[0118] Optionally, step 140 specifically includes steps 131 to 132:

[0119] 131. Based on the stretching and offset information of each vertex in the initial luminescence model, stretch and offset each vertex in the initial luminescence model to obtain the intermediate luminescence model.

[0120] 132. Offset each vertex in the intermediate luminous model to one side of the virtual camera to obtain the target luminous model, so that the luminous rendering color information corresponding to the target luminous model can cover the basic rendering color information corresponding to the object to be rendered.

[0121] As mentioned above, if the object to be rendered and its surroundings are not differentiated when obtaining the basic rendering color information, color interference will occur. Therefore, in this embodiment, the intermediate luminous model after stretching and offset can be subjected to hierarchical offset so that the screen coordinates of each vertex of the obtained target luminous model are closer to the virtual camera relative to the screen coordinates of the object to be rendered and the vertices around the object (that is, all vertices of the luminous model are moved to one side of the virtual camera at the same time). In other words, the luminous rendering color information obtained subsequently can cover the color information of the object to be rendered and its surroundings in the basic rendering color information.

[0122] It should be noted that the luminescence rendering method provided in this application can be applied not only to the strip bowstring scene mentioned above, but also to other shapes of objects to be rendered, such as cones or spheres. The core idea is to construct a small initial luminescence model and stretch and offset the vertices according to the highlight and glow parts.

[0123] In the luminescence rendering method provided in this application embodiment, an initial luminescence model corresponding to the object to be rendered can be pre-constructed. This initial luminescence model can move or rotate with the object to be rendered. When it is necessary to perform luminescence rendering on the object to be rendered, the target texture coordinates of each vertex in the initial luminescence model and the pixel information corresponding to the target texture coordinates can be obtained. Based on the target texture coordinates and the target luminescence area required by the object to be rendered, the stretching offset information of each vertex in the initial luminescence model is obtained. Then, based on the stretching offset information, each vertex in the initial luminescence model is stretched and offset to obtain the target luminescence model. Finally, based on the pixel information corresponding to the target texture coordinates, each vertex in the target luminescence model is pixel-colored to achieve the luminescence effect. It does not require multiple rendering images or multiple nearest neighbor sampling calculations, thus it does not have high requirements for hardware performance and can be applied to low-end and mid-range devices. Since the target luminescence model is obtained by vertex offset based on the initial luminescence model corresponding to the object to be rendered, the initial luminescence model can meet the shape requirements of the target luminescence area, and the vertex offset can meet the area requirements of the target luminescence area. Therefore, the final target luminescence model can be applied to different angles of the object to be rendered.

[0124] The method described in the above embodiments will be further described in detail below.

[0125] In this embodiment, a strip-shaped object to be rendered and an initial luminous model are used as examples, wherein the width of the initial luminous model is smaller than the width of the object to be rendered. The method of this embodiment will be described in detail below.

[0126] like Figure 2 As shown, the specific process of a luminescence rendering method is as follows:

[0127] 201. Obtain the first bone vertex of the object to be rendered and the target bone bound to the first bone vertex.

[0128] 202. Determine the corresponding second bone vertex in the initial luminescence model based on the first bone vertex in the object to be rendered.

[0129] 203. Bind the second bone vertex in the initial luminous model to the target bone.

[0130] 204. Obtain the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model of the object to be rendered in the two-dimensional texture coordinate system.

[0131] 205. Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, determine the reference texture coordinates in the two-dimensional texture coordinate system.

[0132] 206. Based on the relative positions of the target texture coordinates and the reference texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, determine the first vertex and the second vertex among the vertices in the initial luminescence model; the first vertex and the second vertex are symmetrical based on the reference texture coordinates.

[0133] 207. The direction in which the target texture coordinates of the first vertex in the two-dimensional texture coordinate system are far away from the reference texture coordinates is determined as the stretching offset direction of the first vertex.

[0134] 208. The direction in which the target texture coordinates of the second vertex in the two-dimensional texture coordinate system are far away from the reference texture coordinates is determined as the stretching offset direction of the second vertex.

[0135] 209. Based on the stretch offset direction of each vertex in the initial luminescence model and the target luminescence area of ​​the object to be rendered, determine the stretch offset distance of each vertex in the initial luminescence model.

[0136] Optionally, step 209 specifically includes the following steps 2091 to 2093:

[0137] 2091. Identify multiple target vertices in the initial luminescence model that have different stretching offset directions and are adjacent to each other.

[0138] 2092. Based on the stretching offset direction of each target vertex, the current position of each target vertex, and the boundary position of the target luminous area, the stretching offset distance of each target vertex is obtained.

[0139] 2093. Based on the stretching offset direction and stretching offset distance of each of the target vertices, determine the stretching offset distance of the vertices in the initial luminescence model that have the same stretching offset direction as each of the target vertices.

[0140] 2010. Based on the stretching offset direction and stretching offset distance of each vertex in the initial luminescence model, the stretching offset information of each vertex in the initial luminescence model is obtained.

[0141] 2011. Based on the stretching and offset information of each vertex in the initial luminescence model, stretch and offset each vertex in the initial luminescence model to obtain the target luminescence model.

[0142] Optionally, step 2011 specifically includes the following steps 20111 to 20112:

[0143] 20111. Based on the stretching and offset information of each vertex in the initial luminescence model, stretch and offset each vertex in the initial luminescence model to obtain the intermediate luminescence model.

[0144] 20112. Offset each vertex in the intermediate luminescence model to one side of the virtual camera to obtain the target luminescence model, so that the luminescence rendering color information corresponding to the target luminescence model can cover the basic rendering color information corresponding to the object to be rendered.

[0145] 2012. Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, pixel coloring is performed on the target luminescence model to obtain the luminescence rendering color information of the object to be rendered.

[0146] 2013. Obtain the basic rendering color information corresponding to the object to be rendered.

[0147] 2014. The basic rendering color information and the luminous rendering color information are superimposed to obtain the target rendering image.

[0148] In the luminescence rendering method provided in this application embodiment, an initial luminescence model corresponding to the object to be rendered can be pre-constructed. This initial luminescence model can move or rotate with the object to be rendered. When it is necessary to perform luminescence rendering on the object to be rendered, the target texture coordinates of each vertex in the initial luminescence model and the pixel information corresponding to the target texture coordinates can be obtained. Based on the target texture coordinates and the target luminescence area required by the object to be rendered, the stretching offset information of each vertex in the initial luminescence model is obtained. Then, based on the stretching offset information, each vertex in the initial luminescence model is stretched and offset to obtain the target luminescence model. Finally, based on the pixel information corresponding to the target texture coordinates, each vertex in the target luminescence model is pixel-colored to achieve the luminescence effect. It does not require multiple rendering images or multiple nearest neighbor sampling calculations, thus it does not have high requirements for hardware performance and can be applied to low-end and mid-range devices. Since the target luminescence model is obtained by vertex offset based on the initial luminescence model corresponding to the object to be rendered, the initial luminescence model can meet the shape requirements of the target luminescence area, and the vertex offset can meet the area requirements of the target luminescence area. Therefore, the final target luminescence model can be applied to different angles of the object to be rendered.

[0149] In the luminescence rendering method provided in this application embodiment, the initial luminescence model is skeletally skinned so that it can move along with the object to be rendered, thereby realizing luminescence rendering of the object under various motion states.

[0150] In the luminescence rendering method provided in this application embodiment, the target luminescence model is obtained by performing hierarchical offset on the vertices, so that the step of obtaining the basic rendering color information does not need to be adjusted and color interference is not caused.

[0151] To better implement the above methods, this application also provides a light-emitting rendering device, which can be integrated into an electronic device, such as a terminal. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, or similar device.

[0152] For example, in this embodiment, the device of this application embodiment will be described in detail by taking the light-emitting rendering device specifically integrated into the terminal as an example.

[0153] For example, such as Figure 3 As shown, the luminous rendering device may include:

[0154] The data acquisition unit 301 is used to acquire the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model of the object to be rendered in the two-dimensional texture coordinate system;

[0155] The offset information unit 302 is used to obtain the stretch offset information of each vertex in the initial luminescence model based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system and the target luminescence area of ​​the object to be rendered.

[0156] Vertex offset unit 303 is used to stretch and offset each vertex in the initial luminescence model according to the stretching offset information of each vertex in the initial luminescence model to obtain the target luminescence model;

[0157] The pixel shading unit 304 is used to perform pixel shading on the target luminous model according to the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model in the two-dimensional texture coordinate system, so as to render the luminous effect of the object to be rendered.

[0158] In some embodiments, the offset information unit includes:

[0159] The offset direction unit is used to determine the stretch offset direction of each vertex in the initial luminescence model based on the pixel information corresponding to the target texture coordinates of each vertex in the two-dimensional texture coordinate system.

[0160] Offset distance unit, used to determine the stretch offset distance of each vertex in the initial luminescence model based on the stretch offset direction of each vertex in the initial luminescence model and the target luminescence area of ​​the object to be rendered;

[0161] The information integration unit is used to obtain the stretching offset information of each vertex in the initial light emission model based on the stretching offset direction and stretching offset distance of each vertex in the initial light emission model.

[0162] In some embodiments, the offset direction unit includes:

[0163] A reference coordinate unit is used to determine the reference texture coordinates in the two-dimensional texture coordinate system based on the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model in the two-dimensional texture coordinate system; the reference texture coordinates include the texture coordinates of at least one vertex in the initial glow model responsible for the highlighted part of the glow effect in the two-dimensional texture coordinate system.

[0164] The direction determination unit is used to determine the stretching offset direction of each vertex in the initial luminescence model based on the relative position of each vertex in the initial luminescence model in the target texture coordinate system and the reference texture coordinate system.

[0165] In some embodiments, the initial luminescence model and the object to be rendered are strip-shaped; the direction determination unit includes:

[0166] A vertex partitioning unit is used to determine the first vertex and the second vertex among the vertices in the initial luminescence model based on the relative positions of the target texture coordinates and the reference texture coordinates of each vertex in the two-dimensional texture coordinate system; the first vertex and the second vertex are symmetrical based on the reference texture coordinates;

[0167] The first direction unit is used to determine the direction in which the target texture coordinates of the first vertex in the two-dimensional texture coordinate system are away from the reference texture coordinates as the stretching offset direction of the first vertex;

[0168] The second direction unit is used to determine the direction in which the target texture coordinates of the second vertex in the two-dimensional texture coordinate system are away from the reference texture coordinates as the stretching offset direction of the second vertex.

[0169] In some embodiments, the width of the initial luminous model is smaller than the width of the object to be rendered.

[0170] In some embodiments, the offset distance unit includes:

[0171] Target vertex unit, used to determine multiple adjacent target vertices with different stretching offset directions in the initial luminescence model;

[0172] The first distance determination unit is used to obtain the stretching offset distance of each target vertex based on the stretching offset direction of each target vertex, the current position of each target vertex, and the boundary position of the target luminous area.

[0173] The second distance determination unit is used to determine the stretch offset distance of vertices in the initial luminescence model that have the same stretch offset direction as each of the target vertices, based on the stretch offset direction and stretch offset distance of each of the target vertices.

[0174] In some embodiments, the apparatus further includes:

[0175] The skeleton acquisition unit is used to acquire the first bone vertex and the target bone bound to the first bone vertex in the object to be rendered before acquiring the target texture coordinates of each vertex in the two-dimensional texture coordinate system and the pixel information corresponding to the target texture coordinates in the initial light-emitting model of the object to be rendered.

[0176] A bone vertex determination unit is used to determine the corresponding second bone vertex in the initial luminous model based on the first bone vertex in the object to be rendered.

[0177] A vertex binding unit is used to bind the second bone vertex in the initial luminous model to the target bone.

[0178] In some embodiments, the apparatus further includes:

[0179] The basic data acquisition unit is used to obtain the basic rendering color information of the object to be rendered after performing pixel coloring on the target luminous model based on the target texture coordinates of each vertex in the initial luminous model in the two-dimensional texture coordinate system and the pixel information corresponding to the target texture coordinates, and obtaining the luminous rendering color information of the object to be rendered.

[0180] The color overlay unit is used to overlay the basic rendering color information and the luminous rendering color information to obtain the target rendering image.

[0181] In some embodiments, the vertex offset unit includes:

[0182] The first offset unit is used to stretch and offset each vertex of the initial luminescence model according to the stretching and offset information of each vertex in the initial luminescence model to obtain an intermediate luminescence model;

[0183] The second offset unit is used to offset each vertex in the intermediate luminous model to one side of the virtual camera to obtain the target luminous model, so that the luminous rendering color information corresponding to the target luminous model can cover the basic rendering color information corresponding to the object to be rendered.

[0184] An initial luminous model corresponding to the object to be rendered can be pre-constructed. This initial luminous model can move or rotate along with the object. When luminous rendering of the object is required, the target texture coordinates of each vertex in the initial luminous model and the corresponding pixel information can be obtained. Based on the target texture coordinates and the target luminous area required by the object, the stretching offset information of each vertex in the initial luminous model can be obtained. Then, the vertices in the initial luminous model are stretched and offset according to the stretching offset information to obtain the target luminous model. Finally, the pixels of each vertex in the target luminous model are pixel-colored according to the pixel information corresponding to the target texture coordinates to achieve the luminous effect. It does not require multiple rendering images or multiple nearest neighbor sampling calculations, thus not requiring high hardware performance and can be applied to low- and mid-range devices. Since the target luminous model is obtained by vertex offset based on the initial luminous model corresponding to the object, the initial luminous model can meet the shape requirements of the target luminous area, and the vertex offset can meet the area requirements of the target luminous area. Therefore, the final target luminous model can be applied to different angles of the object to be rendered.

[0185] The initial luminous model is skeletally skinned so that it can move along with the object to be rendered, thus achieving luminous rendering of the object in various motion states.

[0186] By performing hierarchical offset on the vertices, the target emission model is obtained, thus eliminating the need to adjust the steps for obtaining the basic rendering color information and preventing color interference.

[0187] This application also provides an electronic device, which can be a terminal, a server, or other similar device. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.

[0188] In some embodiments, the luminescence rendering device can also be integrated into multiple electronic devices. For example, the luminescence rendering device can be integrated into multiple servers, and the luminescence rendering method of this application can be implemented by multiple servers.

[0189] In this embodiment, the electronic device will be used as an example for detailed description, such as... Figure 4 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:

[0190] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, an input module 404, and a communication module 405. Those skilled in the art will understand that... Figure 4 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0191] The processor 401 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402, thereby providing overall monitoring of the electronic device. In some embodiments, the processor 401 may include one or more processing cores; in some embodiments, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 401.

[0192] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0193] The electronic device also includes a power supply 403 that supplies power to the various components. In some embodiments, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0194] The electronic device may also include an input module 404, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0195] The electronic device may also include a communication module 405. In some embodiments, the communication module 405 may include a wireless module, through which the electronic device can perform short-range wireless transmission, thereby providing users with wireless broadband internet access. For example, the communication module 405 can be used to help users send and receive emails, browse web pages, and access streaming media.

[0196] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:

[0197] Obtain the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model of the object to be rendered in the two-dimensional texture coordinate system; based on the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model in the two-dimensional texture coordinate system and the target glow area of ​​the object to be rendered, obtain the stretching offset information of each vertex in the initial glow model; based on the stretching offset information of each vertex in the initial glow model, stretch and offset each vertex in the initial glow model to obtain the target glow model; based on the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model in the two-dimensional texture coordinate system, perform pixel shading on the target glow model to render the glow effect of the object to be rendered.

[0198] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0199] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0200] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the luminescence rendering methods provided in embodiments of this application. For example, the instructions can execute the following steps:

[0201] Obtain the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model of the object to be rendered in the two-dimensional texture coordinate system; based on the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model in the two-dimensional texture coordinate system and the target glow area of ​​the object to be rendered, obtain the stretching offset information of each vertex in the initial glow model; based on the stretching offset information of each vertex in the initial glow model, stretch and offset each vertex in the initial glow model to obtain the target glow model; based on the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model in the two-dimensional texture coordinate system, perform pixel shading on the target glow model to render the glow effect of the object to be rendered.

[0202] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0203] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.

[0204] Since the instructions stored in the storage medium can execute the steps of any of the luminous rendering methods provided in the embodiments of this application, the beneficial effects that any of the luminous rendering methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0205] The foregoing has provided a detailed description of a light-emitting rendering method, apparatus, electronic device, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for rendering luminescence, characterized in that, The method includes: Obtain the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model of the object to be rendered in the two-dimensional texture coordinate system; Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system and the target luminescence area of ​​the object to be rendered, the stretching offset information of each vertex in the initial luminescence model is obtained. Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, the reference texture coordinates in the two-dimensional texture coordinate system are determined; the reference texture coordinates include the texture coordinates of at least one vertex in the initial luminescence model that is responsible for the highlighted part of the luminescence effect of the object to be rendered in the two-dimensional texture coordinate system. Based on the relative positions of the target texture coordinates and the reference texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, the stretching offset direction of each vertex in the initial luminescence model is determined; Based on the stretch offset direction of each vertex in the initial luminescence model and the target luminescence area of ​​the object to be rendered, determine the stretch offset distance of each vertex in the initial luminescence model; Based on the stretching offset direction and stretching offset distance of each vertex in the initial luminescence model, the stretching offset information of each vertex in the initial luminescence model is obtained; Based on the stretching and offset information of each vertex in the initial luminescence model, stretching and offsetting are performed on each vertex of the initial luminescence model to obtain the target luminescence model; Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, the target luminescence model is pixel-colored to render the luminescence effect.

2. The method as described in claim 1, characterized in that, The initial luminescence model and the object to be rendered are strip-shaped; determining the stretching offset direction of each vertex in the initial luminescence model based on the relative position of each vertex in the initial luminescence model in the target texture coordinate system and the reference texture coordinate system includes: Based on the relative positions of the target texture coordinates and the reference texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, the first vertex and the second vertex in the initial luminescence model are determined; the first vertex and the second vertex are symmetrical based on the reference texture coordinates. The direction in which the target texture coordinates of the first vertex in the two-dimensional texture coordinate system are far away from the reference texture coordinates is determined as the stretching offset direction of the first vertex; The direction in which the target texture coordinates of the second vertex in the two-dimensional texture coordinate system are far away from the reference texture coordinates is determined as the stretching offset direction of the second vertex.

3. The method as described in claim 2, characterized in that, The width of the initial luminescence model is smaller than the width of the object to be rendered.

4. The method as described in claim 1, characterized in that, The step of determining the stretch offset distance of each vertex in the initial luminescence model based on the stretch offset direction of each vertex in the initial luminescence model and the target luminescence area of ​​the object to be rendered includes: Identify multiple adjacent target vertices with different stretching offset directions in the initial luminescence model; The stretching offset distance of each target vertex is obtained based on the stretching offset direction of each target vertex, the current position of each target vertex, and the boundary position of the target luminous area. Based on the stretching offset direction and stretching offset distance of each target vertex, the stretching offset distance of the vertex in the initial luminescence model that has the same stretching offset direction as each target vertex is determined.

5. The method as described in claim 1, characterized in that, Before obtaining the target texture coordinates of each vertex in the two-dimensional texture coordinate system and the corresponding pixel information of the target texture coordinates in the initial luminescence model of the object to be rendered, the method further includes: Obtain the first bone vertex of the object to be rendered and the target bone bound to the first bone vertex; The second bone vertex in the initial luminous model is determined based on the first bone vertex in the object to be rendered; Bind the second bone vertex in the initial luminescence model to the target bone.

6. The method as described in claim 1, characterized in that, The step of performing pixel shading on the target luminescence model based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminescence model in the two-dimensional texture coordinate system, in order to render the luminescence effect of the object to be rendered, includes: Based on the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model in the two-dimensional texture coordinate system, the target luminous model is pixel-colored to obtain the luminous rendering color information of the object to be rendered. Obtain the basic rendering color information corresponding to the object to be rendered; The base rendering color information and the luminescence rendering color information are superimposed to render the luminescence effect of the object to be rendered.

7. The method as described in claim 6, characterized in that, The step of stretching and offsetting each vertex of the initial luminescence model according to the stretching and offset information of each vertex in the initial luminescence model to obtain the target luminescence model includes: Based on the stretching and offset information of each vertex in the initial luminescence model, stretching and offsetting are performed on each vertex of the initial luminescence model to obtain the intermediate luminescence model; The vertices of the intermediate luminescence model are shifted hierarchically toward one side of the virtual camera to obtain the target luminescence model, so that the luminescence rendering color information corresponding to the target luminescence model can cover the basic rendering color information corresponding to the object to be rendered.

8. A light-emitting rendering device, characterized in that, The device includes: The data acquisition unit is used to acquire the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model of the object to be rendered in the two-dimensional texture coordinate system. The offset information unit is used to obtain the stretch offset information of each vertex in the initial luminescence model based on the pixel information corresponding to the target texture coordinates of each vertex in the two-dimensional texture coordinate system and the target luminescence area of ​​the object to be rendered. The vertex offset unit is used to stretch and offset each vertex in the initial luminescence model according to the stretching offset information of each vertex in the initial luminescence model to obtain the target luminescence model; A pixel shading unit is used to perform pixel shading on the target luminous model according to the pixel information corresponding to the target texture coordinates of each vertex in the initial luminous model in the two-dimensional texture coordinate system, so as to render the luminous effect of the object to be rendered. The offset information unit includes: A reference coordinate unit is used to determine the reference texture coordinates in the two-dimensional texture coordinate system based on the pixel information corresponding to the target texture coordinates of each vertex in the initial glow model in the two-dimensional texture coordinate system; the reference texture coordinates include the texture coordinates of at least one vertex in the initial glow model responsible for the highlighted part of the glow effect in the two-dimensional texture coordinate system. The direction determination unit is used to determine the stretching offset direction of each vertex in the initial luminescence model based on the relative position of each vertex in the initial luminescence model in the target texture coordinate system and the reference texture coordinate system. Offset distance unit, used to determine the stretch offset distance of each vertex in the initial luminescence model based on the stretch offset direction of each vertex in the initial luminescence model and the target luminescence area of ​​the object to be rendered; The information integration unit is used to obtain the stretching offset information of each vertex in the initial light emission model based on the stretching offset direction and stretching offset distance of each vertex in the initial light emission model.

9. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to execute the luminescence rendering method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to execute the luminescence rendering method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Dynamic light special effect display method and device, computer equipment and storage medium

    CN115131493A

  • Image transformation method and device, electronic equipment, storage medium and program product

    CN115564642A