Stylized rendering method, device, electronic device and storage medium for target object

By obtaining light source information and target object color, and combining diffuse and specular reflection models for stylized rendering, the problem of Unreal Engine's material being too realistic is solved, the stylized rendering effect is achieved and the production cost is reduced.

CN114419220BActive Publication Date: 2025-08-01NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111601156.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2025-08-01
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

Unreal Engine's PBR material is too realistic and cannot meet the needs of stylized art, and direct modification leads to high art production costs.

Method used

By obtaining the light source information and the surface color of the target object, combining the diffuse Fresnel factor, scattered light information and ambient light information to determine the diffuse light model, and combining the specular reflection model for stylized rendering, reducing the cost of art production.

Benefits of technology

It realizes a non-realistic rendering effect, meets the needs of stylized art, and reduces production costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114419220B_ABST
    Figure CN114419220B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, electronic device, and storage medium for stylized rendering of a target object. The method includes: obtaining light source information and the surface color of the target object; wherein the light source information includes: scattered light information, reflected light information, and ambient light information; determining a diffuse reflection lighting model according to the diffuse reflection Fresnel factor, the surface color of the target object, the scattered light information, and the ambient light information; determining a specular reflection model according to the reflected light information and the diffuse reflection lighting model; combining the diffuse reflection lighting model and the specular reflection model to determine a lighting model, and using the lighting model to perform stylized rendering on the target object. The present application modifies from the original principle of PBR, reduces the art production cost, and can quickly implement the non-photorealistic rendering work of target objects involving a large number of different materials with very intuitive few parameters and a very standardized workflow, meeting the stylized art requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular, to a method, apparatus, electronic device, and storage medium for stylized rendering of a target object. Background Art

[0002] In the related art, for the stylized rendering requirements of scenes or objects in a project, the PBR (also known as physically based rendering technology) general material of the Unreal Engine is too realistic and cannot meet the stylized art requirements. Moreover, since the Unreal Engine highly depends on the PBR workflow, directly modifying the Unreal Engine to meet the stylized art requirements will cause a large increase in the art production cost. Summary of the Invention

[0003] In view of this, the purpose of the present application is to provide a method, apparatus, electronic device, and storage medium for stylized rendering of a target object.

[0004] Based on the above purpose, in the first aspect, the present application provides a method for stylized rendering of a target object, including:

[0005] Obtain light source information and the surface color of the target object; wherein, the light source information includes: scattered light information, reflected light information, and ambient light information;

[0006] Determine a diffuse lighting model according to the diffuse Fresnel factor, the surface color of the target object, the scattered light information, and the ambient light information;

[0007] Determine a specular reflection model according to the reflected light information and the diffuse lighting model;

[0008] Combine the diffuse lighting model and the specular reflection model to determine a lighting model, and use the lighting model to perform stylized rendering on the target object.

[0009] In a possible implementation manner, the determining a diffuse lighting model according to the diffuse Fresnel factor, the surface color of the target object, the scattered light information, and the ambient light information further includes:

[0010] Determine a Lambert model component according to the surface color of the target object and the ambient light information;

[0011] Analyze the target object to determine roughness, and determine a reflection component according to the surface color of the target object, the diffuse Fresnel factor, and the scattered light information;

[0012] Determine an incident light related term that affects the incident light consumed by reflection and an outgoing light related term that affects the outgoing light consumed by reflection according to the scattered light information;

[0013] Determine the diffuse reflection illumination model based on the Lambert model component, the reflection component, the incident light related term, the outgoing light related term, and the dot product result of the normal vector and the incident light.

[0014] In a possible implementation, the determining the Lambert model component according to the surface color of the target object and the ambient light information further includes:

[0015] Determine the ambient light brightness according to the ambient light information;

[0016] Determine the Lambert model component according to the ratio of the surface color of the target object to the ambient light brightness.

[0017] In a possible implementation, the analyzing the target object to determine the roughness and determining the reflection component according to the surface color of the target object, the diffuse reflection Fresnel factor, and the scattered light information further includes:

[0018] Determine the diffuse reflection angle according to the scattered light information;

[0019] Determine the roughness component according to the roughness and the diffuse reflection angle;

[0020] Determine the reflection component based on the incident light related term, the outgoing light related term, the diffuse reflection Fresnel factor, the surface color of the target object, and the roughness component

[0021] In a possible implementation, the determining the incident light related term that affects the incident light consumed by reflection and the outgoing light related term that affects the outgoing light consumed by reflection according to the scattered light information further includes:

[0022] Obtain a first angle between the surface normal and the incident light and a second angle between the surface normal and the outgoing light according to the scattered light information;

[0023] Determine the incident light related term according to the first angle, and determine the outgoing light related term according to the second angle.

[0024] In a possible implementation, the determining the roughness component according to the roughness and the diffuse reflection angle further includes:

[0025] Determine the roughness component according to the product of the roughness and the cosine value of the diffuse reflection angle.

[0026] In a possible implementation, the determining the diffuse reflection illumination model according to the Lambert model component and the reflection component further includes:

[0027] In response to detecting that the surface of the target object is a fluffy material, obtain the surface gloss and hue of the target object;

[0028] Determine the gloss component according to the surface gloss, the hue, and the diffuse reflection angle;

[0029] Determine the diffuse reflection illumination model according to the Lambert model component, the reflection component, and the gloss component.

[0030] In a possible implementation manner, the method further includes:

[0031] Obtain the light and dark boundary part of the target object;

[0032] Render the light and dark boundary part by stroke map texture sampling.

[0033] In a possible implementation manner, the determining the specular reflection model according to the reflected light information and the diffuse reflection illumination model further includes:

[0034] Obtain the half - vector of the incident light and the outgoing light according to the reflected light information;

[0035] Obtain the third included angle between the half - vector and the surface normal;

[0036] Determine the diffuse reflection constant according to the diffuse reflection illumination model;

[0037] Based on the Fresnel equation, the normal distribution function, and the micro - surface distribution function, determine the specular reflection model according to the half - vector, the third included angle, and the diffuse reflection constant.

[0038] In a second aspect, the present application provides a stylized rendering device for a target object, including:

[0039] An acquisition module, configured to acquire light source information and the surface color of the target object; wherein, the light source information includes: scattered light information, reflected light information, and ambient light information;

[0040] A first determination module, configured to determine a diffuse reflection illumination model according to the diffuse reflection Fresnel factor, the surface color of the target object, the scattered light information, and the ambient light information;

[0041] A second determination module, configured to determine a specular reflection model according to the reflected light information and the diffuse reflection illumination model;

[0042] A rendering module, configured to combine the diffuse reflection illumination model and the specular reflection model to determine an illumination model, and use the illumination model to perform stylized rendering on the target object.

[0043] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the method for stylized rendering of an object as described in the first aspect is implemented.

[0044] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method for stylized rendering of an object as described in the first aspect.

[0045] As can be seen from the above, a method, apparatus, electronic device, and storage medium for stylized rendering of an object provided by the present application are modified based on the original principle of PBR. By obtaining light source information and the surface color of the object; wherein the light source information may include: diffuse light information, specular light information, and ambient light information; a diffuse illumination model is determined according to the diffuse Fresnel factor, the surface color of the object, the diffuse light information, and the ambient light information; further, a specular reflection model is determined according to the specular light information and the diffuse illumination model; the illumination model is determined by combining the diffuse illumination model and the specular reflection model, and the object is stylizedly rendered using the illumination model. Modifying from the original principle of PBR reduces the art production cost, and can convert a strict physical model into an art-oriented shading model. Because of the ease of use of this art orientation, in the rendering work, with very intuitive few parameters and a very standardized workflow, the non-photorealistic rendering work of objects involving a large number of different materials can be quickly achieved, thus avoiding the problem that the PBR general material of the Unreal Engine is too realistic and meeting the stylized art requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the present application or related technologies, the following will briefly introduce the drawings required for use in the embodiments or related technology descriptions. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained according to these drawings without creative efforts.

[0047] Figure 1 It shows an exemplary flowchart of a method for stylized rendering of an object provided by an embodiment of the present application.

[0048] Figure 2 It shows a schematic diagram of the light and dark boundary part according to an embodiment of the present application.

[0049] Figure 3The figure shows a comparison diagram of the object processed by the specular reflection model according to an embodiment of the present application and the object processed by the Unreal Engine.

[0050] Figure 4 The figure shows a comparison diagram of the object rendered by the lighting model according to an embodiment of the present application and the object processed by the Unreal Engine.

[0051] Figure 5 The figure shows an exemplary structural diagram of a stylized rendering device for an object provided by an embodiment of the present application.

[0052] Figure 6 The figure shows an exemplary structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0053] To make the objectives, technical solutions, and advantages of the present application more clearly understood, the present application will be further described in detail below with reference to specific embodiments and the accompanying drawings.

[0054] It should be noted that unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the ordinary meanings understood by those of ordinary skill in the art to which the present application belongs. The "first", "second", and similar terms used in the embodiments of the present application do not indicate any order, quantity, or importance, but are only used to distinguish different components. The terms such as "including" or "comprising" mean that the elements or objects appearing before this word cover the elements or objects listed after this word and their equivalents, without excluding other elements or objects. The terms such as "connected" or "coupled" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The terms such as "upper", "lower", "left", and "right" are only used to represent relative positional relationships, and when the absolute position of the object being described changes, the relative positional relationship may also change accordingly.

[0055] As described in the background art section, when light irradiates the surface of an object, the object will reflect, transmit, absorb, diffract, refract, and interfere with the light. Among them, the part absorbed by the object is converted into heat, and the reflected and transmitted light enters the human visual system, enabling us to see the object. To simulate this phenomenon, some mathematical models can be established to replace complex physical models, and these models are called shading effect models or illumination models. The general illumination model of Unreal is based on optical physics principles, and the calculation of illumination intensity depends on the propagation of light energy in the real world, considering the mutual influence of light rays with the surfaces of various objects and between the surfaces of objects in the entire scene, including multiple reflections, transmissions, and scatterings.

[0056] When meeting the stylized rendering requirements of scenes or objects in a project through this type of lighting model, the general PBR (also known as physically based rendering technology) materials in Unreal Engine are too realistic and cannot meet the stylized art requirements. Moreover, since Unreal Engine highly depends on the PBR workflow, directly modifying Unreal Engine to meet the stylized art requirements will cause a significant increase in the art production cost.

[0057] Therefore, a method, device, electronic device and storage medium for stylized rendering of a target object provided in this application are modified based on the original principle of PBR. By obtaining the light source information and the surface color of the target object; wherein, the light source information can include: scattered light information, reflected light information and ambient light information; determining a diffuse lighting model according to the diffuse Fresnel factor, the surface color of the target object, the scattered light information and the ambient light information; further determining a specular reflection model according to the reflected light information and the diffuse lighting model; combining the diffuse lighting model and the specular reflection model to determine a lighting model, and using the lighting model to perform stylized rendering on the target object. Modifying from the original principle of PBR reduces the art production cost, and can convert a strict physical model into a rendering model mainly oriented by art. Because of the usability of this art orientation, in the rendering work, with very intuitive few parameters and a very standardized workflow, the non-photorealistic rendering work of target objects involving a large number of different materials can be quickly realized, thus avoiding the problem that the general PBR materials in Unreal Engine are too realistic and meeting the stylized art requirements.

[0058] The following specifically describes the method for stylized rendering of a target object provided in the embodiments of this application through specific embodiments.

[0059] Figure 1 An exemplary flowchart showing a method for stylized rendering of a target object provided in the embodiments of this application is shown.

[0060] Refer to Figure 1 , the method for stylized rendering of a target object provided in the embodiments of this application specifically includes the following steps:

[0061] S102: Obtain the light source information and the surface color of the target object; wherein, the light source information includes: scattered light information, reflected light information and ambient light information.

[0062] S104: Determine a diffuse lighting model according to the diffuse Fresnel factor, the surface color of the target object, the scattered light information and the ambient light information.

[0063] S106: Determine a specular reflection model according to the reflected light information and the diffuse lighting model.

[0064] S108: Combine the diffuse illumination model and the specular reflection model to determine an illumination model, and use the illumination model to perform stylized rendering on the target object.

[0065] Regarding step S102, assuming that there is no illumination in our model, then we can only display the texture map of the model and forge some illumination and shadows on the texture map. Although the color of the object can be seen at this time, there is no sense of three-dimensionality at all. Therefore, it is necessary to place a light source in the scene where the target object is located to make it generate illumination for the scene, so that the scene and the target object in the scene have a sense of three-dimensionality.

[0066] If the color of the light in the scene changes, but the surface of the target object does not change, this is not in line with the human eye experience. Therefore, after setting the light source, it is also necessary to consider the color of the light that generates the light source. After the light source has a color change, the color of the texture map on the surface of the target object will change. For the illumination model, it is necessary to obtain the light source information. And since the color and texture of the surface of the target object will change after rendering the target object, it is also necessary to obtain the surface color of the target object generated after the light source irradiates the target object, so as to construct an illumination model. Therefore, the light source information can be obtained according to the light source in the scene, which can include diffuse light information, reflected light information, incident light information, outgoing light information, and ambient light information, etc. Further, the surface color of the target object generated due to the irradiation of the light source can be obtained.

[0067] Regarding step S104, if only the light source is considered to render the target object, the brightness of all parts of the entire target object will become completely consistent. However, in the human eye experience, the back of the target object should be dark, the side should be relatively dark, and the front should be completely bright. Therefore, the shape of the target object itself also needs to be considered. And the normal map of the target object can more accurately express the shape of the target object. The angle between the normal and the illumination direction determines the degree of illumination of the object. The smaller the angle, the stronger the light. On the contrary, the larger the angle, the weaker the light, which happens to be consistent with the change of the cosine value of the angle. However, further, there is often ambient light in the daily environment. The back of the target object should not be completely dark. Therefore, not only the surface color of the target object and the diffuse light information generated after scattering on the surface of the target object need to be considered, but also the ambient light information needs to be considered further to determine the diffuse illumination model.

[0068] In diffuse reflection, the diffuse reflectance represents the light that is refracted onto the surface, scattered, partially absorbed, and re-emitted. Given that part of the light is absorbed, diffuse reflection is colored by the surface color of the object. Generally, any colored part in non-metallic materials can be considered diffuse reflection. The Unreal Engine in the related art evaluated the Burley diffuse reflection model and found that there is little difference in the effect of this model compared with the Lambert model in the prior art, and other more complex diffuse reflection models cannot be effectively applied based on image or spherical harmonic lighting. Therefore, in the related art, for the diffuse lighting model, the Lambert model is directly applied.

[0069] However, the applicant's research found that when designing rough materials to draw a certain Fresnel reflection, the specular reflection of the smooth surface is represented by the Fresnel equation. Then, the general diffuse reflection model generally does not consider the influence of surface roughness on Fresnel refraction, either assuming the surface is smooth or ignoring the Fresnel effect. Therefore, in this application, the diffuse Fresnel factor is adjusted in diffuse reflection, and at the same time, a diffuse retroreflection term is included. Generally, the BRDF (Bidirectional Reflectance Distribution Function) can be defined as the ratio of the outgoing radiant exitance to the incident irradiance, which is used to measure the reflection characteristics of the object surface with light and represents the material effect of the object.

[0070] In the related art, the BRDF of the Lambert model can be expressed as

[0071] f(θ) = max(cosθ, 0) = max(L·n, 0).

[0072] In some embodiments, adjustments can be made on the basis of the Lambert model, and the consideration of roughness can be increased. According to the surface color and ambient light information of the object obtained by the above steps, the Lambert model component can be determined. Specifically, the ambient light luminance can be determined according to the ambient light information, and then the Lambert model component can be determined according to the ratio of the surface color of the object to the ambient light luminance.

[0073] Among them, the Lambert model component can be expressed as

[0074] f Lambert = baseColor / brightness

[0075] Among them, baseColor represents the surface color of the object, and brightness represents the ambient light luminance. Brightness determines the scattering parameter. For the convenience of adjusting parameters in specific rendering work, this application develops the conserved parameters and the added grazing components to the renderer. Compared with the Lambert model in the Unreal Engine, this application does not follow the law of conservation of energy.

[0076] In some embodiments, after determining the Lambert model components, the target object can be analyzed to determine the roughness of the target object, and the reflection component can be determined based on the color of the target object, the diffuse Fresnel factor, and the scattered light information. Specifically, the diffuse reflection angle, the incident light related term, and the outgoing light related term can be determined based on the scattered light information. This is because the surface of a smooth target object is absolutely flat, and what can affect subsurface scattering is the energy source of subsurface scattering, and these energy sources are the remaining part after being truncated by the specular highlight. Therefore, it is necessary to obtain the incident light related term F that affects the incident light consumed by reflection. L Moreover, not only will it be reflected and truncated during incidence, but it will actually also be consumed by reflection when it finally exits after scattering. Therefore, it is also necessary to obtain the outgoing light related term F that affects the outgoing light consumed by reflection. V .

[0077] It should be noted that the incident light related term F L can be determined by the angle between the surface normal and the incident light, and the outgoing light related term F V can be determined by the angle between the surface normal and the outgoing light. Among them, the surface normal can be obtained from the scattered light information. For the generation method of the normal, in earlier renderings, due to poor graphics card performance, normal maps were generally not used, but a relatively simple normal was used to represent the shape of the entire model. However, for current technologies, normal maps can be used to generate the normal.

[0078] Furthermore, for the incident light related term F L , it can be expressed as

[0079] F L = pow5(1 - cosθ L )

[0080] where pow5 represents the fifth power operation, and θ L , represents the angle between the surface normal and the incident light, that is, the first angle; for the outgoing light related term F V , it can be expressed as

[0081] F V = pow5(1 - cosθ V )

[0082] where θ V represents the angle between the surface normal and the outgoing light, that is, the second angle.

[0083] Furthermore, after determining the incident light related term and the outgoing light related term, the roughness component can be determined based on the roughness and the diffuse reflection angle determined from the scattered light information in the above steps. Specifically, the roughness component can be determined based on the product of the roughness and the cosine value of the diffuse reflection angle. Among them, the roughness component RR Can be expressed as

[0084] R R = 2 * roughness * cos2(θ d )

[0085] Where roughness represents the roughness and θ d represents the diffuse reflection angle. When the roughness component R R is greater than 1, the grazing reflection is stronger, and when the roughness component R R is less than 1, the grazing reflection is weaker.

[0086] It should be noted that the reflection component can be determined based on the incident light related terms, the outgoing light related terms, the diffuse Fresnel factor, the surface color of the target object, and the roughness component. This reflection component f retro-reflection Can be expressed as

[0087] f retro-reflection = baseColor / π * R R (F L + F V + F L F V (R R - 1))

[0088] Where baseColor represents the surface color of the target object, 1 / π represents the diffuse Fresnel factor, and R R represents the roughness component. The rough subsurface scattering model is affected by roughness on the reflection component f retro-reflection because the surface is rough, resulting in the line of sight and light being closer to retroreflection in the grazing angle direction, which is more obvious.

[0089] On the microplane, if many normals can reflect into the human eye, then there will be a specular highlight in this area. If the normal directions are chaotic and the light scatters in all directions, what the human eye sees is diffuse reflection. That is to say, specular highlight and diffuse reflection are mutually exclusive, and the sum of specular highlight and diffuse reflection light is the total incident light.

[0090] Therefore, in some embodiments, after determining the Lambert model component and the reflection component, the diffuse illumination model can be determined based on the two. Specifically, the diffuse illumination model f d , can be expressed as

[0091] f d = f Lamber (1 - 0.5F L )(1 - 0.5F V ) + f retro-reflection + n · L

[0092] Where fLamber Represents the Lambert model component, F L Represents the incident light related term that affects the incident light consumed by reflection, F V Represents the outgoing light related term that affects the outgoing light consumed by reflection, f retro-reflection Represents the reflection component, n represents the normal vector, and L represents the incident light direction.

[0093] In some embodiments, retroreflection alone is not enough. If the surface of the target object is found to be a fluffy material, the edges will be brighter due to more frequent refraction and reflection. Therefore, the surface gloss and hue of the target object can be obtained, and the gloss component can be determined based on the surface gloss, hue, and diffuse reflection angle. When the edges of the target object are brighter due to more frequent refraction and reflection, the gloss component can be added to the diffuse illumination model, that is, the diffuse illumination model can be re-determined based on the Lambert model component, reflection component, and gloss component. Among them, the gloss component F(sheen, θ d ) can be expressed as

[0094] F(sheen, θ d ) = sheen * pow5((1 - sheen) + sheen * tint) * (1 - cosθ d )

[0095] Where sheen represents the surface gloss and tint represents the hue. The art production staff can be given the option to add the gloss variable to the diffuse illumination model by setting a boolean value.

[0096] Figure 2 Shows a schematic diagram of the light and dark boundary part according to an embodiment of the present application.

[0097] In some embodiments, referring to Figure 2 , based on the obtained diffuse illumination model, the light and dark boundary part can be separately stylized. Since it is impossible to set a dividing line for the light and dark boundary part of the target object out of thin air, brushstrokes can be applied to the original painting through brush texture sampling and mapped into the figure, thereby rendering the light and dark boundary part and stylizing it.

[0098] Regarding step S106, in some embodiments, in the absence of light, since the target object cannot be seen, the presented target object has no color. Therefore, in PBR, there is no such thing as a material color for the material. The RGB values inherent in the material refer to the degree of reception of the target object for the RGB channels of the diffuse light, specular light, and ambient light. The RGB channels of the material are scalings of the RGB colors of the light. Therefore, for specular reflection, the specular reflection model can be determined based on the art-directed Disney model according to the reflected light information and the diffuse illumination model.

[0099] Furthermore, for specular reflection, the reflected energy actually never enters the surface of the target object at all. So this energy is the remaining energy after reflection. In specular reflection, ambient light cannot be directly described by the formula of the reflection model in the prior art because there are many light rays with different incident directions illuminating the surface of the target object, and to calculate whether these light rays are reflected out, hemispherical integration needs to be used.

[0100] The reason for using hemispherical integration to determine the specular reflection model is that the surface of the target object may be uneven. Hemispherical integration integrates the upper hemisphere because the lower hemisphere cannot be received. In fact, from the definition of solid angle, whether it is a square or any other shape, the solid angle is equal to that of a sphere. Using hemispherical integration can well simulate an uneven surface. Since what needs to be calculated is the energy emitted by a light in one direction, integration needs to be performed on the entire surface of the target object, and dw i can be used as the integration variable, that is, the incident light direction, to fill the entire hemispherical surface.

[0101] It should be noted that the process of determining the specular reflection model may include the following steps: obtaining the half-way vector of the incident light and the outgoing light according to the reflected light information, and then determining the diffuse constant diffuse according to the diffuse illumination model; determining the specular reflection model based on the Fresnel equation, the normal distribution function, and the micro-surface distribution function according to the half-way vector and the diffuse constant. Among them, the normal distribution function is used to determine where on the target object diffuse reflection occurs and where specular highlights occur, and the normal distribution function can be determined by hemispherical integration. Among them, the specular reflection model f(L, V) can be expressed as

[0102]

[0103] where L represents the incident light, V represents the outgoing light, F() represents the Fresnel equation, D() represents the normal distribution function, G() represents the micro-surface distribution function, diffuse represents the diffuse constant, θ d represents the diffuse angle, θ hDenotes the angle between the said half - vector and the normal, that is, the third angle.

[0104] It should be noted that D() represents the normal distribution function, which can also be called (NDF), and is used to describe the probability of the normal distribution of micro - facets, that is, the concentration of normals with the correct orientation. That is, the concentration relative to the surface area of surface points with the correct orientation that can reflect light from L to V. F() represents the Fresnel equation, which is used to describe the ratio of the light reflected by the surface at different surface angles. 4cosθ L cosθ V Can be understood as a correction factor, as the correction of the micro - plane quantity for the transformation between the local space of the micro - geometry and the local space of the entire macro - surface.

[0105] Furthermore, for the NDF, an efficient GGX / TR model can be used. The low overhead of the Blinn - Phong model and its unique and natural performance caused by its longer tail have attracted artists. The re - parameterized α parameter in the model can be adopted at the same time, where α = roughness 2 , and its GGX model can be expressed as

[0106]

[0107] For the Fresnel equation, a slightly modified Schlick approximation algorithm can be used. The spherical Gaussian approximation is used to replace the exponential term, which can improve the calculation efficiency and only bring imperceptible differences. Its formula can be:

[0108] F(v, h)=F0+(1 - F0)2(-5.55473(v·h)-6.98316)(v·h)

[0109] Where F0 represents the specular reflectivity of normal incidence. And specular means that light does not enter the object and is directly reflected on the surface.

[0110] Figure 3 Shows a comparison diagram of the object processed by the specular reflection model according to the embodiment of the present application and the object processed by the Unreal Engine.

[0111] Reference Figure 3 , on the left is the effect adjusted by using the specular reflection model of the present application, and on the right is the official effect of the Unreal Engine. The specular reflection model provided by the Unreal Engine takes an approximation value on Specular (that is, the R value of RGB), and the grazing specular reflection is achromatic. In order to simulate a more art - oriented effect, specular color and specular are directly opened. Users can give high - light color or texture according to needs.

[0112] In some embodiments, the Split Sum Approximation part in the Unreal Engine can further be adopted. The first step of the formula derivation can be expressed as

[0113]

[0114] The right side of the equation is the Monte Carlo integration formula, where is the probability distribution function: pdf. It should be noted that for the rendering equation, pdf is a normalized function, that is, the integral value within the hemispherical domain is 1.

[0115] For performance considerations, the next step is also an approximation. That is, the Monte Carlo formula in the first step is split into two ∑ for operation.

[0116]

[0117] When the incident light is constant, this approximation is accurate and has a very precise effect in a general environment.

[0118] Figure 4 The figure shows a comparison diagram of the object rendered by the lighting model according to the embodiments of the present application and the object processed by the Unreal Engine.

[0119] Refer to Figure 4 , it can be seen that for step S108, after combining the diffuse lighting model and the specular reflection model to determine the lighting model, the effect of stylized rendering of the object using the lighting model is more capable of highlighting the non-photorealism compared to the object rendered by the official lighting model of the Unreal Engine, achieving customized stylized rendering.

[0120] As can be seen from the above, a method, apparatus, electronic device, and storage medium for stylized rendering of an object provided by the present application are modified based on the original principle of PBR. By obtaining light source information and the surface color of the object; wherein the light source information may include: scattered light information, reflected light information, and ambient light information; determining a diffuse illumination model according to the diffuse reflection Fresnel factor, the surface color of the object, the scattered light information, and the ambient light information; further determining a specular reflection model according to the reflected light information and the diffuse illumination model; combining the diffuse illumination model and the specular reflection model to determine an illumination model, and using the illumination model to perform stylized rendering on the object. Modifying from the original principle of PBR reduces the art production cost, and can convert a strict physical model into an art-oriented shading model. Because of the ease of use of this art orientation, in the rendering work, with very intuitive few parameters and a very standardized workflow, the non-photorealistic rendering work of objects involving a large number of different materials can be quickly realized, thus avoiding the problem that the PBR general material of the Unreal Engine is too realistic and meeting the stylized art requirements.

[0121] It should be noted that the method of the embodiment of the present application can be executed by a single device, such as a computer or a server, etc. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In this case of a distributed scenario, one of the multiple devices can only execute one or more steps of the method of the embodiment of the present application, and these multiple devices will interact with each other to complete the described method.

[0122] It should be noted that some embodiments of the present application have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be executed in a different order than in the above embodiments and still achieve the desired results. Additionally, the processes depicted in the figures do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain implementations, multitasking and parallel processing are also possible or may be advantageous.

[0123] Figure 5 The exemplary structural schematic diagram of a stylized rendering apparatus for an object provided by an embodiment of the present application is shown.

[0124] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application also provides a stylized rendering apparatus for an object.

[0125] Refer to Figure 5 , the stylized rendering apparatus for an object includes: an acquisition module, a first determination module, a second determination module, and a control module; wherein,

[0126] An acquisition module, configured to acquire light source information and the surface color of the target object; wherein, the light source information includes: scattered light information, reflected light information, and ambient light information;

[0127] A first determination module, configured to determine a diffuse reflection illumination model according to the diffuse reflection Fresnel factor, the surface color of the target object, the scattered light information, and the ambient light information;

[0128] A second determination module, configured to determine a specular reflection model according to the reflected light information and the diffuse reflection illumination model;

[0129] A rendering module, configured to combine the diffuse reflection illumination model and the specular reflection model to determine an illumination model, and use the illumination model to perform stylized rendering on the target object.

[0130] In a possible implementation manner, the first determination module is further configured to:

[0131] Determine a Lambert model component according to the surface color of the target object and the ambient light information;

[0132] Analyze the target object to determine the roughness, and determine a reflection component according to the surface color of the target object, the diffuse reflection Fresnel factor, and the scattered light information;

[0133] Determine an incident light related term that affects the incident light consumed by reflection and an outgoing light related term that affects the outgoing light consumed by reflection according to the scattered light information;

[0134] Determine the diffuse reflection illumination model according to the Lambert model component, the reflection component, the incident light related term, the outgoing light related term, and the dot product result of the normal vector and the incident light.

[0135] In a possible implementation manner, the first determination module is further configured to:

[0136] Determine the ambient light brightness according to the ambient light information;

[0137] Determine the Lambert model component according to the ratio of the surface color of the target object to the ambient light brightness.

[0138] In a possible implementation manner, the first determination module is further configured to:

[0139] Determine the diffuse reflection angle according to the scattered light information;

[0140] Determine a roughness component according to the roughness and the diffuse reflection angle;

[0141] Determine the reflection component based on the incident light related term, the outgoing light related term, the diffuse reflection Fresnel factor, the surface color of the target object, and the roughness component.

[0142] In a possible implementation, the first determination module is further configured to:

[0143] Obtain a first angle between the surface normal and the incident light and a second angle between the surface normal and the outgoing light according to the scattered light information;

[0144] Determine the incident light related term according to the first angle, and determine the outgoing light related term according to the second angle.

[0145] In a possible implementation, the first determination module is further configured to:

[0146] Determine the roughness component according to the product of the roughness and the cosine value of the diffuse reflection angle.

[0147] In a possible implementation, the first determination module is further configured to:

[0148] In response to detecting that the surface of the target object is a fluffy material, obtain the surface gloss and hue of the target object;

[0149] Determine the gloss component according to the surface gloss, the hue, and the diffuse reflection angle;

[0150] Determine the diffuse reflection illumination model according to the Lambert model component, the reflection component, and the gloss component.

[0151] In a possible implementation, the device further includes: a sampling module;

[0152] The sampling module is further configured to:

[0153] Obtain the light and dark boundary part of the target object;

[0154] Render the light and dark boundary part by stroke map texture sampling.

[0155] In a possible implementation, the second determination module is further configured to:

[0156] Obtain the half - vector of the incident light and the outgoing light according to the reflected light information;

[0157] Obtain a third angle between the half - vector and the surface normal;

[0158] Determine the diffuse reflection constant according to the diffuse reflection illumination model;

[0159] Based on the Fresnel equation, the normal distribution function, and the micro-surface distribution function, determine the specular reflection model according to the half vector, the third included angle, and the diffuse reflection constant.

[0160] For the convenience of description, when describing the above device, it is divided into various modules according to functions and described separately. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0161] The device in the above embodiment is used to implement the corresponding method for stylized rendering of the target object in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0162] Figure 6 Shows an exemplary structural schematic diagram of an electronic device provided by an embodiment of the present application.

[0163] Based on the same inventive concept, corresponding to the method in any of the above embodiments, the present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the method for stylized rendering of the target object described in any of the above embodiments. Refer to Figure 6 , Figure 6 Shows a more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment. The device may include: a processor 610, a memory 620, an input / output interface 630, a communication interface 640, and a bus 650. Among them, the processor 610, the memory 620, the input / output interface 630, and the communication interface 640 are communicatively connected to each other inside the device through the bus 650.

[0164] The processor 610 can be implemented in a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0165] The memory 620 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 620 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 620 and are called and executed by the processor 610.

[0166] The input / output interface 630 is used to connect to the input / output module to achieve information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Among them, the input devices can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices can include a display, a speaker, a vibrator, an indicator light, etc.

[0167] The communication interface 640 is used to connect to the communication module (not shown in the figure) to achieve communication and interaction between this device and other devices. Among them, the communication module can achieve communication through wired means (such as USB, network cable, etc.) or through wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0168] The bus 650 includes a path for transmitting information between various components of the device (such as the processor 610, the memory 620, the input / output interface 630, and the communication interface 640).

[0169] It should be noted that although the above device only shows the processor 610, the memory 620, the input / output interface 630, the communication interface 640, and the bus 650, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device may also only include the components necessary to implement the solution of the embodiments of this specification, and does not necessarily include all the components shown in the figure.

[0170] The electronic device in the above embodiment is used to implement the corresponding method for stylized rendering of the target object in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0171] Based on the same inventive concept, corresponding to the method in any of the above embodiments, the present application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method for stylized rendering of the target object as described in any of the foregoing embodiments.

[0172] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage, or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0173] The computer instructions stored in the storage medium of the above embodiment are used to cause the computer to execute the method for stylized rendering of the target object described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0174] Those of ordinary skill in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the present application (including the claims) is limited to these examples; under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of brevity.

[0175] In addition, for the sake of simplicity of description and discussion, and in order not to make the embodiments of the present application difficult to understand, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. In addition, the device may be shown in block diagram form to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present application will be implemented (i.e., these details should be completely within the understanding of those skilled in the art). In the case where specific details (such as circuits) are set forth to describe the exemplary embodiments of the present application, it will be apparent to those skilled in the art that the embodiments of the present application can be implemented without these specific details or with variations of these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0176] Although the present application has been described in connection with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.

[0177] Embodiments of the present application are intended to cover all such alternatives, modifications, and variations that fall within the broad scope of the appended claims. Accordingly, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the embodiments of the present application shall be included within the protection scope of the present application.

Claims

1. A method for stylized rendering of an object, characterized in that, Including: Obtain light source information and the surface color of the target object; wherein, the light source information includes: scattered light information, reflected light information, and ambient light information; Determine a diffuse reflection illumination model based on the diffuse reflection Fresnel factor, the surface color of the target object, the scattered light information, and the ambient light information; Determine a specular reflection model based on the reflected light information and the diffuse reflection illumination model; Combine the diffuse reflection illumination model and the specular reflection model to determine an illumination model, and use the illumination model to perform stylized rendering on the target object.

2. The method according to claim 1, characterized in that The step of determining a diffuse reflection illumination model based on the diffuse reflection Fresnel factor, the surface color of the target object, the scattered light information, and the ambient light information further includes: Determine the Lambert model component based on the surface color of the target object and the ambient light information; Analyze the target object to determine the roughness, and determine the reflection component based on the surface color of the target object, the diffuse reflection Fresnel factor, and the scattered light information; Determine an incident light related term that affects the incident light consumed by reflection and an outgoing light related term that affects the outgoing light consumed by reflection based on the scattered light information; Determine the diffuse reflection illumination model based on the Lambert model component, the reflection component, the incident light related term, the outgoing light related term, and the dot product result of the normal vector and the incident light.

3. The method according to claim 2, wherein The step of determining the Lambert model component based on the surface color of the target object and the ambient light information further includes: Determine the ambient light brightness based on the ambient light information; Determine the Lambert model component based on the ratio of the surface color of the target object to the ambient light brightness.

4. The method according to claim 2, wherein The step of analyzing the target object to determine the roughness, and determining the reflection component based on the surface color of the target object, the diffuse reflection Fresnel factor, and the scattered light information further includes: Determine the diffuse reflection angle based on the scattered light information; Determine the roughness component based on the roughness and the diffuse reflection angle; Determine the reflection component based on the incident light related term, the outgoing light related term, the diffuse reflection Fresnel factor, the surface color of the target object, and the roughness component.

5. The method according to claim 2, wherein The step of determining an incident light related term that affects the incident light consumed by reflection and an outgoing light related term that affects the outgoing light consumed by reflection based on the scattered light information further includes: Obtain a first angle between the surface normal and the incident light and a second angle between the surface normal and the outgoing light based on the scattered light information; Determine the incident light related term based on the first angle, and determine the outgoing light related term based on the second angle.

6. The method according to claim 4, wherein The step of determining the roughness component based on the roughness and the diffuse reflection angle further includes: Determine the roughness component based on the product of the roughness and the cosine value of the diffuse reflection angle.

7. The method according to claim 4, wherein The step of determining the diffuse reflection illumination model based on the Lambert model component and the reflection component further includes: In response to detecting that the surface of the target object is a fluffy material, obtain the surface gloss and hue of the target object; Determine the gloss component based on the surface gloss, the hue, and the diffuse reflection angle; Determine the diffuse illumination model according to the Lambert model component, the reflection component, and the specular component.

8. The method according to claim 1, wherein The method further includes: Obtain the light and dark boundary part of the target object; Render the light and dark boundary part by texture sampling of the brush stroke map.

9. The method according to claim 5, wherein The determining the specular reflection model according to the reflected light information and the diffuse illumination model further includes: Obtain the half - vector of the incident light and the outgoing light according to the reflected light information; Obtain the third angle between the half - vector and the surface normal; Determine the diffuse constant according to the diffuse illumination model; Based on the Fresnel equation, the normal distribution function, and the micro - surface distribution function, determine the specular reflection model according to the half - vector, the third angle, and the diffuse constant.

10. A stylized rendering device for a target object, characterized in that, It includes: An acquisition module, configured to acquire light source information and the surface color of the target object; wherein, the light source information includes: scattered light information, reflected light information, and ambient light information; A first determination module, configured to determine the diffuse illumination model according to the diffuse Fresnel factor, the surface color of the target object, the scattered light information, and the ambient light information; A second determination module, configured to determine the specular reflection model according to the reflected light information and the diffuse illumination model; A rendering module, configured to combine the diffuse illumination model and the specular reflection model to determine the illumination model, and use the illumination model to perform stylized rendering on the target object.

11. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that When the processor executes the program, it implements the method according to any one of claims 1 to 9.

12. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Rendering method and system based on physical coloring

    CN107644453A

  • Target model processing method and device, storage medium and computer equipment

    CN112489179A