Method, apparatus and electronic device for rendering streamer effect
By directly determining the intensity information of the flowing light using metallicity and roughness maps, the creation of masking information is avoided, solving the problems of high cost and low efficiency in rendering flowing light effects and achieving high-efficiency rendering.
Patent Information
- Application Number
- CN202210344843.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-03-31
AI Technical Summary
In existing technologies, rendering light flow effects requires the pre-production of mask information, which leads to high production costs, large storage space requirements, and low rendering efficiency.
By acquiring the metallic texture and/or roughness texture of the target model, a transformation function is established using the texture information and preset adjustment parameters to directly determine the light flow intensity information, avoiding the creation of masking information, and directly rendering the light flow effect based on the specified material texture.
It reduces the production cost of the flowing light effect, decreases storage space requirements and rendering power consumption, and improves rendering efficiency.
Smart Images

Figure CN114842126B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of special effect rendering, in particular to a rendering method and device of light stream effect and electronic equipment. BACKGROUND
[0002] The light stream effect is a common special effect in game and video rendering. In related technologies, mask information and color information of the light stream effect are needed to be prepared in advance. The mask information is used to control the shape and intensity of the light stream effect appearing area, and the color information is used to control the color and brightness of the light stream effect. The mask information and the color information are combined, and the combination result is superimposed on the basic color information of the model, so that the model with the light stream effect is rendered. In this way, the mask information needs to be prepared in advance. If the material of the model is complex, the mask information will also be complex, and the production cost will be high. In the process of rendering the light stream effect, a large storage space needs to be reserved to store the mask information, and a large power consumption is needed to load and read the mask information, which leads to low rendering efficiency of the light stream effect.
[0003] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0004] Therefore, the purpose of the present application is to provide a rendering method, device and electronic equipment of light stream effect to improve the rendering efficiency of the light stream effect.
[0005] In a first aspect, the present application provides a rendering method of light stream effect. The method comprises: obtaining a specified material map of a target model; wherein the specified material map comprises a metal degree map and / or a roughness map; extracting map information of a pixel to be rendered on the target model from the specified material map; determining light stream intensity information of the pixel to be rendered based on the map information and a preset map information adjustment parameter; and rendering the light stream effect of the pixel to be rendered on the target model based on the light stream intensity information and preset light stream color information.
[0006] The step of determining the light stream intensity information of the pixel to be rendered based on the map information and the preset map information adjustment parameter comprises: establishing a transformation function based on the map information adjustment parameter; calculating a calculation result by taking the map information as an input parameter of the transformation function; and determining the light stream intensity information of the pixel to be rendered based on the calculation result.
[0007] The texture information adjustment parameters mentioned above include reference point parameters and rate of change parameters; the steps for establishing a transformation function based on texture information adjustment parameters include: determining the coordinate points through which the function line corresponding to the transformation function to be established passes based on the reference point parameters; determining the slope of the transformation function to be established based on the rate of change parameters; and obtaining the transformation function through the coordinate points through which the function line passes and the slope.
[0008] The steps for determining the stream light intensity information of the pixel to be rendered based on the calculation results include: if the calculation result is greater than a preset first threshold, setting a first specified value as the stream light intensity information of the pixel to be rendered; if the calculation result is less than a preset second threshold, setting a second specified value as the stream light intensity information of the pixel to be rendered; if the calculation result is between the first threshold and the second threshold, setting the calculation result as the stream light intensity information of the pixel to be rendered.
[0009] The aforementioned specified material texture includes a metallic texture and a roughness texture; the steps for rendering the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and the preset flowing light color information include: obtaining the first flowing light intensity information corresponding to the metallic texture and the second flowing light intensity information corresponding to the roughness texture; determining the final flowing light intensity information based on the first flowing light intensity information and the second flowing light intensity information; and rendering the flowing light effect of the pixels to be rendered on the target model based on the final flowing light intensity information and the preset flowing light color information.
[0010] The steps for determining the final stream light intensity information based on the first stream light intensity information and the second stream light intensity information include: obtaining a first information adjustment parameter corresponding to the first stream light intensity information and a second information adjustment parameter corresponding to the second stream light intensity information; adjusting the first stream light intensity information based on the first information adjustment parameter to obtain a first intermediate result; adjusting the second stream light intensity information based on the second information adjustment parameter to obtain a second intermediate result; and determining the final stream light intensity information based on the first intermediate result and the second intermediate result.
[0011] The steps described above for rendering the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and the preset flowing light color information include: obtaining flowing light rendering information based on the flowing light intensity information and the preset flowing light color information; and superimposing the flowing light rendering information onto the basic rendering information of the pixels to be rendered on the target model to obtain a rendering result of the pixels to be rendered with a flowing light effect.
[0012] Secondly, embodiments of the present invention provide a rendering apparatus for a flowing light effect. The apparatus includes: a texture acquisition module for acquiring a specified material texture of a target model; wherein the specified material texture includes a metallic texture and / or a roughness texture; an information extraction module for extracting texture information of pixels to be rendered on the target model from the specified material texture; an information determination module for determining the flowing light intensity information of the pixels to be rendered based on the texture information and preset texture information adjustment parameters; and a rendering module for rendering the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and preset flowing light color information.
[0013] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to realize the above-mentioned rendering method for the flowing light effect.
[0014] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement a rendering method for a flowing light effect.
[0015] The embodiments of the present invention bring the following beneficial effects:
[0016] The aforementioned method, apparatus, and electronic device for rendering flowing light effects obtain a specified material texture map of the target model; wherein the specified material texture map includes a metallic texture map and / or a roughness texture map; extract texture information of the pixels to be rendered on the target model from the specified material texture map; determine the flowing light intensity information of the pixels to be rendered based on the texture information and preset texture information adjustment parameters; and render the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and preset flowing light color information. In this method, there is no need to create masking information for rendering the flowing light effect. The flowing light intensity information can be obtained through the specified material texture map of the target model, and then the flowing light effect is rendered based on the flowing light intensity information, which reduces the production cost of the flowing light effect. At the same time, during the rendering process, since the specified material texture map is also used for the regular rendering of the model, there is no need to reserve texture storage space for flowing light rendering, nor is there an additional power consumption to read texture information for the rendering of the flowing light effect, thus improving the rendering efficiency of the flowing light effect.
[0017] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0018] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0019] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating a method for rendering a flowing light effect according to an embodiment of the present invention;
[0021] Figure 2 A schematic diagram of a transformation function provided in an embodiment of the present invention;
[0022] Figure 3 Provided for embodiments of the present invention Figure 2 A schematic diagram illustrating the transformation effect of the transformation function shown;
[0023] Figure 4 A schematic diagram of another transformation function provided in an embodiment of the present invention;
[0024] Figure 5 Provided for embodiments of the present invention Figure 4 A schematic diagram illustrating the transformation effect of the transformation function shown;
[0025] Figure 6 A schematic diagram of the third transformation function provided in an embodiment of the present invention;
[0026] Figure 7 Provided for embodiments of the present invention Figure 6 A schematic diagram illustrating the transformation effect of the transformation function shown;
[0027] Figure 8 A schematic diagram of the structure of a rendering device for a flowing light effect provided in an embodiment of the present invention;
[0028] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0030] In related technologies, to control the area where the flowing light effect appears and the intensity of the flowing light effect in each area, a mask map needs to be created to store the masking information of the flowing light effect. During the rendering process, after sampling the masking information of this mask map, the flowing light intensity of different areas is multiplied by the previously calculated flowing light information to control the specific area where the flowing light appears and the intensity of the flowing light effect in each area.
[0031] The above method has the following drawbacks: An additional texture needs to be created to record the light intensity in different areas. When the model's material is complex, the mask texture will also be very complex, increasing the cost of art production and making it labor-intensive and time-consuming. During rendering, in order to obtain the light intensity information recorded in the mask texture, an additional loading and reading process is required, increasing rendering power consumption. For game development, the game project needs to store this mask texture, increasing the project's capacity. Moreover, the more complex the shape of the mask texture, the higher the required data precision, which necessitates a higher texture resolution and a larger data footprint.
[0032] Based on the above, the embodiments of the present invention provide a rendering method, apparatus and electronic device for a flowing light effect, which can be applied to rendering scenes of flowing light effects in games, animation and film.
[0033] To facilitate understanding of this embodiment, a method for rendering a flowing light effect disclosed in this invention will first be described in detail, such as... Figure 1 As shown, the method includes the following steps:
[0034] Step S102: Obtain the specified material texture of the target model; wherein, the specified material texture includes a metallic texture and / or a roughness texture.
[0035] In PBR (Physically-Based Rendering), when rendering the material of the target model's surface, it is necessary to read the metallic map and roughness map of the target model. For each pixel on the model's surface, metallic information is read from the metallic map and roughness information is read from the roughness map, and then the material is rendered for that pixel.
[0036] In this embodiment, the aforementioned mask texture is no longer set for rendering the flowing light effect. During the research process, the inventors discovered that the appearance area and intensity of the flowing light effect on the target model are directly related to the metallicity and roughness information of the area. Therefore, in this embodiment, the flowing light intensity information of each pixel in the target model is determined by a specified material texture of the target model. Specifically, depending on the specific requirements of the flowing light effect, the specified material texture may include only a metallicity texture, only a roughness texture, or both.
[0037] In PBR rendering, metallicity is a parameter used during the rendering process. Metallicity describes how many photons, upon reaching an object's surface, are almost directly reflected, while others enter the object and are reflected from other locations on its surface. A metallicity of 0 indicates only diffuse reflection, where all photons enter the object and are then reflected. A metallicity of 1 indicates only specular reflection, where all photons are directly reflected from the object's surface. The metallicity map stores the metallicity of each pixel in the target model.
[0038] Roughness is also a parameter in the PBR rendering process. Roughness describes the degree of roughness of the target model's surface. Generally, the smaller the roughness, the smoother the model surface; the larger the roughness, the rougher the model surface. The roughness map stores the roughness of each pixel position in the target model.
[0039] Step S104: Extract the texture information of the pixels to be rendered on the target model from the specified material texture map;
[0040] During the rendering process of a target model, it is usually necessary to render each pixel on the target model one by one. For example, when rendering pixel A, pixel A is the pixel to be rendered. Based on the position of the pixel to be rendered on the target model, the texture information of the pixel to be rendered is extracted from a specified material map. In actual implementation, this is usually done based on the UV coordinates of the pixel to obtain the texture information corresponding to the UV coordinates of the pixel in the specified material map. The process of extracting texture information can also be understood as the process of sampling the specified material map.
[0041] In the pixel shader of PBR rendering, the UV coordinates of the pixel to be rendered and the specified material map are obtained. The sampling function Sample is used to obtain the texture information corresponding to the UV coordinates in the specified material map. For example, sampling the metallic map will give the metallic information corresponding to the UV coordinates, and sampling the roughness map will give the roughness information corresponding to the UV coordinates.
[0042] It should be noted that metallicity maps and roughness maps are essential textures that must be read during the rendering process of the target model. That is, even when rendering a target model without a flowing light effect, metallicity maps and roughness maps must still be read. For a given pixel, after reading the metallicity from the metallicity map and the roughness from the roughness map, the metallicity and roughness are input into the relevant rendering algorithm to render the material and color of that pixel. In this embodiment, metallicity maps and roughness maps participate not only in the regular rendering of the target model but also in the rendering of the flowing light effect.
[0043] Step S106: Based on the above texture information and the preset texture information adjustment parameters, determine the light flow intensity information of the pixel to be rendered;
[0044] In this embodiment, the light flow intensity information of the pixel to be rendered needs to be determined based on the texture information extracted from the specified material texture. Texture information adjustment parameters can adjust the overall light flow effect. For example, increasing contrast can make the light flow intensity information of two pixels larger after adjusting the texture information parameters when the difference in texture information values between the two pixels is small. Conversely, reversing contrast can make the light flow intensity information of a pixel larger after adjusting the texture information parameters when the texture information value of a pixel is small, and vice versa.
[0045] The texture information adjustment parameters mentioned above can be preset. For example, art staff can set these parameters to control the overall flow effect. The texture information adjustment parameters and texture information are used together in the calculation to obtain the flow intensity information. Specifically, a formula can be preset, with the texture information adjustment parameters as parameters in the formula. After inputting the texture information into the formula, the flow intensity information will be output.
[0046] Step S108: Based on the light intensity information and the preset light color information, render the light effect of the pixels to be rendered on the target model.
[0047] The light intensity information can control whether there is a light effect on the pixel to be rendered, as well as the intensity of the light effect. The light color information can control the color and brightness of the light of the pixel to be rendered. By combining the light intensity information and the light color information, the light effect of the pixel to be rendered can be obtained.
[0048] In one implementation, flowing light rendering information is obtained based on flowing light intensity information and preset flowing light color information. This flowing light rendering information is then superimposed on the base rendering information of the pixels to be rendered on the target model to obtain a rendering result with a flowing light effect for the pixels to be rendered. Specifically, the flowing light intensity information and the flowing light color information can be multiplied to obtain the flowing light rendering information. The base rendering information of the pixels to be rendered, i.e., the rendering information when the pixels do not have a flowing light effect, includes color information, material information, etc. The flowing light rendering information is superimposed on the base rendering information to obtain a rendering result with a flowing light effect for the pixels to be rendered.
[0049] For each pixel on the target model, the flowing light effect of that pixel can be obtained through the above method. After all pixels are rendered, the target model with the flowing light effect can be obtained.
[0050] The above-described method for rendering the flowing light effect involves obtaining a specified material texture map of the target model, where the specified material texture map includes a metallic texture map and / or a roughness texture map; extracting texture information of the pixels to be rendered on the target model from the specified material texture map; adjusting parameters based on the texture information and preset texture information to determine the flowing light intensity information of the pixels to be rendered; and rendering the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and preset flowing light color information. This method eliminates the need to create masking information for rendering the flowing light effect, as the flowing light intensity information can be obtained directly from the specified material texture map of the target model. This reduces the production cost of the flowing light effect. Furthermore, since the specified material texture map is also used for regular model rendering, there is no need to reserve texture storage space for flowing light rendering, nor is there an additional power consumption required to read texture information for the flowing light effect rendering, thus improving the rendering efficiency of the flowing light effect.
[0051] The following embodiments describe in detail the specific implementation method for determining the stream intensity information of the pixel to be rendered. Specifically, a transformation function is established by adjusting parameters based on texture information; the texture information is used as the input parameter of the transformation function for calculation to obtain the calculation result; and the stream intensity information of the pixel to be rendered is determined based on the calculation result.
[0052] The transformation function mentioned above can be a linear function, a quadratic function, etc., and the constant parameters in the transformation function are determined based on the texture information adjustment parameters. The higher the degree of the transformation function, the larger the number of texture information adjustment parameters required. This transformation function allows for linear adjustment of the texture information, ensuring a linear relationship between the texture information and the output stream intensity information.
[0053] In one specific implementation, the texture information adjustment parameters include a reference point parameter and a rate of change parameter. Based on the reference point parameter, the coordinate points along the function line corresponding to the transformation function to be established are determined. Based on the rate of change parameter, the slope of the transformation function to be established is determined. The transformation function is obtained through the coordinate points along the function line and the slope. In this method, the transformation function is a linear function, and the corresponding function line is a straight line. Determining a linear function requires only two constant parameters: one constant determines the position of the function line, and the other constant determines the slope of the function line. Therefore, the reference point parameter in the texture adjustment parameters is used to determine the coordinate points along the function line corresponding to the transformation function. Specifically, this reference point parameter can be the intersection of the function line with the X-axis or the intersection of the function line with the Y-axis in the coordinate system. The rate of change parameter is used to determine the slope of the transformation function. When the rate of change parameter is positive, the texture information is proportional to the output stream intensity information, and the larger the rate of change parameter, the greater the contrast of the stream intensity information. When the rate of change parameter is negative, the texture information is inversely proportional to the output light intensity information, and the larger the absolute value of the rate of change parameter, the greater the contrast of the light intensity information.
[0054] In the rendering scene, the transformation function can be implemented using the `lerp` function. The `lerp` function takes three input values: the reference point parameter, texture information, and the rate of change parameter. The function definition of `lerp` is: `lerp(reference point parameter, texture information, rate of change parameter) = reference point parameter + (texture information - reference point parameter) * rate of change parameter`. In the `lerp` function, the reference point parameter and the rate of change parameter are used to adjust the contrast of the stream light intensity information between different pixels. When the texture information and the reference point parameter are the same, the stream light intensity information output by the `lerp` function is the reference point information.
[0055] As an example, when the reference point parameter is 0 and the rate of change parameter is 1, the function line of the transformation function is as follows: Figure 2 As shown, Figure 3 yes Figure 2 The example shown is a transformation effect of the transformation function. Visually, the light intensity information does not change with the input texture information. It is more suitable for situations where the texture information and the light intensity required for the light effect are the same or similar.
[0056] As another example, when the baseline parameter is 0.4 and the rate of change parameter is 2, the function line of the transformation function is as follows: Figure 4 As shown, the transformation function amplifies the differences between the texture information of different pixels, increases the contrast of the light flow intensity, and the light flow intensity is greater where the texture information value is larger and less where the texture information value is smaller. Figure 5 yes Figure 4The example shown illustrates the transformation effect of the transformation function. Visually, brighter areas in the texture information become even brighter in the flowing light intensity information; darker areas in the texture information show little change in the flowing light intensity information. This can also be understood as the transformation function extracting the mask information for the flowing light effect from areas with larger texture values.
[0057] As a third example, when the baseline parameter is 0.4 and the rate of change parameter is -2, the function line of the transformation function is as follows: Figure 6 As shown, the contrast of the light flow intensity was reversed; where the texture information value was larger, the light flow intensity was smaller, and where the texture information value was smaller, the light flow intensity was larger. Figure 7 yes Figure 6 The example shown illustrates the transformation effect of the transformation function. Visually, darker areas in the texture information appear brighter in the flow light intensity information, while brighter areas in the texture information appear darker in the flow light intensity information. This can also be understood as the transformation function extracting the mask information for the flow light effect from areas with smaller texture values.
[0058] In addition, to avoid the output light flow intensity information being too large or too small, thus affecting the final rendered light flow effect, in this embodiment, if the calculation result is greater than a preset first threshold, the first specified value is set as the light flow intensity information of the pixel to be rendered; if the calculation result is less than a preset second threshold, the second specified value is set as the light flow intensity information of the pixel to be rendered; if the calculation result is between the first threshold and the second threshold, the calculation result is set as the light flow intensity information of the pixel to be rendered.
[0059] The first threshold, the first specified value, the second threshold, and the second specified value can all be set according to the requirements of the flowing light effect. As an example, if the first threshold is 1 and the first specified value is 1, then if the calculation result is greater than 1, the calculation result is set to 1; if the second threshold is 0 and the second specified value is 0, then if the calculation result is less than 0, the calculation result is set to 0.
[0060] In practical implementation, a saturation function can be set to limit the calculation results to the threshold range between the first and second thresholds, thereby limiting the final output stream intensity information to the threshold range.
[0061] When the specified material map only includes a metallic map, the texture information extracted from the metallic map is the metallic information. Based on the adjustment parameters corresponding to the metallic information, a transformation function is established, and then the metallic information is input into this transformation function to obtain the streamer intensity information. In this case, the streamer intensity information is determined only based on the metallic map, which is suitable when the metallic map closely matches the transformation requirements of streamer intensity, and there is no need to use a roughness map.
[0062] When the specified material map only includes a roughness map, the texture information extracted from the roughness map is the roughness information. Based on the adjustment parameters corresponding to the roughness information, a transformation function is established, and then the roughness information is input into this transformation function to obtain the streamer intensity information. In this case, the streamer intensity information is determined solely based on the roughness map, which is suitable when the roughness map closely matches the transformation requirements of the streamer intensity, and there is no need to use a metallic map.
[0063] However, when neither the metallicity map nor the roughness map can individually meet the requirements for streamer intensity transformation, it is necessary to refer to both the metallicity map and the roughness map simultaneously to obtain streamer intensity information. In this case, the metallicity map and the roughness map need to be processed separately using the methods described in the above embodiments to obtain the first streamer intensity information corresponding to the metallicity map and the second streamer intensity information corresponding to the roughness map. It should be noted that the adjustment parameters, transformation function, and the aforementioned first threshold, first specified value, second threshold, and second specified value for the texture information corresponding to the metallicity map can be the same as or different from the relevant values corresponding to the roughness map. That is, the calculation process for the first streamer intensity information and the calculation process for the second streamer intensity information can be the same or different.
[0064] Based on the above, in one specific implementation, the specified material texture includes a metallic texture and a roughness texture; first flowing light intensity information corresponding to the metallic texture and second flowing light intensity information corresponding to the roughness texture are obtained; based on the first and second flowing light intensity information, the final flowing light intensity information is determined; based on the final flowing light intensity information and preset flowing light color information, the flowing light effect of the pixel to be rendered on the target model is rendered. In this method, the final flowing light intensity information is obtained by referring to the first flowing light intensity information corresponding to the metallic texture and the second flowing light intensity information corresponding to the roughness texture. The metallicity and roughness of the pixel simultaneously affect the flowing light intensity information of that pixel, making the adjustment of the flowing light intensity more flexible and versatile, and meeting diverse flowing light effect requirements.
[0065] Furthermore, the aforementioned first and second stream light intensity information can each be configured with information adjustment parameters. Specifically, the first information adjustment parameter corresponding to the first stream light intensity information and the second information adjustment parameter corresponding to the second stream light intensity information are obtained; the first stream light intensity information is adjusted based on the first information adjustment parameter to obtain a first intermediate result; the second stream light intensity information is adjusted based on the second information adjustment parameter to obtain a second intermediate result; and the final stream light intensity information is determined based on the first and second intermediate results. Here, the first information adjustment parameter can be understood as the weight of the first stream light intensity information, and the second information adjustment parameter can be understood as the weight of the second stream light intensity information. When the value of the first information adjustment parameter is large, the first stream light intensity information has a greater impact on the final stream light intensity information, that is, the pixel's metallicity information has a greater impact on the stream light intensity; when the value of the second information adjustment parameter is large, the second stream light intensity information has a greater impact on the final stream light intensity information, that is, the pixel's roughness information has a greater impact on the stream light intensity.
[0066] As an example, the final stream intensity information mentioned above can be calculated using the following formula:
[0067] LightflowMask = MaskRough * MaskRoughAmount + MaskMetal * MaskMetalAmount; where LightflowMask is the final stream intensity information, MaskRough is the second stream intensity information, MaskRoughAmount is the second information adjustment parameter; MaskMetal is the first stream intensity information, and MaskMetalAmount is the first information adjustment parameter.
[0068] The sum of the first information adjustment parameter and the second information adjustment parameter can be a fixed value, for example, the sum of the first information adjustment parameter and the second information adjustment parameter is equal to 1; the values of the first information adjustment parameter and the second information adjustment parameter can also be independent of each other, and both parameters can be set to arbitrary values.
[0069] The above method utilizes metallicity and roughness information to approximate the region range information of the flowing light, which can reduce the mask texture creation process, lower the power consumption of flowing light rendering, and reduce unnecessary texture file size usage. Furthermore, artists can flexibly control the parameters adjusting the flowing light range, making the flowing light results more in line with artistic requirements.
[0070] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 8 The diagram shows a structural schematic of a rendering device for a flowing light effect, the device comprising:
[0071] The texture acquisition module 80 is used to acquire a specified material texture of the target model; wherein, the specified material texture includes a metallic texture and / or a roughness texture.
[0072] The information extraction module 82 is used to extract the texture information of the pixels to be rendered on the target model from the specified material texture map;
[0073] The information determination module 84 is used to determine the light intensity information of the pixel to be rendered based on the texture information and preset texture information adjustment parameters.
[0074] The rendering module 86 is used to render the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and the preset flowing light color information.
[0075] The aforementioned rendering apparatus for the flowing light effect acquires a specified material texture map of the target model; wherein the specified material texture map includes a metallic texture map and / or a roughness texture map; extracts texture information of the pixels to be rendered on the target model from the specified material texture map; determines the flowing light intensity information of the pixels to be rendered based on the texture information and preset texture information adjustment parameters; and renders the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and preset flowing light color information. In this method, there is no need to create masking information for the rendering of the flowing light effect. The flowing light intensity information can be obtained through the specified material texture map of the target model, and then the flowing light effect is rendered based on the flowing light intensity information, which reduces the production cost of the flowing light effect. At the same time, during the rendering process, since the specified material texture map is also used for the regular rendering of the model, there is no need to reserve texture storage space for the flowing light rendering, nor is there an additional power consumption to read texture information for the rendering of the flowing light effect, thus improving the rendering efficiency of the flowing light effect.
[0076] The aforementioned information determination module is also used for: adjusting parameters based on texture information to establish a transformation function; using texture information as input parameters of the transformation function to perform calculations and obtain calculation results; and determining the stream intensity information of the pixel to be rendered based on the calculation results.
[0077] The above-mentioned texture information adjustment parameters include reference point parameters and rate of change parameters; the above-mentioned information determination module is also used to: determine the coordinate points through which the function line corresponding to the transformation function to be established passes based on the reference point parameters; determine the slope of the transformation function to be established based on the rate of change parameters; and obtain the transformation function through the coordinate points through which the function line passes and the slope.
[0078] The aforementioned information determination module is further configured to: if the calculation result is greater than a preset first threshold, set the first specified value as the stream light intensity information of the pixel to be rendered; if the calculation result is less than a preset second threshold, set the second specified value as the stream light intensity information of the pixel to be rendered; if the calculation result is between the first threshold and the second threshold, set the calculation result as the stream light intensity information of the pixel to be rendered.
[0079] The specified material textures include metallic textures and roughness textures; the rendering module is further configured to: obtain first stream light intensity information corresponding to the metallic texture and second stream light intensity information corresponding to the roughness texture; determine the final stream light intensity information based on the first stream light intensity information and the second stream light intensity information; and render the stream light effect of the pixels to be rendered on the target model based on the final stream light intensity information and the preset stream light color information.
[0080] The rendering module described above is further configured to: obtain a first information adjustment parameter corresponding to the first stream light intensity information, and a second information adjustment parameter corresponding to the second stream light intensity information; adjust the first stream light intensity information based on the first information adjustment parameter to obtain a first intermediate result; adjust the second stream light intensity information based on the second information adjustment parameter to obtain a second intermediate result; and determine the final stream light intensity information based on the first intermediate result and the second intermediate result.
[0081] The above-mentioned rendering module is also used to: obtain flowing light rendering information based on flowing light intensity information and preset flowing light color information; and superimpose the flowing light rendering information onto the basic rendering information of the pixels to be rendered on the target model to obtain a rendering result of the pixels to be rendered with flowing light effect.
[0082] The rendering method and apparatus for the flowing light effect provided in this embodiment address the issue that, in a PBR rendering scene, material rendering inevitably requires the use of two texture information maps: roughness map and metallicity map. The area where the flowing light effect appears often has a direct correspondence with these two texture maps. Therefore, before the flowing light rendering calculation, these two texture maps can be directly subjected to linear transformations such as contrast adjustment. Then, these two texture maps can be superimposed with different weights as needed to obtain the flowing light range information that meets the artistic requirements. Finally, the above results can be substituted into the flowing light rendering calculation.
[0083] In the above method, for PBR rendering, the use of a streamer mask texture is eliminated. A simple algorithm is used to approximate the intensity information of the streamer at various locations, which is then applied to the streamer rendering algorithm. This eliminates the cost of creating a streamer mask texture and reduces the use and loading of textures during the rendering process, thereby improving the rendering efficiency of the streamer effect.
[0084] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described rendering method for the flowing light effect. This electronic device can be a server or a terminal device.
[0085] See Figure 9As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-mentioned rendering method for the flowing light effect.
[0086] Furthermore, Figure 9 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0087] The memory 101 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0088] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0089] The processor in the aforementioned electronic device, by executing machine-executable instructions, can perform the following operations in the rendering method for the aforementioned light-flowing effect: obtaining a specified material texture map of the target model; wherein, the specified material texture map includes a metallic texture map and / or a roughness texture map; extracting texture information of the pixels to be rendered on the target model from the specified material texture map; determining the light-flowing intensity information of the pixels to be rendered based on the texture information and preset texture information adjustment parameters; and rendering the light-flowing effect of the pixels to be rendered on the target model based on the light-flowing intensity information and preset light-flowing color information.
[0090] In the above method, there is no need to create masking information for rendering the flowing light effect. The flowing light intensity information can be obtained through the specified material texture of the target model, and then the flowing light effect is rendered based on the flowing light intensity information, which reduces the production cost of the flowing light effect. At the same time, during the rendering process, since the specified material texture is also used for the regular rendering of the model, there is no need to reserve texture storage space for flowing light rendering, nor is there any need to consume extra power to read texture information for the rendering of the flowing light effect, thus improving the rendering efficiency of the flowing light effect.
[0091] Furthermore, the processor in the aforementioned electronic device can also perform the following operations in the above-mentioned light-flow effect rendering method by executing machine-executable instructions: adjusting parameters based on texture information to establish a transformation function; using texture information as input parameters of the transformation function for calculation to obtain the calculation result; and determining the light-flow intensity information of the pixel to be rendered based on the calculation result.
[0092] Furthermore, the processor in the aforementioned electronic device, by executing machine-executable instructions, can also perform the following operations in the rendering method of the aforementioned light-flowing effect: determining the coordinate points through which the function line corresponding to the transformation function to be established passes based on the reference point parameter; determining the slope of the transformation function to be established based on the rate of change parameter; and obtaining the transformation function through the coordinate points through which the function line passes and the slope.
[0093] Furthermore, the processor in the aforementioned electronic device can also implement the following operations in the rendering method of the above-mentioned light flow effect by executing machine-executable instructions: if the calculation result is greater than a preset first threshold, the first specified value is set as the light flow intensity information of the pixel to be rendered; if the calculation result is less than a preset second threshold, the second specified value is set as the light flow intensity information of the pixel to be rendered; if the calculation result is between the first threshold and the second threshold, the calculation result is set as the light flow intensity information of the pixel to be rendered.
[0094] Furthermore, the processor in the aforementioned electronic device, by executing machine-executable instructions, can also implement the following operations in the rendering method for the aforementioned light-flowing effect: the specified material texture map includes a metallic texture map and a roughness texture map; obtain the first light-flowing intensity information corresponding to the metallic texture map and the second light-flowing intensity information corresponding to the roughness texture map; determine the final light-flowing intensity information based on the first light-flowing intensity information and the second light-flowing intensity information; and render the light-flowing effect of the pixels to be rendered on the target model based on the final light-flowing intensity information and the preset light-flowing color information.
[0095] The above method of determining the intensity of the streamer light by combining metallicity and roughness makes the adjustment of the streamer light intensity more flexible and versatile, meeting diverse needs for streamer light effects.
[0096] Furthermore, the processor in the aforementioned electronic device can also perform the following operations in the rendering method for the above-mentioned flowing light effect by executing machine-executable instructions: obtaining a first information adjustment parameter corresponding to the first flowing light intensity information and a second information adjustment parameter corresponding to the second flowing light intensity information; adjusting the first flowing light intensity information based on the first information adjustment parameter to obtain a first intermediate result; adjusting the second flowing light intensity information based on the second information adjustment parameter to obtain a second intermediate result; and determining the final flowing light intensity information based on the first intermediate result and the second intermediate result.
[0097] In the above method, the information of each streamer intensity is adjusted by parameters, making the adjustment of streamer intensity more flexible.
[0098] Furthermore, the processor in the aforementioned electronic device can also perform the following operations in the above-mentioned light-flow effect rendering method by executing machine-executable instructions: obtaining light-flow rendering information based on light-flow intensity information and preset light-flow color information; superimposing the light-flow rendering information onto the basic rendering information of the pixel to be rendered on the target model to obtain a rendering result of the pixel to be rendered with a light-flow effect.
[0099] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-mentioned rendering method for the flowing light effect.
[0100] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the above-mentioned method for rendering the flowing light effect: obtaining a specified material texture map of the target model; wherein the specified material texture map includes a metallic texture map and / or a roughness texture map; extracting texture information of the pixels to be rendered on the target model from the specified material texture map; determining the flowing light intensity information of the pixels to be rendered based on the texture information and preset texture information adjustment parameters; and rendering the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and preset flowing light color information.
[0101] In the above method, there is no need to create masking information for rendering the flowing light effect. The flowing light intensity information can be obtained through the specified material texture of the target model, and then the flowing light effect is rendered based on the flowing light intensity information, which reduces the production cost of the flowing light effect. At the same time, during the rendering process, since the specified material texture is also used for the regular rendering of the model, there is no need to reserve texture storage space for flowing light rendering, nor is there any need to consume extra power to read texture information for the rendering of the flowing light effect, thus improving the rendering efficiency of the flowing light effect.
[0102] Furthermore, the machine-executable instructions stored in the aforementioned machine-readable storage medium can be used to execute the following operations in the above-mentioned method for rendering the flowing light effect: adjusting parameters based on texture information to establish a transformation function; using the texture information as input parameters of the transformation function for calculation to obtain the calculation result; and determining the flowing light intensity information of the pixel to be rendered based on the calculation result.
[0103] Furthermore, the machine-executable instructions stored in the aforementioned machine-readable storage medium can be used to execute the following operations in the above-mentioned light-flow effect rendering method: determining the coordinate points through which the function line corresponding to the transformation function to be established passes based on the reference point parameters; determining the slope of the transformation function to be established based on the rate of change parameters; and obtaining the transformation function through the coordinate points through which the function line passes and the slope.
[0104] Furthermore, the machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above-mentioned rendering method for the flowing light effect: if the calculation result is greater than a preset first threshold, a first specified value is set as the flowing light intensity information of the pixel to be rendered; if the calculation result is less than a preset second threshold, a second specified value is set as the flowing light intensity information of the pixel to be rendered; if the calculation result is between the first threshold and the second threshold, the calculation result is set as the flowing light intensity information of the pixel to be rendered.
[0105] Furthermore, the machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above-mentioned method for rendering the flowing light effect: the specified material texture map includes a metallic texture map and a roughness texture map; first flowing light intensity information corresponding to the metallic texture map and second flowing light intensity information corresponding to the roughness texture map are obtained; based on the first flowing light intensity information and the second flowing light intensity information, the final flowing light intensity information is determined; based on the final flowing light intensity information and the preset flowing light color information, the flowing light effect of the pixels to be rendered on the target model is rendered.
[0106] The above method of determining the intensity of the streamer light by combining metallicity and roughness makes the adjustment of the streamer light intensity more flexible and versatile, meeting diverse needs for streamer light effects.
[0107] Furthermore, the machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the above-mentioned method for rendering the flowing light effect: obtaining a first information adjustment parameter corresponding to the first flowing light intensity information and a second information adjustment parameter corresponding to the second flowing light intensity information; adjusting the first flowing light intensity information based on the first information adjustment parameter to obtain a first intermediate result; adjusting the second flowing light intensity information based on the second information adjustment parameter to obtain a second intermediate result; and determining the final flowing light intensity information based on the first intermediate result and the second intermediate result.
[0108] In the above method, the information of each streamer intensity is adjusted by parameters, making the adjustment of streamer intensity more flexible.
[0109] Furthermore, the machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above-mentioned light-flow effect rendering method: obtaining light-flow rendering information based on light-flow intensity information and preset light-flow color information; superimposing the light-flow rendering information onto the basic rendering information of the pixel to be rendered on the target model to obtain a rendering result of the pixel to be rendered with a light-flow effect.
[0110] The computer program product of the rendering method, apparatus, electronic device and storage medium for the light-flowing effect provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0111] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0112] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0113] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0114] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0115] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for rendering a flowing light effect, characterized in that, The method includes: Obtain a specified material texture map of the target model; wherein, the specified material texture map includes a metallic texture map and / or a roughness texture map; Extract the texture information of the pixels to be rendered on the target model from the specified material texture map; Based on the texture information and the preset texture information adjustment parameters, the light intensity information of the pixel to be rendered is determined; Based on the light intensity information and the preset light color information, the light effect of the pixel to be rendered on the target model is rendered; wherein, the light color information is used to control the color or brightness of the light of the pixel to be rendered.
2. The method according to claim 1, characterized in that, The step of determining the stream intensity information of the pixel to be rendered based on the texture information and preset texture information adjustment parameters includes: A transformation function is established by adjusting parameters based on the texture information; The texture information is used as the input parameter of the transformation function to calculate the result; the stream light intensity information of the pixel to be rendered is determined based on the calculation result.
3. The method according to claim 2, characterized in that, The texture information adjustment parameters include a reference point parameter and a rate of change parameter; the step of establishing a transformation function based on the texture information adjustment parameters includes: Based on the reference point parameters, determine the coordinate points through which the function line corresponding to the transformation function to be established passes; based on the rate of change parameters, determine the slope of the transformation function to be established; The transformation function is obtained by using the coordinate points through which the function line passes and the slope.
4. The method according to claim 2, characterized in that, The step of determining the stream intensity information of the pixel to be rendered based on the calculation result includes: If the calculation result is greater than a preset first threshold, the first specified value is set as the stream intensity information of the pixel to be rendered; If the calculation result is less than the preset second threshold, the second specified value is set as the stream intensity information of the pixel to be rendered; If the calculation result is between the first threshold and the second threshold, the calculation result is set as the stream intensity information of the pixel to be rendered.
5. The method according to claim 1, characterized in that, The specified material texture includes a metallic texture and a roughness texture; The step of rendering the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and the preset flowing light color information includes: Obtain the first stream intensity information corresponding to the metallic texture and the second stream intensity information corresponding to the roughness texture; Based on the first streamer intensity information and the second streamer intensity information, the final streamer intensity information is determined; Based on the final light intensity information and the preset light color information, the light effect of the pixels to be rendered on the target model is obtained.
6. The method according to claim 5, characterized in that, The step of determining the final streamer intensity information based on the first streamer intensity information and the second streamer intensity information includes: Obtain the first information adjustment parameter corresponding to the first stream light intensity information, and the second information adjustment parameter corresponding to the second stream light intensity information; Based on the first information, the parameters are adjusted to adjust the first stream light intensity information to obtain a first intermediate result; based on the second information, the parameters are adjusted to adjust the second stream light intensity information to obtain a second intermediate result. The final streamer intensity information is determined based on the first intermediate result and the second intermediate result.
7. The method according to claim 1, characterized in that, The step of rendering the flowing light effect of the pixels to be rendered on the target model based on the flowing light intensity information and the preset flowing light color information includes: Based on the light intensity information and the preset light color information, light rendering information is obtained; The flowing light rendering information is superimposed on the basic rendering information of the pixel to be rendered on the target model to obtain a rendering result with flowing light effect for the pixel to be rendered.
8. A rendering device for a flowing light effect, characterized in that, The device includes: The texture acquisition module is used to acquire a specified material texture of the target model; wherein, the specified material texture includes a metallic texture and / or a roughness texture; The information extraction module is used to extract the texture information of the pixels to be rendered on the target model from the specified material texture; The information determination module is used to determine the light intensity information of the pixel to be rendered based on the texture information and preset texture information adjustment parameters; The rendering module is used to render the flowing light effect of the pixel to be rendered on the target model based on the flowing light intensity information and the preset flowing light color information; wherein, the flowing light color information is used to control the color or brightness of the flowing light of the pixel to be rendered.
9. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the rendering method for the light-flowing effect according to any one of claims 1-7.
10. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the rendering method for the flowing light effect as described in any one of claims 1-7.
Citation Information
Patent Citations
PBR material map generation method and device
CN112562053A