A method and device for rendering shadow effect of semi-transparent object

By constructing light and determining whether the scene points fall into the shadow of the translucent object, combining the light transmission information and light source energy to determine the target lighting energy, the problem of low efficiency in rendering the shadow of the translucent object in the prior art is solved, and efficient rendering effect is achieved.

CN114972606BActive Publication Date: 2025-03-14BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210812470.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-28
Publication Date
2025-03-14
Estimated Expiration
2041-06-28

AI Technical Summary

Technical Problem

The prior art when rendering the shadow effect of semi-transparent objects, the rendering efficiency is low and there is a problem of high computing overhead.

Method used

By constructing the first light from the scene point in the virtual scene toward the light source, it is judged whether the scene point falls into the shadow of the translucent object, and determines the target light energy based on the light transmission information of the translucent object and the light source energy of the light source, and renders the scene point according to this energy.

Benefits of technology

The shadow effect of calculating translucent objects is realized with a smaller calculation amount, reducing calculation overhead and improving rendering efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114972606B_ABST
    Figure CN114972606B_ABST
Patent Text Reader

Abstract

The present application relates to a method and device for rendering the shadow effect of a semi-transparent object, the method comprising: constructing a first light ray from a scene point in a virtual scene to a light source direction in the virtual scene, the scene point being located outside the semi-transparent object; determining whether the scene point falls into the shadow of the semi-transparent object according to the intersection of the first light ray and the semi-transparent object; in the case where it is determined that the scene point falls into the shadow of the semi-transparent object according to the intersection of the first light ray and the semi-transparent object, determining the target illumination energy corresponding to the scene point according to the light transmission information of the semi-transparent object and the light source energy of the light source; and rendering the scene point according to the target illumination energy. The present application solves the technical problem of low rendering efficiency when rendering the shadow effect of a semi-transparent object on a screen.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of application number: 202110719139.1 Technical Field

[0002] The present application relates to the field of computers, and in particular to a method and device for rendering shadow effects of a semi-transparent object. Background Art

[0003] With the development of the Internet, the performance requirements for image rendering are getting higher and higher. In the current rendering technology, if there are translucent objects in the virtual scene to be rendered, the shadow effect of the translucent object needs to be rendered.

[0004] In the current rendering method, one way to render the shadow effect of a translucent object is to emit a ray from the observation point to intersect with a point in the scene (such as the ground), emit a large number of rays from the point within a certain range of the point, and determine whether the point is within the shadow range of the translucent object based on the path of each ray. This method requires too many rays to be constructed, resulting in very low rendering efficiency. Another way to render the shadow effect of a translucent object is the photon mapping method, which emits rays from the light source to obtain the intersection with the scene, creates "photons" at the intersection to illuminate a certain range, collects photon information at the observation point, emits rays from the observation point to intersect with the scene, detects whether there are photons around, and superimposes the information of the photons to obtain the color of the point. This method requires adding steps to construct many rays from the light source to create "photons" and calculate the contribution of photons within the field of view on the basis of the original rendering process. In addition, many photons may not be within the field of view, which will waste resources and result in very low rendering efficiency.

[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0006] The present application provides a method and device for rendering the shadow effect of a semi-transparent object, so as to at least solve the technical problem of low rendering efficiency when rendering the shadow effect of a semi-transparent object on a screen in the related art.

[0007] According to one aspect of an embodiment of the present application, a method for rendering a shadow effect of a translucent object is provided, including: constructing a first light ray from a scene point in a virtual scene toward a light source in the virtual scene, the scene point being located outside the translucent object; determining whether the scene point falls into the shadow of the translucent object based on an intersection of the first light ray and the translucent object; in a case where it is determined that the scene point falls into the shadow of the translucent object based on the intersection of the first light ray and the translucent object, determining a target lighting energy corresponding to the scene point based on light transmittance information of the translucent object and light source energy of the light source; and rendering the scene point according to the target lighting energy.

[0008] According to another aspect of an embodiment of the present application, a rendering device for a shadow effect of a translucent object is also provided, including: a construction module, used to construct a first light ray from a scene point in a virtual scene to a direction of a light source in the virtual scene, wherein the scene point is located outside the translucent object; a first determination module, used to determine whether the scene point falls into the shadow of the translucent object according to an intersection of the first light ray and the translucent object; a second determination module, used to determine a target lighting energy corresponding to the scene point according to light transmittance information of the translucent object and a light source energy of the light source, when it is determined that the scene point falls into the shadow of the translucent object according to the intersection of the first light ray and the translucent object; and a rendering module, used to render the scene point according to the target lighting energy.

[0009] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and when the program is run, the above-mentioned method for rendering the shadow effect of a semi-transparent object is executed.

[0010] According to another aspect of an embodiment of the present application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-mentioned method for rendering the shadow effect of a translucent object through the computer program.

[0011] In an embodiment of the present application, a first light ray is constructed from a scene point in a virtual scene to a direction of a light source in the virtual scene; whether the scene point falls into the shadow of the translucent object is determined based on the intersection of the first light ray and the translucent object; when it is determined that the scene point falls into the shadow of the translucent object based on the intersection of the first light ray and the translucent object, a target illumination energy corresponding to the scene point is determined based on the light transmittance information of the translucent object and the light source energy of the light source; the scene point is rendered according to the target illumination energy, and a first light ray is constructed from the scene point in the virtual scene to the direction of the light source in the virtual scene; if it is determined that the scene point falls into the shadow of the translucent object, the target illumination energy corresponding to the scene point is determined based on the light transmittance information of the translucent object and the light source energy of the light source, and the scene point is rendered according to the target illumination energy, thereby achieving the purpose of simulating and calculating the shadow effect of the translucent object with a smaller amount of calculation and reducing the calculation overhead, thereby achieving the technical effect of improving the rendering efficiency when rendering the shadow effect of the translucent object on the screen, thereby solving the technical problem of low rendering efficiency when rendering the shadow effect of the translucent object on the screen. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0013] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0014] Figure 1 is a schematic diagram of a hardware environment of a method for rendering a semi-transparent object shadow effect according to an embodiment of the present application;

[0015] Figure 2 It is a flowchart of an optional method for rendering a shadow effect of a semi-transparent object according to an embodiment of the present application;

[0016] Figure 3 is a schematic diagram of an optional rendering process of a semi-transparent object shadow effect according to an embodiment of the present application;

[0017] Figure 4 is a schematic diagram of an optional rendering device for a semi-transparent object shadow effect according to an embodiment of the present application;

[0018] Figure 5 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0021] According to one aspect of the embodiments of the present application, a method embodiment of rendering a shadow effect of a semi-transparent object is provided.

[0022] Optionally, in this embodiment, the above-mentioned method for rendering the shadow effect of a semi-transparent object can be applied to Figure 1 In the hardware environment composed of the terminal 101 and the server 103 shown in FIG. Figure 1 As shown, the server 103 is connected to the terminal 101 through a network, and can be used to provide services (such as game services, application services, etc.) to the terminal or the client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 103. The above network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, etc. The rendering method of the shadow effect of a semi-transparent object in the embodiment of the present application can be executed by the server 103, or by the terminal 101, or by the server 103 and the terminal 101. Among them, the terminal 101 executes the rendering method of the shadow effect of a semi-transparent object in the embodiment of the present application, and it can also be executed by a client installed thereon.

[0023] Figure 2 is a flowchart of an optional method for rendering a semi-transparent object shadow effect according to an embodiment of the present application, such as Figure 2 As shown, the method may include the following steps:

[0024] Step S202, constructing a first light ray from a scene point in a virtual scene toward a light source in the virtual scene; the scene point is outside the translucent object;

[0025] Step S204, determining whether the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object;

[0026] Step S206, when it is determined that the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object, determine the target illumination energy corresponding to the scene point according to the light transmittance information of the translucent object and the light source energy of the light source;

[0027] Step S208: rendering the scene point according to the target illumination energy.

[0028] Through the above steps S202 to S208, a first light beam is constructed from the scene point in the virtual scene to the direction of the light source in the virtual scene. If it is determined that the scene point falls into the shadow of a translucent object, the target illumination energy corresponding to the scene point is determined according to the light transmittance information of the translucent object and the light source energy of the light source. The scene point is rendered according to the target illumination energy, thereby achieving the purpose of simulating and calculating the shadow effect of the translucent object with a smaller amount of calculation and reducing the calculation overhead, thereby achieving the technical effect of improving the rendering efficiency when rendering the shadow effect of the translucent object on the screen, and further solving the technical problem of low rendering efficiency when rendering the shadow effect of the translucent object on the screen.

[0029] In the technical solution provided in step S202, the above virtual scene may include but is not limited to game scenes, animation scenes, etc.

[0030] Optionally, in this embodiment, the light source in the virtual scene may include but is not limited to one or more light sources, and the first light may be constructed in the direction of each light source. The shadow effect of the translucent object in the virtual scene may be a superposition effect under all light sources.

[0031] In an embodiment, a rendering process of a shadow effect of a semi-transparent object in a virtual scene is provided. Figure 3 It is a schematic diagram of an optional rendering process of a shadow effect according to an embodiment of the present application, in which a light ray B is constructed from a scene point M in a virtual scene toward the light source direction of the virtual scene.

[0032] As an optional embodiment, constructing a first light ray from a scene point in a virtual scene to a light source direction in the virtual scene includes:

[0033] S11, constructing a second light ray directed toward the virtual scene along a direction from an observation point to a pixel point on the image to be rendered;

[0034] S12, determining an intersection point between the second light ray and the virtual scene as the scene point;

[0035] S13: construct a ray from the scene point toward the light source to obtain the first ray.

[0036] Optionally, in this embodiment, the scene point to be rendered on the image to be rendered can be found from the virtual scene by emitting light from the observation point to the pixel point on the image to be rendered, but is not limited to, and then a light ray is constructed from the scene point to be rendered toward the light source.

[0037] For example: Figure 3As shown, along the direction from the observation point to the pixel point on the screen to be rendered, a ray A is constructed to be directed into the virtual scene, the intersection point between the ray A and the virtual scene is determined as the scene point M, and then a ray B is constructed from the scene point M to the direction of the light source.

[0038] In the technical solution provided in step S204, if the first light intersects with the translucent object, it can be determined that the scene point falls into the shadow of the translucent object; if the first light does not intersect with the translucent object, it can be determined that the scene point does not fall into the shadow of the translucent object.

[0039] In the technical solution provided in step S206, the light transmittance information of the translucent object may include but is not limited to: the opacity of the translucent object, the light absorption rate of the translucent object, etc.

[0040] Optionally, in this embodiment, the influence of the semi-transparent object on the illumination energy received by the scene point can be determined according to the light transmittance information of the semi-transparent object. The target illumination energy is the illumination energy received by the scene point under the influence of the semi-transparent object.

[0041] As an optional embodiment, determining the target illumination energy corresponding to the scene point according to the light transmittance information of the semi-transparent object and the light source energy of the light source includes one of the following:

[0042] S21, determining the target illumination energy according to the opacity of the translucent object, the number of intersections between the first light and the translucent object, and the light source energy;

[0043] S22, determining the target illumination energy according to the light absorptivity of the translucent object, the distance that the first light ray passes through the translucent object, and the light source energy.

[0044] Optionally, in this embodiment, a method for determining the target illumination energy of a scene point is to use the opacity of a translucent object, the number of intersections of the first light ray with the translucent object, and the light source energy of the light source for calculation. According to the opacity of the translucent object and the number of intersections of the first light ray with the translucent object, the attenuation ratio of the light source energy of the light source in the translucent object can be determined, and the difference between the light source energy and the energy of the attenuation ratio (or energy loss value) is the target illumination energy. For example: the product of the opacity, the number of intersections and the light source energy is determined as the energy loss value; the difference between the light source energy and the energy loss value is determined as the target illumination energy.

[0045] Optionally, in this embodiment, another way to determine the target illumination energy of the scene point is to calculate using the light absorption rate of the translucent object, the distance that the first light ray passes through the translucent object, and the light source energy of the light source. The residual energy ratio can be obtained according to the light absorption rate of the translucent object and the distance that the first light ray passes through the translucent object, and the product of the residual energy ratio and the light source energy of the light source is the target illumination energy.

[0046] As an optional embodiment, determining the target illumination energy according to the opacity of the translucent object, the number of intersections between the first light and the translucent object, and the light source energy includes:

[0047] S31, determining the product value of the opacity and the number of intersections as the energy attenuation ratio;

[0048] S32, determining the difference between 1 and the energy attenuation ratio as the remaining energy ratio;

[0049] S33: Determine the product value of the remaining energy ratio and the light source energy as the target illumination energy.

[0050] Optionally, in this embodiment, the target illumination energy LM can be determined by but is not limited to the following formula, that is, LM = (1-n×Opacity)×L, where n is the number of intersections of the first light ray with the translucent object, Opacity is the opacity of the translucent object, and L is the light source energy.

[0051] As an optional embodiment, determining the target illumination energy according to the light absorption rate of the translucent object, the distance that the first light passes through the translucent object, and the light source energy includes:

[0052] S41, multiplying the absorption rate by the distance to obtain a target parameter value;

[0053] S42, calculating the exponential function value of the target parameter value;

[0054] S43, multiplying the exponential function value by the light source energy to obtain the target illumination energy.

[0055] Optionally, in this embodiment, the target illumination energy LM can be determined by but is not limited to the following formula, that is, LM=exp(Ab·dis)·L, wherein Ab is the absorption rate of light by the translucent object, dis is the distance that the first light ray passes through the translucent object, exp(Ab·dis) is the exponential function value of the target parameter value, and L is the light source energy.

[0056] As an optional embodiment, determining the target illumination energy corresponding to the scene point according to the light transmittance information of the semi-transparent object and the light source energy includes:

[0057] S51, determining intermediate illumination energy according to the light transmittance information of the translucent object and the light source energy;

[0058] S52, calculating the dot product of the first light ray and the surface normal of the translucent object at each intersection point of the first light ray and the translucent object to obtain a plurality of dot product values;

[0059] S53: Determine the target illumination energy by multiplying the intermediate illumination energy by the plurality of dot product values.

[0060] Optionally, in this embodiment, in order to make the shadow effect of the translucent object more accurate and realistic, the caustic effect can also be simulated in the rendering of the shadow part. On the basis of obtaining the illumination energy LM received by the above scene point M, LM is used as the intermediate illumination energy, and the dot product of the light ray B and the surface normal of the translucent object at each intersection point of the light ray B and the translucent object is calculated, and the intermediate illumination energy LM is multiplied with the dot product value obtained at each intersection point as the final target illumination energy of the scene point M.

[0061] For example, if light B and a translucent object have two intersection points, two dot product values ​​dot1 and dot2 are calculated, then the target illumination energy LM of scene point M is final =LM×dot1×dot2.

[0062] In the technical solution provided in step S208, the scene points may be rendered to corresponding pixel points on the to-be-rendered picture according to the target illumination energy, but are not limited to the rendering.

[0063] As an optional embodiment, rendering the scene point according to the target illumination energy includes:

[0064] S61, determining the pixel point as a position corresponding to the scene point on the image to be rendered;

[0065] S62: Render the pixel points on the picture to be rendered using the target illumination energy to obtain a rendered picture.

[0066] Optionally, in this embodiment, the pixel point where the second light ray intersects with the to-be-rendered picture is the position of the scene point constructed by rendering the first light ray. The pixel point is rendered on the to-be-rendered picture using the target illumination energy to obtain a rendered picture.

[0067] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0068] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for an electronic device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0069] According to another aspect of an embodiment of the present application, a device for rendering shadow effects for implementing the above-mentioned method for rendering shadow effects of a semi-transparent object is also provided. Figure 4 is a schematic diagram of an optional shadow effect rendering device according to an embodiment of the present application, such as Figure 4 As shown, the device may include:

[0070] A construction module 42, configured to construct a first light ray from a scene point in a virtual scene to a direction of a light source in the virtual scene; the scene point is located outside the translucent object;

[0071] A first determination module 44, configured to determine whether the scene point falls into a shadow of the translucent object according to an intersection of the first light and the translucent object;

[0072] A second determination module 46 is used to determine the target illumination energy corresponding to the scene point according to the light transmittance information of the translucent object and the light source energy of the light source, when it is determined that the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object;

[0073] The rendering module 48 is used to render the scene point according to the target illumination energy.

[0074] It should be noted that the construction module 42 in this embodiment can be used to execute step S202 in the embodiment of the present application, the first determination module 44 in this embodiment can be used to execute step S204 in the embodiment of the present application, the second determination module 46 in this embodiment can be used to execute step S206 in the embodiment of the present application, and the rendering module 48 in this embodiment can be used to execute step S208 in the embodiment of the present application.

[0075] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware.

[0076] Through the above-mentioned module, a first light beam is constructed from a scene point in a virtual scene toward a light source in the virtual scene. If it is determined that the scene point falls into the shadow of a translucent object, the target illumination energy corresponding to the scene point is determined according to the light transmittance information of the translucent object and the light source energy of the light source. The scene point is rendered according to the target illumination energy, thereby achieving the purpose of simulating and calculating the shadow effect of the translucent object with a smaller amount of calculation and reducing the calculation overhead, thereby realizing the technical effect of improving the rendering efficiency when rendering the shadow effect of the translucent object on the screen, and further solving the technical problem of low rendering efficiency when rendering the shadow effect of the translucent object on the screen.

[0077] As an optional embodiment, the second determining module includes one of the following:

[0078] a first determining unit, configured to determine the target illumination energy according to the opacity of the translucent object, the number of intersections between the first light and the translucent object, and the light source energy;

[0079] The second determination unit is used to determine the target illumination energy according to the light absorption rate of the translucent object, the distance that the first light ray passes through the translucent object, and the light source energy.

[0080] As an optional embodiment, the first determining unit is configured to:

[0081] Determine the product value of the opacity and the number of intersections as the energy attenuation ratio;

[0082] Determine the difference between 1 and the energy decay ratio as the remaining energy ratio;

[0083] The product value of the remaining energy ratio and the light source energy is determined as the target illumination energy.

[0084] As an optional embodiment, the second determining unit is configured to:

[0085] Multiplying the absorption rate by the distance to obtain a target parameter value;

[0086] Calculating an exponential function value of the target parameter value;

[0087] The exponential function value is multiplied by the light source energy to obtain the target illumination energy.

[0088] As an optional embodiment, the second determining module includes:

[0089] A third determining unit, configured to determine an intermediate illumination energy according to the light transmittance information of the translucent object and the light source energy;

[0090] a calculation unit, configured to calculate a dot product of the first light ray and a surface normal of the translucent object at each intersection point of the first light ray and the translucent object to obtain a plurality of dot product values;

[0091] The fourth determining unit is used to determine the product of the intermediate illumination energy and the multiple point product values ​​as the target illumination energy.

[0092] As an optional embodiment, the building module includes:

[0093] A first construction unit is used to construct a second light ray directed toward the virtual scene along a direction from an observation point to a pixel point on a to-be-rendered picture;

[0094] a fifth determining unit, configured to determine an intersection point between the second light ray and the virtual scene as the scene point;

[0095] The second construction unit is used to construct a ray from the scene point to the light source direction to obtain the first ray.

[0096] As an optional embodiment, the rendering module includes:

[0097] A sixth determining unit, configured to determine the pixel point as a position corresponding to the scene point on the picture to be rendered;

[0098] A rendering unit is used to render the pixel points on the to-be-rendered picture using the target illumination energy to obtain a rendered picture.

[0099] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.

[0100] According to another aspect of an embodiment of the present application, an electronic device for implementing the above-mentioned method for rendering the shadow effect of a semi-transparent object is also provided.

[0101] Figure 5 is a structural block diagram of an electronic device according to an embodiment of the present application, such as Figure 5 As shown, the electronic device may include: one or more (only one is shown in the figure) processors 501, a memory 503, and a transmission device 505, such as Figure 5 As shown, the electronic device may further include an input / output device 507 .

[0102] Among them, the memory 503 can be used to store software programs and modules, such as the program instructions / modules corresponding to the rendering method and device of the semi-transparent object shadow effect in the embodiment of the present application. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 503, that is, the rendering method of the semi-transparent object shadow effect is realized. The memory 503 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 503 may further include a memory remotely arranged relative to the processor 501, and these remote memories can be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0103] The above-mentioned transmission device 505 is used to receive or send data via a network, and can also be used for data transmission between a processor and a memory. The above-mentioned network specific examples may include wired networks and wireless networks. In one example, the transmission device 505 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 505 is a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.

[0104] Specifically, the memory 503 is used to store application programs.

[0105] The processor 501 may call the application stored in the memory 503 through the transmission device 505 to perform the following steps:

[0106] Constructing a first light ray from a scene point in a virtual scene toward a light source in the virtual scene;

[0107] determining whether the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object;

[0108] In a case where it is determined that the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object, a target illumination energy corresponding to the scene point is determined according to light transmittance information of the translucent object and light source energy of the light source;

[0109] The scene point is rendered according to the target lighting energy.

[0110] By using the embodiment of the present application, a scheme for rendering shadow effects is provided. A first light ray is constructed from a scene point in a virtual scene toward a light source in the virtual scene. If it is determined that the scene point falls into the shadow of a translucent object, the target illumination energy corresponding to the scene point is determined according to the light transmittance information of the translucent object and the light source energy of the light source. The scene point is rendered according to the target illumination energy, so as to achieve the purpose of simulating and calculating the shadow effect of the translucent object with a smaller amount of calculation and reducing the calculation overhead, thereby achieving the technical effect of improving the rendering efficiency when rendering the shadow effect of the translucent object on the screen, and further solving the technical problem of low rendering efficiency when rendering the shadow effect of the translucent object on the screen.

[0111] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0112] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only, and the electronic device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other electronic devices. Figure 5 The structure of the electronic device is not limited. Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations are shown.

[0113] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the electronic device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0114] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to execute the program code of the method for rendering the shadow effect of a semi-transparent object.

[0115] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.

[0116] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0117] Constructing a first light ray from a scene point in a virtual scene toward a light source in the virtual scene;

[0118] determining whether the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object;

[0119] In a case where it is determined that the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object, a target illumination energy corresponding to the scene point is determined according to light transmittance information of the translucent object and light source energy of the light source;

[0120] The scene point is rendered according to the target lighting energy.

[0121] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0122] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0123] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0124] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0125] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0126] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0127] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0128] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0129] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for rendering a shadow effect of a semi-transparent object, characterized in that: include: Constructing a first light ray from a scene point in a virtual scene toward a light source in the virtual scene, wherein the scene point is outside the semi-transparent object; determining whether the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object; In a case where it is determined that the scene point falls into the shadow of the translucent object according to the intersection of the first light and the translucent object, a target illumination energy corresponding to the scene point is determined according to light transmittance information of the translucent object and light source energy of the light source; Rendering the scene point according to the target illumination energy; Wherein, determining the target illumination energy corresponding to the scene point according to the light transmittance information of the translucent object and the light source energy includes: determining the intermediate illumination energy according to the light transmittance information of the translucent object and the light source energy; calculating the dot product of the first light ray and the surface normal of the translucent object at each intersection point of the first light ray and the translucent object to obtain multiple dot product values; and determining the product of the intermediate illumination energy and the multiple dot product values ​​as the target illumination energy; Wherein, determining the intermediate illumination energy according to the light transmittance information of the translucent object and the light source energy includes one of the following: The product value of the opacity of the semi-transparent object and the number of intersections between the first light and the semi-transparent object is determined as the energy attenuation ratio; the difference between 1 and the energy attenuation ratio is determined as the remaining energy ratio; the product value of the remaining energy ratio and the light source energy is determined as the intermediate illumination energy; The light absorption rate of the translucent object is multiplied by the distance that the first light ray passes through the translucent object to obtain a target parameter value; an exponential function value of the target parameter value is calculated; and the exponential function value is multiplied by the light source energy to obtain the intermediate illumination energy.

2. The method according to claim 1, characterized in that Constructing a first light ray from a scene point in a virtual scene to a light source direction in the virtual scene comprises: Constructing a second light ray directed toward the virtual scene along a direction from an observation point to a pixel point on the image to be rendered; determining an intersection point between the second light ray and the virtual scene as the scene point; A ray is constructed from the scene point toward the light source to obtain the first ray.

3. The method according to claim 2, characterized in that Rendering the scene point according to the target illumination energy includes: Determine the pixel point as the position corresponding to the scene point on the picture to be rendered; The pixel points are rendered on the to-be-rendered picture using the target illumination energy to obtain a rendered picture.

4. A rendering device for a semi-transparent object shadow effect, characterized in that: include: A construction module, configured to construct a first light ray from a scene point in a virtual scene to a direction of a light source in the virtual scene, wherein the scene point is outside the translucent object; a first determining module, configured to determine whether the scene point falls into a shadow of the translucent object according to an intersection of the first light and the translucent object; a second determination module, configured to determine a target illumination energy corresponding to the scene point according to light transmittance information of the translucent object and light source energy of the light source, when it is determined that the scene point falls into a shadow of the translucent object according to the intersection of the first light ray and the translucent object; A rendering module, used for rendering the scene point according to the target illumination energy; The second determination module includes: a third determination unit, configured to determine the intermediate illumination energy corresponding to the scene point according to the light transmittance information of the translucent object and the light source energy; a calculation unit, configured to calculate the dot product of the first light ray and the surface normal of the translucent object at each intersection point of the first light ray and the translucent object to obtain a plurality of dot product values; and a fourth determination unit, configured to determine the product of the intermediate illumination energy and the plurality of dot product values ​​as the target illumination energy. The third determining unit includes one of the following: a first determining unit, configured to determine the product of the opacity of the translucent object and the number of intersections of the first light ray with the translucent object as an energy attenuation ratio; determine the difference between 1 and the energy attenuation ratio as a residual energy ratio; and determine the product of the residual energy ratio and the light source energy as the intermediate illumination energy; The second determination unit is used to multiply the light absorption rate of the translucent object by the distance that the first light passes through the translucent object to obtain a target parameter value; calculate the exponential function value of the target parameter value; and multiply the exponential function value by the light source energy to obtain the intermediate illumination energy.

5. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program, when running, executes the method for rendering the shadow effect of a semi-transparent object as described in any one of claims 1 to 3 above.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: The processor executes the method for rendering the shadow effect of a semi-transparent object as described in any one of claims 1 to 3 through the computer program.

Citation Information

Patent Citations

  • Rendering method and device and electronic equipment

    CN112819940A

  • Shading of translucent objects

    US20090096803A1