Vegetation model generation method and apparatus, electronic equipment, storage medium

By determining the illumination area and illumination mask parameters, a lighting rendering layer for the vegetation model is generated, which solves the problem of low lighting simulation efficiency for vegetation models and improves rendering efficiency and realism.

CN116071483BActive Publication Date: 2026-11-17NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310134179.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-07
Publication Date
2026-11-17
Estimated Expiration
2043-02-07

AI Technical Summary

Technical Problem

In existing technologies, the lighting simulation efficiency of vegetation models is relatively low, especially the rendering efficiency is insufficient on low-performance platforms, which cannot meet the performance requirements of game development.

Method used

By determining the illumination area of ​​the virtual light source on the initial vegetation model, the illumination gradient parameters are calculated using the model contour parameters and illumination area. A target illumination mask is created and the vegetation illumination rendering layer is determined. Finally, the rendering layer is applied to the initial model to generate a target vegetation model with subsurface scattering illumination effects.

Benefits of technology

It improves the lighting simulation efficiency of vegetation models, reduces the computational load and rendering environment maintenance costs for mobile game development, and enhances the realistic rendering effect of subsurface scattering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116071483B_ABST
    Figure CN116071483B_ABST
Patent Text Reader

Abstract

This disclosure provides a method, apparatus, electronic device, and storage medium for generating vegetation models, relating to the field of model rendering technology, and applicable to virtual game scenes. The vegetation model generation method includes: determining the illuminated area of ​​an initial vegetation model illuminated by a virtual light source; determining the lighting gradient parameters of the initial vegetation model based on its contour parameters and illuminated area; determining a target lighting mask, and determining a vegetation lighting rendering layer based on the target lighting mask and lighting gradient parameters; and applying the vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects. The technical solution of this disclosure can solve the problem of low lighting simulation efficiency for vegetation models.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of model rendering technology, and more specifically, to a vegetation model generation method and apparatus, electronic device, and storage medium. Background Technology

[0002] Subsurface scattering (3S or SSS) is a phenomenon that occurs when light propagates. To achieve the subsurface scattering effect in a virtual scene, it is generally simulated using BSSRDF (Bidirectional Surface Scattering Reflectance Distribution Function). However, the lighting model solution algorithm of BSSRDF is too complex, resulting in low rendering efficiency for 3S lighting effect simulation on low-performance platforms.

[0003] There is currently no solution to the problem of low efficiency in lighting simulation for vegetation models in game development.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The purpose of this disclosure is to provide a vegetation model generation method, apparatus, electronic device, and storage medium, thereby overcoming, to at least some extent, the problem of low efficiency in simulating the illumination of vegetation models.

[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0007] According to a first aspect of the present disclosure, a vegetation model generation method is provided, comprising: determining the illumination area of ​​an initial vegetation model illuminated by a virtual light source; determining illumination gradient parameters of the initial vegetation model based on the model contour parameters and the illumination area; determining a target illumination mask, and determining a vegetation illumination rendering layer based on the target illumination mask and the illumination gradient parameters; and applying the vegetation illumination rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering illumination effects.

[0008] In some example embodiments of this disclosure, based on the aforementioned scheme, determining the illumination area of ​​the virtual light source illuminating the initial vegetation model includes: obtaining the normal direction of the initial vegetation model and the light direction of the light rays; determining the light direction vector of the light ray direction and the normal direction vector of the normal direction; and obtaining the illumination area of ​​the initial vegetation model based on the light direction vector and the normal direction vector.

[0009] In some example embodiments of this disclosure, determining the target lighting mask based on the foregoing scheme includes: obtaining the gaze direction vector of the virtual camera's gaze direction in the virtual scene; and performing a dot product between the gaze direction vector and the light direction vector to determine the target lighting mask.

[0010] In some example embodiments of this disclosure, based on the aforementioned scheme, the target illumination mask is determined by multiplying the line-of-sight vector and the light direction vector. This includes: if the camera's line-of-sight direction is the same as the light direction, then the initial vegetation model is determined to be occluded by frontal light, and a frontal illumination mask of the initial vegetation model is created; if the camera's line-of-sight direction is opposite to the light direction, then the initial vegetation model is determined to be penetrated by backlight, and a backlight mask of the initial vegetation model is created; and the target illumination mask is determined based on the frontal illumination mask or the backlight mask.

[0011] In some example embodiments of this disclosure, based on the aforementioned scheme, determining the vegetation lighting rendering layer according to the target lighting mask and lighting gradient parameters includes: if the camera's line of sight is the same as the light direction, then fitting the front lighting mask with the lighting gradient parameters to obtain the front vegetation lighting rendering layer; if the camera's line of sight is opposite to the light direction, then fitting the back lighting mask with the lighting gradient parameters to obtain the back vegetation lighting rendering layer; and using either the front vegetation lighting rendering layer or the back vegetation lighting rendering layer as the vegetation lighting rendering layer.

[0012] In some example embodiments of this disclosure, based on the aforementioned scheme, applying a vegetation lighting rendering layer to an initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects includes: obtaining vegetation transmittance; fitting the vegetation lighting rendering layer to the vegetation transmittance to obtain a refined vegetation lighting rendering layer; fitting the refined vegetation lighting rendering layer to the material parameters in the target channel to obtain a target vegetation lighting rendering layer; and applying the target vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects.

[0013] In some example embodiments of this disclosure, based on the foregoing scheme, before determining the illumination gradient parameters of the initial vegetation model according to the model contour parameters and illumination area of ​​the initial vegetation model, the method further includes: determining the depth distance between the center position of the vegetation model and the edge position of the vegetation model; and using the depth distance as the model contour parameter.

[0014] According to a second aspect of the present disclosure, a vegetation model generation apparatus is provided, comprising: a first determining unit, configured to determine the illumination area of ​​an initial vegetation model illuminated by light from a virtual light source; a second determining unit, configured to determine illumination gradient parameters of the initial vegetation model based on model contour parameters and illumination area; a third determining unit, configured to determine a target illumination mask and determine a vegetation illumination rendering layer based on the target illumination mask and illumination gradient parameters; and a fourth determining unit, configured to apply the vegetation illumination rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering illumination effect.

[0015] According to a third aspect of the present disclosure, an electronic device is provided, including: a processor; and a memory storing computer-readable instructions, which, when executed by the processor, implement the vegetation model generation method described above.

[0016] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, it implements a vegetation model generation method according to any one of the above.

[0017] The technical solutions provided in this disclosure can include the following beneficial effects:

[0018] The vegetation model generation method in the example embodiments of this disclosure involves: determining the illuminated area of ​​an initial vegetation model by the light from a virtual light source; determining the lighting gradient parameters of the initial vegetation model based on its model outline parameters and illuminated area; determining a target lighting mask; and determining a vegetation lighting rendering layer based on the target lighting mask and lighting gradient parameters; and applying the vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects. On the one hand, determining the lighting gradient parameters of the initial vegetation model based on its model outline parameters and illuminated area not only saves computational resources during mobile game development but also improves the realistic rendering of subsequent subsurface scattering. On the other hand, by using the obtained vegetation lighting rendering layer based on the target lighting mask and lighting gradient parameters, the maintenance cost of the vegetation rendering environment is reduced while improving the lighting simulation efficiency in the target vegetation model.

[0019] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0021] Figure 1 A schematic diagram illustrating an exemplary system architecture for applying a vegetation model generation method and apparatus disclosed herein in an exemplary embodiment is shown.

[0022] Figure 2 The illustration shows a schematic diagram of a vegetation model generation method according to some embodiments of the present disclosure;

[0023] Figure 3 A schematic diagram illustrating direction vectors according to some embodiments of the present disclosure is shown.

[0024] Figure 4 A schematic diagram illustrates the illumination area according to some embodiments of the present disclosure. Figure 1 ;

[0025] Figure 5 A schematic diagram illustrates the illumination area according to some embodiments of the present disclosure. Figure 2 ;

[0026] Figure 6 A schematic diagram illustrating a tapered gradient range according to some embodiments of the present disclosure is shown.

[0027] Figure 7 A schematic diagram illustrating the pure lighting effect according to some embodiments of the present disclosure is shown;

[0028] Figure 8 A schematic diagram illustrating the translucent effect of light according to some embodiments of the present disclosure is shown.

[0029] Figure 9 A schematic diagram illustrating the effect of illumination gradient parameters according to some embodiments of the present disclosure is shown.

[0030] Figure 10 A schematic diagram illustrating the camera line of sight according to some embodiments of the present disclosure is shown;

[0031] Figure 11 A schematic diagram of a front lighting mask according to some embodiments of the present disclosure is shown;

[0032] Figure 12 A schematic diagram of a back-lit mask according to some embodiments of the present disclosure is shown;

[0033] Figure 13 A schematic diagram of a frontal vegetation lighting rendering layer according to some embodiments of the present disclosure is shown.

[0034] Figure 14 A schematic diagram of a back vegetation lighting rendering layer according to some embodiments of the present disclosure is shown;

[0035] Figure 15 A schematic diagram of transmittance graphs according to some embodiments of the present disclosure is shown.

[0036] Figure 16 The illustration shows a schematic diagram of the lighting effect of a refined vegetation model according to some embodiments of the present disclosure;

[0037] Figure 17 A schematic diagram illustrating the lighting effect of a target vegetation model according to some embodiments of the present disclosure is shown.

[0038] Figure 18 A schematic diagram of a vegetation model generation apparatus according to some embodiments of the present disclosure is shown.

[0039] Figure 19 The schematic diagram illustrates the structural schematic of a computer system of an electronic device according to some embodiments of the present disclosure.

[0040] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation

[0041] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art.

[0042] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0043] Furthermore, the accompanying drawings are for illustrative purposes only and are not necessarily drawn to scale. The block diagrams shown in the drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0044] Explanation of relevant terms and concepts involved in the embodiments of this disclosure:

[0045] BRDF (Bidirectional Reflectance Distribution Function) is one of the most fundamental concepts in realistic computer graphics. It describes the reflection characteristics of an object's surface, which reflects light energy from any incident direction to any viewpoint direction. In other words, it describes how incident light rays are distributed in various outgoing directions after being reflected by a surface. The BRDF model is the basic model used in most computer graphics algorithms to describe light reflection phenomena.

[0046] Figure 1 A schematic diagram of an exemplary system architecture for a vegetation model generation method and apparatus to which embodiments of the present disclosure can be applied is shown.

[0047] like Figure 1 As shown, system architecture 100 may include one or more of terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables. Terminal devices 101, 102, and 103 may be various electronic devices with displays, including but not limited to desktop computers, laptops, smartphones, and tablets. It should be understood that... Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, there can be any number of terminal devices, networks, and servers. For example, server 105 could be a server cluster composed of multiple servers.

[0048] The vegetation model generation method provided in this embodiment can be executed by terminal devices 101, 102, and 103, and correspondingly, the vegetation model generation device can also be disposed in terminal devices 101, 102, and 103. Alternatively, the vegetation model generation method provided in this embodiment can be jointly executed by terminal devices 101, 102, and 103 and server 105, and correspondingly, the vegetation model generation device can be disposed in terminal devices 101, 102, and 103 and server 105. Furthermore, the vegetation model generation method provided in this embodiment can also be executed by server 105, and correspondingly, the vegetation model generation device can be disposed in server 105; this exemplary embodiment does not impose any special limitations on this.

[0049] For example, in this example embodiment, the vegetation model generation method provided in this embodiment can be run on server 105 deployed on the game platform to generate a target vegetation model with subsurface scattering illumination effect, and the relevant rendering data of the target vegetation model with subsurface scattering illumination effect can be sent to terminal devices 101, 102, and 103 for rendering and display.

[0050] However, those skilled in the art will readily understand that the above operations are merely illustrative and are not intended to limit the scope of this exemplary embodiment.

[0051] One approach uses BSSRDF (Bidirectional Surface Scattering Reflectance Distribution Function) with pre-integration for 3S simulation. This requires sampling a pre-integrated image. Given the large number of vegetation models, materials, and the wide area they cover, the performance overhead of using multiple translucency maps and pre-integration is significant for mobile game development. If a pre-integrated image is required for each type of vegetation, then multiple types would require N pre-integrated images, which is clearly wasteful in mobile game development. Furthermore, the BSSRDF lighting model solution algorithm is overly complex and does not meet the performance requirements of mobile game development when running on various types of vegetation, further contributing to its low rendering efficiency in 3S lighting effect simulation on low-performance platforms.

[0052] To address the issue of low rendering efficiency in 3S lighting effect simulation on low-performance platforms, in one embodiment of this disclosure, the vegetation model generation method can run on a terminal device or a server. The following description uses the execution of the vegetation model generation method in this disclosure on a server as an example. Figure 2 The diagram illustrates a vegetation model generation method according to some embodiments of the present disclosure. (Reference) Figure 2As shown, the vegetation model generation method may include the following steps:

[0053] Step S210: Provide a virtual light source and an initial vegetation model in the virtual scene, and determine the illumination area of ​​the virtual light source on the initial vegetation model.

[0054] Specifically, the initial vegetation model refers to the white model used to simulate vegetation, which has undergone no rendering processing. Illuminated area refers to the area of ​​illumination that a virtual light source shines on the initial vegetation model.

[0055] Specifically, virtual light sources and initial vegetation models in a virtual scene can be like... Figure 3 The vector diagram in the diagram is used to represent this. Specifically, the illuminated area of ​​the virtual light source shining on the initial vegetation model can be represented as follows: Figure 3 As shown in the bright area, the virtual light source can be a parallel light source or a point light source. This disclosure is not limited to these. The following description will focus on the virtual light source as a parallel light source.

[0056] Among them, such as Figure 3 As shown, determining the illuminated area of ​​the virtual ray illuminating the initial vegetation model is one of the inventive points of this disclosure, including the following steps: obtaining the normal direction of the initial vegetation model and the ray direction; determining the ray direction vector of the ray direction and the normal direction vector of the normal direction; and obtaining the illuminated area of ​​the initial vegetation model based on the ray direction vector and the normal direction vector.

[0057] In other words, by multiplying the light source direction by the initial vegetation model's spatial position, the range of light illuminating the model can be obtained, thus yielding the illuminated area of ​​the initial vegetation model. The specific implementation principle is as follows: multiply the vector of the parallel light direction by the vector of the normal direction to obtain an illuminated range of [0,1], where strong light is 1 and weak light is 0. A specific image example of the illuminated area can be seen as follows... Figure 4 As shown. For Figure 4 The illuminated area can be further rendered to obtain, such as Figure 5 The image shown illustrates the illumination. By determining the illuminated area, the efficiency of subsequent illumination simulations of subsurface scattering on the vegetation model is improved.

[0058] Step S220: Determine the illumination gradient parameters of the initial vegetation model based on the model outline parameters and illumination area of ​​the initial vegetation model.

[0059] The initial vegetation model's contour parameters can be either the depth distance from the model's center to its edge, or the line-of-sight vector from the camera's perspective towards the model's center in the virtual scene. Both can represent the range from the vegetation model's edge to its center. Since this range changes depending on the virtual camera's viewing angle, the depth distance is used to control the range and minimize its variation.

[0060] To improve the efficiency of subsequent illumination simulation of subsurface scattering on vegetation models, this disclosure uses the depth distance as the model contour parameter of the initial vegetation model and the illumination area to determine the illumination gradient parameters of the initial vegetation model. The specific depth distance determination process includes the following steps: determining the depth distance between the center position and the edge position of the vegetation model; and using the depth distance as the model contour parameter.

[0061] Specifically, the vector of the virtual camera looking towards the center of the vegetation model can be represented by a conical gradient. Therefore, this disclosure controls the range of the conical gradient in screen space by utilizing the depth distance of the vegetation model. For example, a graphical example of the change in the range of the conical gradient under different virtual camera views can be shown below. Figure 6 As shown.

[0062] For example, after obtaining the tapered gradient range, this disclosure Figure 7 The pure illumination effect diagram of the illuminated area of ​​the initial vegetation model is displayed. Figure 8 This demonstrates the lighting effects of a semi-transparent channel within a tapered gradient range of the initial vegetation model. Figure 7 as well as Figure 8 The rendering effects in the middle are superimposed to obtain a result with such Figure 9 The diagram shown is an approximate simulation of lighting on vegetation. The material parameters constituting this simulation are used as the lighting gradient parameters in this disclosure.

[0063] Step S230: Determine the target lighting mask, and determine the vegetation lighting rendering layer based on the target lighting mask and lighting gradient parameters.

[0064] Specifically, the target lighting mask can cover a specific area of ​​the initial vegetation model when facing the light, or it can cover a specific area of ​​the initial vegetation model when facing away from the light. The vegetation lighting rendering layer can be understood as... Figure 9 Based on the approximate lighting simulation of vegetation, a target lighting mask was added.

[0065] The steps for determining the target lighting mask include: obtaining the gaze direction vector of the virtual camera in the virtual scene; and multiplying the gaze direction vector and the light direction vector by a dot product to determine the target lighting mask.

[0066] For example, the virtual camera's gaze direction vector and the ray direction vector are as follows: Figure 10 As shown in the diagram, the dot product of the line-of-sight vector and the light direction vector is used to determine the angle between the camera's line of sight and the light source. Based on the angle, the target lighting mask is determined. This disclosure improves the accuracy of mask generation for the target vegetation model by determining the angle between the camera and the light source.

[0067] Specifically, the target lighting mask is determined by multiplying the view direction vector and the light direction vector. This includes: if the camera's view direction is the same as the light direction, the initial vegetation model is determined to be occluded by frontal light, and a frontal lighting mask for the initial vegetation model is created; if the camera's view direction is opposite to the light direction, the initial vegetation model is determined to be penetrated by backlight, and a backlight mask for the initial vegetation model is created; the target lighting mask is determined based on the frontal lighting mask or the backlight mask.

[0068] For example, if the dot product of the view direction vector and the ray direction vector is positive, then the camera's view direction is the same as the ray direction, and the front lighting mask can be used as follows: Figure 11 As shown, the initial vegetation model is obscured by frontal light. If the dot product of the view direction vector and the light direction vector is negative, then the camera's view direction is opposite to the light direction. The backlight mask can be used as follows: Figure 12 As shown, the initial vegetation model is penetrated by backlight.

[0069] In this process, after determining the target lighting mask based on the aforementioned back lighting mask or front lighting mask, in order to further simulate the subsurface scattering effect of the initial vegetation model, the step of determining the vegetation lighting rendering layer based on the target lighting mask and the lighting gradient parameters includes: if the camera's line of sight is the same as the light direction, then the front lighting mask is fitted with the lighting gradient parameters to obtain the front vegetation lighting rendering layer; if the camera's line of sight is opposite to the light direction, then the back lighting mask is fitted with the lighting gradient parameters to obtain the back vegetation lighting rendering layer; and the front vegetation lighting rendering layer or the back vegetation lighting rendering layer is used as the vegetation lighting rendering layer.

[0070] For example, based on the target lighting mask and lighting gradient parameters, the vegetation lighting rendering layer is determined. That is, if the camera's line of sight is the same as the direction of the light, the vegetation lighting rendering layer will be determined. Figure 11 The obtained vegetation model mask and Figure 9 The vegetation model effect is fitted to obtain the frontal vegetation lighting rendering layer. The rendering effect of this frontal vegetation lighting rendering layer can be as follows: Figure 13 As shown, the rendering layer with frontal lighting is unaffected by subsurface scattering. If the camera's line of sight is opposite to the direction of the light, it will... Figure 12 The obtained vegetation model mask and Figure 9The vegetation model effect in the image is fitted to obtain the back vegetation lighting rendering layer. The rendering effect of this back vegetation lighting rendering layer can be as follows: Figure 14 As shown, the rendering layer with backlighting is affected by subsurface scattering.

[0071] Step S240: Apply the vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effect.

[0072] Specifically, after obtaining the vegetation lighting rendering layer as described above, the transparency of this rendering layer needs to be processed to obtain a more accurate target vegetation model with subsurface scattering effect. The vegetation lighting rendering layer is then applied to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effect. This process includes: obtaining the vegetation transmittance; fitting the vegetation lighting rendering layer to the vegetation transmittance to obtain a refined vegetation lighting rendering layer; fitting the refined vegetation lighting rendering layer to the material parameters in the target channel to obtain a target vegetation lighting rendering layer; and applying the target vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effect.

[0073] For example, a vegetation transmittance diagram can be like... Figure 15 As shown, by fitting and multiplying the vegetation lighting rendering layer with the vegetation transmittance, a refined leaf light transmission effect can be obtained, as shown in the figure. Figure 16 As shown, the obtained refined vegetation lighting rendering layer is output to the self-emitting channel of the BRDF lighting model and fitted with the material parameters of the BRDF lighting model to obtain the target vegetation lighting rendering layer. This target vegetation lighting rendering layer is then applied to the initial vegetation model, resulting in a target vegetation model with the desired light transmission effect. Figure 17 As shown, this disclosure applies the vegetation lighting rendering layer to the initial vegetation model through the above steps S210-S240, which can effectively reduce the development and maintenance costs and improve the generation efficiency of the target vegetation model.

[0074] In summary, the vegetation model generation method in the example embodiments of this disclosure determines the illuminated area of ​​the initial vegetation model by the light from the virtual light source; determines the lighting gradient parameters of the initial vegetation model based on its model outline parameters and illuminated area; determines a target lighting mask; and determines a vegetation lighting rendering layer based on the target lighting mask and lighting gradient parameters; and applies the vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects. On the one hand, determining the lighting gradient parameters of the initial vegetation model based on its model outline parameters and illuminated area not only saves computational resources during mobile game development but also improves the realistic rendering of subsequent subsurface scattering. On the other hand, by using the obtained vegetation lighting rendering layer based on the target lighting mask and lighting gradient parameters, the maintenance cost of the vegetation rendering environment is reduced while improving the lighting simulation efficiency in the target vegetation model.

[0075] It should be noted that although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0076] Furthermore, in this example embodiment, a vegetation model generation apparatus is also provided. (Refer to...) Figure 18 As shown, the vegetation model generation device 1800 includes: a first determining unit 1810, a second determining unit 1820, a third determining unit 1830, and a fourth determining unit 1840.

[0077] Specifically, the first determining unit 1810 is used to determine the illuminated area of ​​the virtual light source on the initial vegetation model;

[0078] The second determining unit 1820 is used to determine the illumination gradient parameters of the initial vegetation model based on the model outline parameters and the illumination area of ​​the initial vegetation model.

[0079] The third determining unit 1830 is used to determine the target lighting mask and determine the vegetation lighting rendering layer based on the target lighting mask and the lighting gradient parameters.

[0080] The fourth determining unit 1840 is used to apply the vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effect.

[0081] In summary, in this example embodiment, the first determining unit 1810 determines the illumination area of ​​the virtual light source illuminating the initial vegetation model; the second determining unit 1820 determines the illumination gradient parameters of the initial vegetation model based on the model outline parameters and illumination area; the third determining unit 1830 determines the target illumination mask and, based on the target illumination mask and illumination gradient parameters, determines the vegetation illumination rendering layer; and the fourth determining unit 1840 applies the vegetation illumination rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering illumination effects. On the one hand, determining the illumination gradient parameters of the initial vegetation model based on the model outline parameters and illumination area not only saves computational resources during mobile game development but also improves the realistic rendering of subsequent subsurface scattering. On the other hand, by using the obtained vegetation illumination rendering layer based on the target illumination mask and illumination gradient parameters, the maintenance cost of the vegetation rendering environment is reduced while improving the lighting simulation efficiency in the target vegetation model.

[0082] In some example embodiments of this disclosure, based on the foregoing scheme, the first determining unit includes: a first acquiring module, used to acquire the normal direction and the ray direction of the initial vegetation model; a first determining module, used to determine the ray direction vector of the ray direction and the normal direction vector of the normal direction; and a second determining module, used to obtain the illuminated area of ​​the initial vegetation model based on the ray direction vector and the normal direction vector.

[0083] In some example embodiments of this disclosure, based on the foregoing scheme, the third determining unit includes: a second acquisition module, used to acquire the gaze direction vector of the virtual camera gaze direction in the virtual scene; and a third determining module, used to perform a dot product of the gaze direction vector and the light direction vector to determine the target lighting mask.

[0084] In some example embodiments of this disclosure, based on the foregoing scheme, the third determining module includes: a first determining submodule, configured to determine that the initial vegetation model is occluded by frontal light if the camera's line of sight is the same as the light direction, and to create a frontal illumination mask for the initial vegetation model; a second determining submodule, configured to determine that the initial vegetation model is penetrated by backlight if the camera's line of sight is opposite to the light direction, and to create a backlight mask for the initial vegetation model; and a third determining submodule, configured to determine a target illumination mask based on the frontal illumination mask or the backlight mask.

[0085] In some example embodiments of this disclosure, based on the aforementioned scheme, the third determining unit includes: a first fitting module, used to fit the front lighting mask with the lighting gradient parameters to obtain a front vegetation lighting rendering layer if the camera's line of sight is the same as the light direction; a second fitting module, used to fit the back lighting mask with the lighting gradient parameters to obtain a back vegetation lighting rendering layer if the camera's line of sight is opposite to the light direction; and a fourth determining module, used to use either the front vegetation lighting rendering layer or the back vegetation lighting rendering layer as the vegetation lighting rendering layer.

[0086] In some example embodiments of this disclosure, based on the aforementioned scheme, the fourth determining unit includes: a third acquisition module, used to acquire vegetation transmittance, and fit the vegetation lighting rendering layer with the vegetation transmittance to obtain a refined vegetation lighting rendering layer; a third fitting module, used to fit the refined vegetation lighting rendering layer with the material parameters in the target channel to obtain a target vegetation lighting rendering layer; and a fifth determining module, used to apply the target vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effect.

[0087] In some example embodiments of this disclosure, based on the foregoing scheme, the apparatus further includes: a fifth determining unit, configured to determine the depth distance between the center position of the vegetation model and the edge position of the vegetation model before determining the illumination gradient parameters of the initial vegetation model based on the model contour parameters and illumination area of ​​the initial vegetation model; and a sixth determining unit, configured to use the depth distance as the model contour parameter.

[0088] The specific details of each module of the vegetation model generation device mentioned above have been described in detail in the corresponding vegetation model generation method, so they will not be repeated here.

[0089] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0090] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0091] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0092] In exemplary embodiments of this disclosure, a computer storage medium capable of implementing the above-described methods is also provided. It stores a program product capable of implementing the methods described in this specification. In some possible embodiments, various aspects of this disclosure can also be implemented as a program product comprising program code. When the program product is run on a terminal device, the program code causes the terminal device to execute the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the following steps may be performed: determining the illumination area of ​​a virtual light source illuminating an initial vegetation model; determining illumination gradient parameters of the initial vegetation model based on its model outline parameters and illumination area; determining a target illumination mask and, based on the target illumination mask and illumination gradient parameters, determining a vegetation illumination rendering layer; and applying the vegetation illumination rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering illumination effects.

[0093] In one optional implementation, determining the illuminated area of ​​the virtual light source illuminating the initial vegetation model includes: obtaining the normal direction of the initial vegetation model and the light direction of the light rays; determining the light direction vector of the light ray direction and the normal direction vector of the normal direction; and obtaining the illuminated area of ​​the initial vegetation model based on the light direction vector and the normal direction vector.

[0094] In one optional implementation, determining the target lighting mask includes: obtaining a gaze direction vector of a virtual camera's gaze direction in the virtual scene; and performing a dot product between the gaze direction vector and the ray direction vector to determine the target lighting mask.

[0095] In one optional implementation, the target lighting mask is determined by multiplying the view direction vector and the light direction vector. This includes: if the camera view direction is the same as the light direction, then the initial vegetation model is determined to be occluded by frontal light, and a frontal lighting mask of the initial vegetation model is created; if the camera view direction is opposite to the light direction, then the initial vegetation model is determined to be penetrated by backlight, and a backlight mask of the initial vegetation model is created; and the target lighting mask is determined based on the frontal lighting mask or the backlight mask.

[0096] In one optional implementation, determining the vegetation lighting rendering layer based on the target lighting mask and lighting gradient parameters includes: if the camera's line of sight is the same as the light direction, then fitting the front lighting mask with the lighting gradient parameters to obtain the front vegetation lighting rendering layer; if the camera's line of sight is opposite to the light direction, then fitting the back lighting mask with the lighting gradient parameters to obtain the back vegetation lighting rendering layer; and using either the front vegetation lighting rendering layer or the back vegetation lighting rendering layer as the vegetation lighting rendering layer.

[0097] In one optional implementation, applying a vegetation lighting rendering layer to an initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects includes: obtaining vegetation transmittance; fitting the vegetation lighting rendering layer to the vegetation transmittance to obtain a refined vegetation lighting rendering layer; fitting the refined vegetation lighting rendering layer to material parameters in a target channel to obtain a target vegetation lighting rendering layer; and applying the target vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects.

[0098] In an optional implementation, before determining the illumination gradient parameters of the initial vegetation model based on the model contour parameters and the illumination area of ​​the initial vegetation model, the method further includes: determining the depth distance between the center position of the vegetation model and the edge position of the vegetation model; and using the depth distance as the model contour parameter.

[0099] In an optional embodiment, the present disclosure may further include a program product for implementing the above-described methods. This program product may be a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0100] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0101] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0102] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0103] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0104] Furthermore, in an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.

[0105] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."

[0106] The following reference Figure 19 To describe an electronic device 1900 according to such an embodiment of the present disclosure. Figure 19 The electronic device 1900 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.

[0107] like Figure 19As shown, the electronic device 1900 is manifested in the form of a general-purpose computing device. The components of the electronic device 1900 may include, but are not limited to: at least one processing unit 1910, at least one storage unit 1920, a bus 1930 connecting different system components (including storage unit 1920 and processing unit 1910), and a display unit 1940.

[0108] The storage unit stores program code, which can be executed by the processing unit 1910 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 1910 can perform the following steps: determining the illumination area of ​​the virtual light source illuminating the initial vegetation model; determining the illumination gradient parameters of the initial vegetation model based on the model outline parameters and illumination area; determining a target illumination mask, and determining a vegetation illumination rendering layer based on the target illumination mask and illumination gradient parameters; applying the vegetation illumination rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering illumination effects.

[0109] In one optional implementation, determining the illuminated area of ​​the virtual light source illuminating the initial vegetation model includes: obtaining the normal direction of the initial vegetation model and the light direction of the light rays; determining the light direction vector of the light ray direction and the normal direction vector of the normal direction; and obtaining the illuminated area of ​​the initial vegetation model based on the light direction vector and the normal direction vector.

[0110] In one optional implementation, determining the target lighting mask includes: obtaining a gaze direction vector of a virtual camera's gaze direction in the virtual scene; and performing a dot product between the gaze direction vector and the ray direction vector to determine the target lighting mask.

[0111] In one optional implementation, the target lighting mask is determined by multiplying the view direction vector and the light direction vector. This includes: if the camera view direction is the same as the light direction, then the initial vegetation model is determined to be occluded by frontal light, and a frontal lighting mask of the initial vegetation model is created; if the camera view direction is opposite to the light direction, then the initial vegetation model is determined to be penetrated by backlight, and a backlight mask of the initial vegetation model is created; and the target lighting mask is determined based on the frontal lighting mask or the backlight mask.

[0112] In one optional implementation, determining the vegetation lighting rendering layer based on the target lighting mask and lighting gradient parameters includes: if the camera's line of sight is the same as the light direction, then fitting the front lighting mask with the lighting gradient parameters to obtain the front vegetation lighting rendering layer; if the camera's line of sight is opposite to the light direction, then fitting the back lighting mask with the lighting gradient parameters to obtain the back vegetation lighting rendering layer; and using either the front vegetation lighting rendering layer or the back vegetation lighting rendering layer as the vegetation lighting rendering layer.

[0113] In one optional implementation, applying a vegetation lighting rendering layer to an initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects includes: obtaining vegetation transmittance; fitting the vegetation lighting rendering layer to the vegetation transmittance to obtain a refined vegetation lighting rendering layer; fitting the refined vegetation lighting rendering layer to material parameters in a target channel to obtain a target vegetation lighting rendering layer; and applying the target vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effects.

[0114] In an optional implementation, before determining the illumination gradient parameters of the initial vegetation model based on the model contour parameters and the illumination area of ​​the initial vegetation model, the method further includes: determining the depth distance between the center position of the vegetation model and the edge position of the vegetation model; and using the depth distance as the model contour parameter.

[0115] Storage unit 1920 may include readable media in the form of volatile storage units, such as random access memory (RAM) 19201 and / or cache memory 19202, and may further include read-only memory (ROM) 19203.

[0116] Storage unit 1920 may also include a program / utility 19204 having a set (at least one) of program modules 19205, such program modules 19205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0117] Bus 1930 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0118] Electronic device 1900 can also communicate with one or more external devices 2000 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with electronic device 1900, and / or any device that enables electronic device 1900 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1950. Furthermore, electronic device 1900 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 1960. As shown, network adapter 1960 communicates with other modules of electronic device 1900 via bus 1930. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 1900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0119] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0120] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0121] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

Claims

1. A method for generating a vegetation model, characterized in that, The method of providing a virtual light source and an initial vegetation model in a virtual scene includes: Determine the illuminated area of ​​the virtual light source on the initial vegetation model; Determine the depth distance between the center position and the edge position of the initial vegetation model, and use the depth distance as the model contour parameter of the initial vegetation model; The illumination gradient parameters of the initial vegetation model are determined based on the model contour parameters of the initial vegetation model and the illumination area. Determine the target lighting mask, and determine the vegetation lighting rendering layer based on the target lighting mask and the lighting gradient parameters; The vegetation lighting rendering layer is applied to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effect. The step of determining the target lighting mask and determining the vegetation lighting rendering layer based on the target lighting mask and the lighting gradient parameters includes: Determine whether the direction of the virtual camera's line of sight in the virtual scene is the same as the direction of the light from the virtual light source; If the camera's line of sight is the same as the light direction, then it is determined that the initial vegetation model is occluded by the frontal light, and a frontal lighting mask of the initial vegetation model is created. If the camera's line of sight is opposite to the direction of the light, then it is determined that the initial vegetation model is penetrated by backlight, and a backlight mask of the initial vegetation model is created; The target lighting mask is determined based on the front lighting mask or the back lighting mask; The target lighting mask is fitted with the lighting gradient parameters to obtain the vegetation lighting rendering layer.

2. The method according to claim 1, characterized in that, Determining the illuminated area of ​​the virtual light source on the initial vegetation model includes: Obtain the normal direction of the initial vegetation model and the ray direction of the light. Determine the ray direction vector of the ray direction and the normal direction vector of the normal direction; The illuminated area of ​​the initial vegetation model is obtained based on the light direction vector and the normal direction vector.

3. The method according to claim 2, characterized in that, The step of determining whether the line of sight of the virtual camera in the virtual scene is the same as the direction of light from the virtual light source includes: Obtain the gaze direction vector of the virtual camera in the virtual scene; The dot product of the gaze direction vector and the light direction vector is used to determine whether the gaze direction of the virtual camera in the virtual scene is the same as the light direction of the virtual light source.

4. The method according to claim 1, characterized in that, Based on the target lighting mask and the lighting gradient parameters, the vegetation lighting rendering layer is determined to include: If the camera's line of sight is the same as the light direction, then the front lighting mask is fitted with the lighting gradient parameters to obtain the front vegetation lighting rendering layer. If the camera's line of sight is opposite to the direction of the light, then the back lighting mask is fitted with the lighting gradient parameters to obtain the back vegetation lighting rendering layer. The front vegetation lighting rendering layer or the back vegetation lighting rendering layer is used as the vegetation lighting rendering layer.

5. The method according to claim 1, characterized in that, Applying the vegetation lighting rendering layer to the initial vegetation model yields a target vegetation model with subsurface scattering lighting effects, including: The vegetation transmittance is obtained, and the vegetation lighting rendering layer is fitted with the vegetation transmittance to obtain a refined vegetation lighting rendering layer. The refined vegetation lighting rendering layer is fitted with the material parameters in the target channel to obtain the target vegetation lighting rendering layer. The target vegetation lighting rendering layer is applied to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effect.

6. A vegetation model generating device, characterized in that, The device provides a virtual light source and an initial vegetation model in a virtual scene, comprising: The first determining unit is used to determine the illuminated area of ​​the virtual light source on the initial vegetation model; The second determining unit is used to determine the depth distance between the center position of the initial vegetation model and the edge position of the initial vegetation model, and to use the depth distance as the model contour parameter of the initial vegetation model; and to determine the illumination gradient parameter of the initial vegetation model based on the model contour parameter of the initial vegetation model and the illumination area. The third determining unit is used to determine the target lighting mask and, based on the target lighting mask and the lighting gradient parameters, determine the vegetation lighting rendering layer. The fourth determining unit is used to apply the vegetation lighting rendering layer to the initial vegetation model to obtain a target vegetation model with subsurface scattering lighting effect. The third determining unit is configured as follows: Determine whether the direction of the virtual camera's line of sight in the virtual scene is the same as the direction of the light from the virtual light source; If the camera's line of sight is the same as the light direction, then it is determined that the initial vegetation model is occluded by the frontal light, and a frontal lighting mask of the initial vegetation model is created. If the camera's line of sight is opposite to the direction of the light, then it is determined that the initial vegetation model is penetrated by backlight, and a backlight mask of the initial vegetation model is created; The target lighting mask is determined based on the front lighting mask or the back lighting mask; The target lighting mask is fitted with the lighting gradient parameters to obtain the vegetation lighting rendering layer.

7. An electronic device, comprising: processor; as well as A memory storing computer-readable instructions that, when executed by the processor, implement the vegetation model generation method as described in any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the vegetation model generation method as described in any one of claims 1 to 5.