Scene rendering method, device, storage medium and electronic device

By using the two sampling method in the rendering virtual scene, combining larger and smaller steps to determine the intersection points, the accuracy and efficiency problems caused by fixed step sampling are solved, and a more realistic optical display effect is achieved.

CN117036577BActive Publication Date: 2024-12-17LIJIE SHANGHAI INFORMATION TECH LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202310821019.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-05
Publication Date
2024-12-17
Estimated Expiration
2043-07-05

AI Technical Summary

Technical Problem

During rendering virtual scenes, the fixed step size sampling method leads to low accuracy or low efficiency of real light source points.

Method used

The two-sampling method is used, first determine the candidate intersection point according to the larger step size, and then perform the secondary sampling according to the smaller step size to determine the target intersection point to ensure the accuracy and efficiency of the intersection point.

Benefits of technology

On the basis of ensuring efficiency, accurately determine the target intersection point, thereby improving the authenticity of the optical display effect and bringing a better visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117036577B_ABST
    Figure CN117036577B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a scene rendering method, device, storage medium and electronic device, and to the field of rendering technology. The method includes: sampling points on a target light ray in a target scene according to a first preset step length to determine a first candidate intersection point; a first depth distance between the first candidate intersection point and a first object point is less than or equal to a preset distance threshold; a second preset step length is less than the first preset step length; determining a target intersection point according to the first candidate intersection point and the second candidate intersection point; determining a target color corresponding to a target reflection point according to the scene color corresponding to the target intersection point and the target scene; rendering the target scene according to the target intersection point, the target reflection point and the target color. In this way, through multiple samplings, the target intersection point, that is, the real light source point, can be accurately determined on the basis of ensuring efficiency, that is, the real light source point.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of rendering technology, and in particular, to a scene rendering method, device, storage medium and electronic device. Background Art

[0002] In movie special effects, games, AR / VR and other scenes, in order to generate more realistic images and animations, it is often necessary to simulate the light in the virtual scene, such as reflection on smooth surfaces, refraction on transparent objects, and light scattering on rough surfaces. Currently, in the process of simulating optical display effects, it is first necessary to determine the real light source point corresponding to the incident light, and then determine the color of the reflection point based on the real light source point, and then render the optical display effect in the virtual scene based on the color of the reflection point.

[0003] In the process of determining the true light source point of the incident light, the incident light is often sampled according to a fixed step size to determine the true light source point. However, if the fixed step size is too large, the accuracy of the determined true light source point will be low, and if the fixed step size is too small, the determination efficiency will be too low. Summary of the invention

[0004] In order to solve the above technical problems, the present disclosure provides a scene rendering method, device, storage medium and electronic device.

[0005] In a first aspect, the present disclosure provides a method for rendering a scene, the method comprising:

[0006] Sampling points on a target ray in a target scene according to a first preset step length to determine a first candidate intersection point; a first depth distance between the first candidate intersection point and a first object point is less than or equal to a preset distance threshold, and the first object point represents a point on an object surface in the target scene at the same position as the first candidate intersection point in a two-dimensional coordinate system;

[0007] Sampling points around the first candidate intersection point on the target light ray according to a second preset step length to obtain a second candidate intersection point; the second preset step length is smaller than the first preset step length;

[0008] Determine a target intersection point according to the first candidate intersection point and the second candidate intersection point;

[0009] Determine the target color corresponding to the target reflection point according to the target intersection point and the scene color corresponding to the target scene; the target reflection point is the reflection point corresponding to the target light;

[0010] The target scene is rendered according to the target intersection point, the target reflection point and the target color.

[0011] Optionally, sampling points on a target light ray in the target scene according to a first preset step length to determine a first candidate intersection point includes:

[0012] According to a first preset step length, sampling a point on a target light in a target scene to obtain a first sampling point;

[0013] Determine a first depth value corresponding to the first sampling point;

[0014] Acquire a second depth value corresponding to a second object point in the target scene according to a first coordinate position of the first sampling point in the two-dimensional coordinate system; the second object point represents a point on the surface of an object in the target scene at the same position as the first sampling point in the two-dimensional coordinate system;

[0015] When it is determined according to the first depth value and the second depth value that the second depth distance between the first sampling point and the second object point is less than or equal to the preset distance threshold, the first sampling point is used as the first candidate intersection point.

[0016] Optionally, the target light is obtained by:

[0017] Based on a three-dimensional space coordinate system, determining the reflected light according to the preset point and the target reflection point;

[0018] According to the reflected light and the target reflection point, the corresponding incident light is determined, and the incident light is mapped to the two-dimensional coordinate system to obtain the target light.

[0019] Optionally, determining a target intersection point according to the first candidate intersection point and the second candidate intersection point includes:

[0020] Determine a third depth value corresponding to the second candidate intersection point;

[0021] acquiring, according to a second coordinate position of the second candidate intersection point in the two-dimensional coordinate system, a fourth depth value corresponding to a third object point in the target scene; the third object point represents a point on the surface of an object in the target scene at the same position as the second candidate intersection point in the two-dimensional coordinate system;

[0022] The target intersection point is determined from the first candidate intersection points and the second candidate intersection points according to the third depth value and the fourth depth value.

[0023] Optionally, the determining the target intersection point from the first candidate intersection point and the second candidate intersection point according to the third depth value and the fourth depth value comprises:

[0024] determining a third depth distance between the second candidate intersection point and the third object point according to the third depth value and the fourth depth value;

[0025] According to the first depth distance and the third depth distance, the intersection point with the smallest depth distance between the first candidate intersection point and the second candidate intersection point is taken as the target intersection point.

[0026] Optionally, determining the target color corresponding to the target reflection point according to the target intersection point and the scene color corresponding to the target scene includes:

[0027] Determine a third coordinate position of the target intersection point in the two-dimensional coordinate system;

[0028] Obtaining a target scene color corresponding to the object at the third coordinate position in the target scene;

[0029] The target scene color is used as the target color.

[0030] Optionally, the method further comprises:

[0031] Acquire material information of the surface of the object where the target reflection point is located in the target scene;

[0032] Adjusting the target color according to the material information;

[0033] The rendering of the target scene according to the target intersection point, the target reflection point and the target color comprises:

[0034] The target scene is rendered according to the target intersection point, the target reflection point and the adjusted target color.

[0035] In a second aspect, the present disclosure provides a scene rendering device, the device comprising:

[0036] A first sampling module is used to sample points on a target light ray in a target scene according to a first preset step length to determine a first candidate intersection point; a first depth distance between the first candidate intersection point and a first object point is less than or equal to a preset distance threshold, and the first object point represents a point on an object surface in the target scene at the same position as the first candidate intersection point in a two-dimensional coordinate system;

[0037] A second sampling module, used for sampling points around the first candidate intersection point on the target light according to a second preset step length to obtain a second candidate intersection point; the second preset step length is smaller than the first preset step length;

[0038] A first determination module, configured to determine a target intersection point according to the first candidate intersection point and the second candidate intersection point;

[0039] A second determination module is used to determine a target color corresponding to a target reflection point according to the target intersection point and the scene color corresponding to the target scene; the target reflection point is a reflection point corresponding to the target light;

[0040] A rendering module is used to render the target scene according to the target intersection point, the target reflection point and the target color.

[0041] Optionally, the first sampling module is used to sample points on a target light ray in a target scene according to a first preset step size to obtain a first sampling point; determine a first depth value corresponding to the first sampling point; obtain a second depth value corresponding to a second object point in the target scene according to a first coordinate position of the first sampling point in the two-dimensional coordinate system; the second object point represents a point on the surface of an object in the target scene that is at the same position as the first sampling point in the two-dimensional coordinate system; and when it is determined that a second depth distance between the first sampling point and the second object point is less than or equal to the preset distance threshold according to the first depth value and the second depth value, use the first sampling point as the first candidate intersection point.

[0042] Optionally, the target light is obtained by:

[0043] Based on a three-dimensional space coordinate system, determining the reflected light according to the preset point and the target reflection point;

[0044] According to the reflected light and the target reflection point, the corresponding incident light is determined, and the incident light is mapped to the two-dimensional coordinate system to obtain the target light.

[0045] Optionally, the first determination module is used to determine a third depth value corresponding to the second candidate intersection; obtain a fourth depth value corresponding to a third object point in the target scene based on the second coordinate position of the second candidate intersection in the two-dimensional coordinate system; the third object point represents a point on the surface of an object in the target scene at the same position as the second candidate intersection in the two-dimensional coordinate system; and determine the target intersection from the first candidate intersection and the second candidate intersection based on the third depth value and the fourth depth value.

[0046] Optionally, the first determination module is used to determine a third depth distance between the second candidate intersection point and the third object point based on the third depth value and the fourth depth value; and based on the first depth distance and the third depth distance, take the intersection with the smallest depth distance between the first candidate intersection point and the second candidate intersection point as the target intersection point.

[0047] Optionally, the second determination module is used to determine a third coordinate position of the target intersection in the two-dimensional coordinate system; obtain a target scene color corresponding to an object at the third coordinate position in the target scene; and use the target scene color as the target color.

[0048] Optionally, the device further comprises:

[0049] An acquisition module, used to acquire material information of the surface of the object where the target reflection point is located in the target scene;

[0050] An adjustment module, used for adjusting the target color according to the material information;

[0051] The rendering module is used to render the target scene according to the target intersection point, the target reflection point and the adjusted target color.

[0052] In a third aspect, the present disclosure provides a non-temporary computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the scene rendering method provided in the first aspect of the present disclosure.

[0053] In a fourth aspect, the present disclosure provides an electronic device, comprising: a memory on which a computer program is stored; and a processor for executing the computer program in the memory to implement the steps of the scene rendering method provided in the first aspect of the present disclosure.

[0054] Through the above technical solution, firstly, according to the larger first preset step size, a first candidate intersection point that may have an intersection relationship with an object in the target scene is determined from the target light. Further, according to the first candidate intersection point, secondary sampling is performed on the target light according to the smaller second preset step size to obtain the second candidate intersection point around the first candidate intersection point. After that, the target intersection point that intersects with an object in the target scene can be determined according to the first candidate intersection point and the second candidate intersection point. Since the first sampling is performed according to the larger step size, the efficiency of determining the first candidate intersection point is improved. In the process of the second sampling, sampling is performed according to the smaller step size based on the first candidate intersection point, ensuring the accuracy of the final target intersection point determination. In this way, through multiple sampling, the target intersection point, that is, the real light source point, can be accurately determined on the basis of ensuring efficiency. Then, the target color corresponding to the target reflection point can be determined according to the target intersection point. Finally, the target scene can be rendered according to the target intersection point, the target reflection point and the target color to obtain a more realistic optical display effect, giving users a better viewing experience.

[0055] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0057] Figure 1 The present invention is a flowchart of a scene rendering method according to an exemplary embodiment.

[0058] Figure 2 The figure is a schematic diagram of light reflection according to an exemplary embodiment.

[0059] Figure 3 The figure is a flowchart of another scene rendering method according to an exemplary embodiment.

[0060] Figure 4 The figure is a flowchart of another scene rendering method according to an exemplary embodiment.

[0061] Figure 5 The invention is a block diagram of a scene rendering device according to an exemplary embodiment.

[0062] Figure 6 It is a block diagram of a rendering device for another scene according to an exemplary embodiment.

[0063] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment.

[0064] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0065] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0066] The terms "first", "second", etc. in the specification and claims of this application and the above drawings are used to distinguish similar objects and do not have to be understood as a specific order or sequence. In addition, in the description with reference to the drawings, the same symbols in different drawings represent the same elements.

[0067] In the description of the present disclosure, unless otherwise specified, "multiple" means two or more than two, and other quantifiers are similar thereto; "at least one item", "one item or multiple items" or similar expressions refer to any combination of these items, including any combination of single items or plural items. For example, at least one item a can represent any number of a; for another example, one item or multiple items among a, b and c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple; "and / or" is a kind of description of the association relationship of associated objects, indicating that there can be three kinds of relationships, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " indicates that the associated objects before and after are in an "or" relationship.

[0068] Before introducing the rendering method, device, storage medium and electronic device of the scene provided by the present disclosure, the application scenarios involved in each embodiment of the present disclosure are first introduced. In actual application scenarios, ray tracing technology is often used to simulate the optical display effect in the virtual scene. However, since optical tracing technology often requires a lot of complex calculations, it is difficult to implement on devices with limited computing power such as mobile terminals. Based on this situation, in order to ensure that devices with limited computing power such as mobile terminals can display real optical display effects, a reflection effect generation method based on screen space (English: Screen Space Reflection; abbreviated as: SSR) is adopted in the present disclosure. SSR is based on the screen space coordinate system, that is, the pixel grid space. The target light is mainly mapped to the screen space and its depth is sampled, and the same position in the pre-generated depth buffer is sampled to obtain the nearest depth of the scene stored by the current pixel point (that is, the depth value of the nearest object surface at that position in the scene). Afterwards, the two depth values ​​are compared to determine whether the target light intersects with the surface of an object in the scene. If intersected, the color of the intersection point (that is, the real light source point) can be regarded as the color of the reflection point.

[0069] However, the inventors have found that in the current process of determining the intersection point, the target light is often sampled according to a fixed step size, and then the sampling points are determined to be intersecting to obtain the intersection point. However, if the fixed step size is too large, the accuracy of the determined intersection point will be low, and if the fixed step size is too small, the amount of determination calculation will increase and the efficiency will be too low.

[0070] In order to solve the above technical problems, the present invention provides a scene rendering method, device, storage medium and electronic device. First, according to a larger first preset step size, a first candidate intersection point that may have an intersection relationship with an object in the target scene is determined from the target light. Further, according to the first candidate intersection point, a second sampling is performed on the target light according to a smaller second preset step size to obtain a second candidate intersection point around the first candidate intersection point. After that, the target intersection point that intersects with an object in the target scene can be determined according to the first candidate intersection point and the second candidate intersection point. Since the first sampling is performed according to a larger step size, the efficiency of determining the first candidate intersection point is improved. In the process of the second sampling, sampling is performed based on the first candidate intersection point and according to a smaller step size, ensuring the accuracy of the final target intersection point determination. In this way, through multiple sampling, the target intersection point, that is, the real light source point, can be accurately determined on the basis of ensuring efficiency. Then, the target color corresponding to the target reflection point can be determined according to the target intersection point. Finally, the target scene can be rendered according to the target intersection point, the target reflection point and the target color to obtain a more realistic optical display effect, giving users a better viewing experience.

[0071] The specific implementation modes of the present invention are described in detail below with reference to the accompanying drawings.

[0072] Figure 1 is a flowchart of a scene rendering method according to an exemplary embodiment. Figure 1 As shown, the method may include the following steps:

[0073] Step S101 : sampling points on a target light ray in a target scene according to a first preset step length to determine a first candidate intersection point.

[0074] The first depth distance between the first candidate intersection point and the first object point is less than or equal to a preset distance threshold, and the first object point represents a point on the surface of an object in the target scene at the same position as the first candidate intersection point in a two-dimensional coordinate system (for example, a screen space coordinate system). The target light ray may be an incident light ray in the target scene, and the incident light ray may be an incident light ray generated by an indirect light source in the target scene irradiating the target reflection point.

[0075] It should be noted that, in the process of simulating the target scene, a direct light source will first be set to render the objects in the target scene. This process mainly simulates the optical display effect produced by the direct light source shining on the object. It is understandable that in the actual scene, if the light encounters an obstacle during the propagation process, reflection will occur. At this time, the reflected light will be used as a new light source (that is, an indirect light source) to illuminate other objects. Therefore, in order to more realistically simulate the display effect of light in the target scene, it is necessary to further render the reflection effect produced by the incident light generated by the indirect light source shining in the target scene. In this embodiment, the incident light generated by the indirect light source is mainly used to simulate the reflection effect corresponding to the incident light.

[0076] In this step, the first preset step length (ray marching) can be a larger value, that is, in the first sampling process, the points on the target ray are initially sampled with a larger step length. Specifically, sampling can be performed starting from the starting point on the target ray according to the first preset step length. For example Figure 2 The vector where QP is located is the target light. If point P can be used as the starting point, sampling can be performed along the PQ direction. After obtaining the sampling point, determine the depth value of the sampling point. And according to the position of the sampling point in the two-dimensional coordinate system, obtain the depth value corresponding to the first object point in the target scene that is at the same position as the sampling point. If the depth value of the sampling point is equal to the depth value of the first object point within a certain error range, it can be considered that the target light may intersect with the object corresponding to the first object point. At this time, the sampling point can be used as the first candidate intersection point. The first candidate intersection point can be understood as a point on the target light that may be an indirect light source.

[0077] In the process of performing preliminary sampling of points on the target light, each time a point is sampled, it can be determined whether the sampled point intersects with a certain object. If it is determined that the intersection is possible, the sampled point is directly used as the first candidate intersection point. If it is determined that the intersection is impossible, the next point on the target light is sampled according to the first preset step size until the first candidate intersection point is obtained.

[0078] Step S102: sampling points around the first candidate intersection point on the target light according to a second preset step length to obtain a second candidate intersection point.

[0079] The second preset step length is smaller than the first preset step length.

[0080] According to the above, firstly, the points on the target light are sampled according to the larger first preset step size, and the first candidate point on the target light that may have an intersection relationship with the object in the target scene can be preliminarily determined. At this time, the first candidate point may be the point where the indirect light source is located, or it may be a point near the indirect light source. Therefore, in this step, in order to further accurately determine the target intersection point, the points around the first candidate intersection point on the target light can be sampled again according to the smaller second preset step size to obtain the second candidate intersection point.

[0081] Step S103: determining a target intersection point according to the first candidate intersection point and the second candidate intersection point.

[0082] Specifically, the first depth distance corresponding to the first candidate intersection point and the third depth distance corresponding to the second candidate intersection point can be determined respectively, and the third depth distance is the depth distance between the second candidate intersection point and the third object point, and the third object point represents a point on the surface of an object at the same position as the second candidate intersection point in the target scene under two-dimensional coordinates. Afterwards, the first depth distance and the third depth distance are compared, and the target intersection point is determined from the first candidate intersection point and the second candidate intersection point. Among them, the smaller the depth distance, the closer the distance between the candidate intersection point and the corresponding object point is, and there may be an intersection relationship.

[0083] Step S104, determining a target color corresponding to the target reflection point according to the target intersection point and the scene color corresponding to the target scene.

[0084] The target reflection point is the reflection point corresponding to the target light. The corresponding scene color in the target scene is pre-obtained data cached in the storage space, and the scene color is used to reflect the color information corresponding to a certain position in the target scene.

[0085] For example, the color on the surface of an object at the same position as the target intersection in the target scene can be determined based on the position of the target intersection in the two-dimensional coordinate system. Since the color of an indirect light source often depends on the color of the surface of an object intersecting with the indirect light source, the color on the surface of the object can be used as the color of the target intersection. The color of the indirect light source directly shines on the target reflection point, that is, the color of the target reflection point is directly affected by the color of the indirect light source. The color of the target intersection can be used as the target color corresponding to the target reflection point.

[0086] Step S105: Rendering the target scene according to the target intersection point, the target reflection point and the target color.

[0087] Specifically, the target intersection point, the target reflection point and the target color can be superimposed on the target scene, and the superimposed target scene can be rendered. In this way, the optical display effect after the indirect light source is reflected can be simulated to bring users a more realistic display effect.

[0088] By adopting the above method, firstly, according to a larger first preset step size, a first candidate intersection point that may have an intersection relationship with an object in the target scene is determined from the target light. Further, according to the first candidate intersection point, according to a smaller second preset step size, secondary sampling is performed on the target light to obtain a second candidate intersection point around the first candidate intersection point. After that, the target intersection point that intersects with an object in the target scene can be determined according to the first candidate intersection point and the second candidate intersection point. Since the first sampling is performed according to a larger step size, the efficiency of determining the first candidate intersection point is improved. In the process of the second sampling, sampling is performed based on the first candidate intersection point and according to a smaller step size, ensuring the accuracy of the final target intersection point determination. In this way, through multiple sampling, the target intersection point, that is, the real light source point, can be accurately determined on the basis of ensuring efficiency. Then, the target color corresponding to the target reflection point can be determined according to the target intersection point. Finally, the target scene can be rendered according to the target intersection point, the target reflection point and the target color to obtain a more realistic optical display effect, giving users a better viewing experience.

[0089] The above step S101 is described in detail below. Specifically, step S101 samples points on the target light ray in the target scene according to a first preset step length to determine the first candidate intersection point, which may include the following steps:

[0090] Step S1011: sampling the upper point of the target light in the target scene according to a first preset step length to obtain a first sampling point.

[0091] The target light can be obtained by:

[0092] S1, based on a three-dimensional space coordinate system, determining the reflected light according to a preset point and the target reflection point.

[0093] For example, suppose that the reflection of a certain point in the target scene needs to be calculated, and this point is referred to as point P (reflection point). First, the visual light can be determined by the camera coordinate position (simulating the human eye observation point) and point P. Figure 2 As shown, the preset point can be the camera coordinate position, that is, the position where the simulated human eye observation point is located (i.e. Figure 2Specifically, the first coordinate of point M in the three-dimensional space coordinate system (for example, the camera coordinate system or the world coordinate system) and the second coordinate of point P in the three-dimensional space coordinate system can be determined first. Then, the visual light vector is determined based on the first coordinate and the second coordinate. That is, the vector where the reflected light is located.

[0094] S2, determining the corresponding incident light according to the reflected light and the target reflection point, and mapping the incident light into the two-dimensional coordinate system to obtain the target light.

[0095] First, we can determine the normal of the target reflection point P (i.e. Figure 2 Then, the corresponding incident light vector can be determined based on the normal and the reflected light. In some embodiments, the user can set the expected light propagation distance, and the corresponding incident light can be determined based on the incident light vector (i.e., propagation direction) and the set expected light propagation distance (i.e., propagation distance).

[0096] In the related art, the sampling process of the points on the target light is performed in the three-dimensional space coordinate system. However, for some light rays, the span distance in the three-dimensional space coordinate system is long, and the pixel points occupied in the two-dimensional coordinate system are few. Since the subsequent acquisition of the scene color is based on the two-dimensional coordinate system, if the target light is sampled according to the three-dimensional space coordinate system, the same point may be sampled repeatedly, affecting the sampling efficiency. Therefore, in this embodiment, the incident light can be mapped from the three-dimensional space coordinate system to the two-dimensional coordinate system to obtain the target light.

[0097] Step S1012: Determine a first depth value corresponding to the first sampling point.

[0098] It is understandable that, since the target light is based on a two-dimensional coordinate system, the first sampling point is also based on a two-dimensional space. However, for the target scene, if you want to further determine whether the first sampling point intersects with an object, you also need to determine the depth value of the first sampling point in the three-dimensional space coordinates as the first depth value.

[0099] Step S1013: acquiring a second depth value corresponding to a second object point in the target scene according to a first coordinate position of the first sampling point in the two-dimensional coordinate system.

[0100] The second object point represents a point on the surface of an object in the target scene at the same position as the first sampling point in the two-dimensional coordinate system. The corresponding depth information in the target scene is pre-obtained data cached in the storage space.

[0101] Step S1014: when it is determined according to the first depth value and the second depth value that the second depth distance between the first sampling point and the second object point is less than or equal to the preset distance threshold, the first sampling point is used as the first candidate intersection point.

[0102] In this way, by comparing the depth values ​​between the first sampling point and the second object point at the same position in the two-dimensional space, the first candidate intersection point that may have an intersection relationship with the object in the target scene can be determined from the target light, which facilitates the subsequent further accurate determination of the target intersection point.

[0103] Furthermore, the above step S103, determining the target intersection point according to the first candidate intersection point and the second candidate intersection point, may include the following steps:

[0104] Step S1031: determine a third depth value corresponding to the second candidate intersection point.

[0105] Similarly, in this step, it is necessary to determine the depth value of the second candidate intersection point in the three-dimensional space coordinates as the third depth value.

[0106] Step S1032: Acquire a fourth depth value corresponding to a third object point in the target scene according to a second coordinate position of the second candidate intersection point in the two-dimensional coordinate system.

[0107] The third object point represents a point on the surface of an object in the target scene at the same position as the second candidate intersection point in the two-dimensional coordinate system.

[0108] Step S1033: determining the target intersection point from the first candidate intersection point and the second candidate intersection point according to the third depth value and the fourth depth value.

[0109] Specifically, first, the third depth distance between the second candidate intersection point and the third object point can be determined according to the third depth value and the fourth depth value. Then, according to the first depth distance and the third depth distance, the intersection point with the smallest depth distance between the first candidate intersection point and the second candidate intersection point is taken as the target intersection point (i.e. Figure 2 The target intersection point can be understood as the point where the indirect light source corresponding to the target light obtained by reflection in the target scene is located. In other words, the target light is obtained by reflecting the indirect light source through the target reflection point.

[0110] Furthermore, the above step S104 may include the following steps of determining the target color corresponding to the target reflection point according to the scene color corresponding to the target intersection point and the target scene:

[0111] Step S1041, determining the third coordinate position of the target intersection point in the two-dimensional coordinate system.

[0112] Step S1042, obtaining the target scene color corresponding to the object at the third coordinate position in the target scene.

[0113] The corresponding scene color in the target scene is pre-obtained data cached in the storage space, and the scene color is used to reflect the color information corresponding to a certain position in the target scene.

[0114] According to the third coordinate position, the target scene color corresponding to the object located at the third coordinate position in the target scene can be obtained.

[0115] Step S1043: using the target scene color as the target color.

[0116] That is to say, in this step, the target scene color corresponding to the object intersecting the target intersection point can be used as the target color corresponding to the target reflection point.

[0117] Figure 3 is a flowchart of another scene rendering method according to an exemplary embodiment. Figure 3 As shown, the method may also include the following steps:

[0118] Step S106, obtaining material information of the surface of the object where the target reflection point in the target scene is located.

[0119] The material information may include, for example, the color, roughness, and metallicity of the surface of the object where the target reflection point is located. It is understandable that the material information of the reflection point will also affect the color of the reflected light generated after the light irradiates the point. Therefore, in order to further improve the authenticity of the optical display effect of the target scene, in this step, the material information of the surface of the object where the target reflection point is located in the target scene may be first obtained.

[0120] Step S107: adjusting the target color according to the material information.

[0121] After the material information is obtained, the target color can be adjusted based on the material information. For example, the brightness, contrast, saturation, etc. of the target color can be adjusted to make the adjusted target color more realistic and lifelike.

[0122] The above step S105 of rendering the target scene according to the target intersection point, the target reflection point and the target color may include: rendering the target scene according to the target intersection point, the target reflection point and the adjusted target color.

[0123] The target scene is rendered by adjusting the target color, target intersection point and target reflection point to further improve the realism and naturalness of the optical display effect in the final target scene, thereby enhancing the user's viewing experience.

[0124] Figure 4 is a flowchart of another scene rendering method according to an exemplary embodiment. Figure 4 As shown, the method may also include the following steps:

[0125] Step S108, performing fuzzy processing on the target color.

[0126] Considering that if the target color is directly used as the color of the target reflection point, the display effect may be too stiff and unnatural. Therefore, in order to improve the authenticity of the display effect, the target color can be blurred in this step, and the blurred target color is used as the color of the target reflection point to improve the authenticity and naturalness of the color display of the target reflection point.

[0127] When the target color is fuzzy processed, the target color may be fuzzy processed according to a preset fuzzy algorithm. Specifically, the preset fuzzy algorithm may be selected according to actual needs, for example but not limited to, the Kuwahara filter algorithm may be included.

[0128] The above step S105 of rendering the target scene according to the target intersection point, the target reflection point and the target color may include: rendering the target scene according to the target intersection point, the target reflection point and the blurred target color.

[0129] The target scene is rendered by blurring the target color, target intersection point and target reflection point to further improve the realism and naturalness of the optical display effect in the final target scene, thereby enhancing the user's viewing experience.

[0130] By adopting the above method, firstly, according to a larger first preset step size, a first candidate intersection point that may have an intersection relationship with an object in the target scene is determined from the target light. Further, according to the first candidate intersection point, according to a smaller second preset step size, secondary sampling is performed on the target light to obtain a second candidate intersection point around the first candidate intersection point. After that, the target intersection point that intersects with an object in the target scene can be determined according to the first candidate intersection point and the second candidate intersection point. Since the first sampling is performed according to a larger step size, the efficiency of determining the first candidate intersection point is improved. In the process of the second sampling, sampling is performed based on the first candidate intersection point and according to a smaller step size, ensuring the accuracy of the final target intersection point determination. In this way, through multiple sampling, the target intersection point, that is, the real light source point, can be accurately determined on the basis of ensuring efficiency. Then, the target color corresponding to the target reflection point can be determined according to the target intersection point. Finally, the target scene can be rendered according to the target intersection point, the target reflection point and the target color to obtain a more realistic optical display effect, giving users a better viewing experience.

[0131] Figure 5 is a block diagram of a rendering device for a scene according to an exemplary embodiment. Figure 5 As shown, the device 200 includes:

[0132] A first sampling module 201 is used to sample points on a target ray in a target scene according to a first preset step length to determine a first candidate intersection point; a first depth distance between the first candidate intersection point and a first object point is less than or equal to a preset distance threshold, and the first object point represents a point on an object surface in the target scene at the same position as the first candidate intersection point in a two-dimensional coordinate system;

[0133] A second sampling module 202 is used to sample points around the first candidate intersection point on the target light according to a second preset step length to obtain a second candidate intersection point; the second preset step length is smaller than the first preset step length;

[0134] A first determination module 203, configured to determine a target intersection point according to the first candidate intersection point and the second candidate intersection point;

[0135] The second determination module 204 is used to determine the target color corresponding to the target reflection point according to the target intersection point and the scene color corresponding to the target scene; the target reflection point is the reflection point corresponding to the target light;

[0136] The rendering module 205 is used to render the target scene according to the target intersection point, the target reflection point and the target color.

[0137] Optionally, the first sampling module 201 is used to sample points on a target light ray in a target scene according to a first preset step size to obtain a first sampling point; determine a first depth value corresponding to the first sampling point; obtain a second depth value corresponding to a second object point in the target scene according to a first coordinate position of the first sampling point in the two-dimensional coordinate system; the second object point represents a point on the surface of an object in the target scene that is at the same position as the first sampling point in the two-dimensional coordinate system; and when it is determined that a second depth distance between the first sampling point and the second object point is less than or equal to a preset distance threshold according to the first depth value and the second depth value, use the first sampling point as the first candidate intersection point.

[0138] Optionally, the target ray is obtained by:

[0139] Based on the three-dimensional space coordinate system, the reflected light is determined according to the preset point and the target reflection point;

[0140] According to the reflected light and the target reflection point, the corresponding incident light is determined, and the incident light is mapped to the two-dimensional coordinate system to obtain the target light.

[0141] Optionally, the first determination module 203 is used to determine a third depth value corresponding to the second candidate intersection; based on the second coordinate position of the second candidate intersection in the two-dimensional coordinate system, obtain a fourth depth value corresponding to a third object point in the target scene; the third object point represents a point on the surface of an object in the target scene at the same position as the second candidate intersection in the two-dimensional coordinate system; based on the third depth value and the fourth depth value, determine the target intersection from the first candidate intersection and the second candidate intersection.

[0142] Optionally, the first determination module 203 is used to determine a third depth distance between the second candidate intersection and the third object point based on the third depth value and the fourth depth value; and based on the first depth distance and the third depth distance, select the intersection with the smallest depth distance between the first candidate intersection and the second candidate intersection as the target intersection.

[0143] Optionally, the second determination module 204 is used to determine the third coordinate position of the target intersection in the two-dimensional coordinate system; obtain the target scene color corresponding to the object at the third coordinate position in the target scene; and use the target scene color as the target color.

[0144] Alternatively, if Figure 6 As shown, the device 200 also includes:

[0145] An acquisition module 206 is used to acquire material information of the surface of the object where the target reflection point is located in the target scene;

[0146] An adjustment module 207, used to adjust the target color according to the material information;

[0147] The rendering module 205 is used to render the target scene according to the target intersection point, the target reflection point and the adjusted target color.

[0148] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0149] By using the above device, firstly, according to a larger first preset step size, a first candidate intersection point that may have an intersection relationship with an object in the target scene is determined from the target light. Further, according to the first candidate intersection point, secondary sampling is performed on the target light according to a smaller second preset step size to obtain a second candidate intersection point around the first candidate intersection point. After that, the target intersection point that intersects with an object in the target scene can be determined according to the first candidate intersection point and the second candidate intersection point. Since the first sampling is performed according to a larger step size, the efficiency of determining the first candidate intersection point is improved. In the process of the second sampling, sampling is performed based on the first candidate intersection point and according to a smaller step size, ensuring the accuracy of the final target intersection point determination. In this way, through multiple sampling, the target intersection point, that is, the real light source point, can be accurately determined on the basis of ensuring efficiency. Then, the target color corresponding to the target reflection point can be determined according to the target intersection point. Finally, the target scene can be rendered according to the target intersection point, the target reflection point and the target color to obtain a more realistic optical display effect, giving users a better viewing experience.

[0150] Figure 7 FIG. 1 is a block diagram of an electronic device 300 according to an exemplary embodiment. Figure 7 As shown, the electronic device 300 may include: a processor 301 , a memory 302 . The electronic device 300 may also include one or more of a multimedia component 303 , an input / output (I / O) interface 304 , and a communication component 305 .

[0151] The processor 301 is used to control the overall operation of the electronic device 300 to complete all or part of the steps in the above-mentioned scene rendering method. The memory 302 is used to store various types of data to support the operation of the electronic device 300, and these data may include, for example, instructions for any application or method used to operate on the electronic device 300, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 303 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 302 or sent through the communication component 305. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 304 provides an interface between the processor 301 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 305 is used for wired or wireless communication between the electronic device 300 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 305 may include: Wi-Fi module, Bluetooth module, NFC module, etc.

[0152] In an exemplary embodiment, the electronic device 300 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned scene rendering method.

[0153] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned scene rendering method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 302 including program instructions, and the above-mentioned program instructions can be executed by the processor 301 of the electronic device 300 to complete the above-mentioned scene rendering method.

[0154] Figure 8 4 is a block diagram of an electronic device 400 according to an exemplary embodiment. For example, the electronic device 400 may be provided as a server. Figure 8 The electronic device 400 includes a processor 422, which may be one or more, and a memory 432 for storing a computer program executable by the processor 422. The computer program stored in the memory 432 may include one or more modules each corresponding to a set of instructions. In addition, the processor 422 may be configured to execute the computer program to perform the above-mentioned scene rendering method.

[0155] In addition, the electronic device 400 may further include a power supply component 426 and a communication component 450, wherein the power supply component 426 may be configured to perform power management of the electronic device 400, and the communication component 450 may be configured to implement communication, for example, wired or wireless communication, of the electronic device 400. In addition, the electronic device 400 may further include an input / output (I / O) interface 458. The electronic device 400 may operate based on an operating system stored in the memory 432.

[0156] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by the processor, the steps of the above-mentioned scene rendering method are implemented. For example, the non-temporary computer-readable storage medium can be the above-mentioned memory 432 including program instructions, and the above-mentioned program instructions can be executed by the processor 422 of the electronic device 400 to complete the above-mentioned scene rendering method.

[0157] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program executable by a programmable device. The computer program has a code portion for executing the above-mentioned scene rendering method when executed by the programmable device.

[0158] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0159] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0160] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A scene rendering method, characterized in that: The method comprises: Sampling points on a target ray in a target scene according to a first preset step length to determine a first candidate intersection point; a first depth distance between the first candidate intersection point and a first object point is less than or equal to a preset distance threshold, and the first object point represents a point on an object surface in the target scene at the same position as the first candidate intersection point in a two-dimensional coordinate system; Sampling points around the first candidate intersection point on the target light ray according to a second preset step length to obtain a second candidate intersection point; the second preset step length is smaller than the first preset step length; Determine a target intersection point according to the first candidate intersection point and the second candidate intersection point; Determine the target color corresponding to the target reflection point according to the target intersection point and the scene color corresponding to the target scene; the target reflection point is the reflection point corresponding to the target light; Rendering the target scene according to the target intersection point, the target reflection point and the target color; The sampling of points on the target light in the target scene according to the first preset step length to determine the first candidate intersection point includes: According to a first preset step length, sampling points on a target light ray in a target scene to obtain a first sampling point; Determine a first depth value corresponding to the first sampling point; Acquire a second depth value corresponding to a second object point in the target scene according to a first coordinate position of the first sampling point in the two-dimensional coordinate system; the second object point represents a point on the surface of an object in the target scene at the same position as the first sampling point in the two-dimensional coordinate system; When it is determined according to the first depth value and the second depth value that the second depth distance between the first sampling point and the second object point is less than or equal to the preset distance threshold, taking the first sampling point as the first candidate intersection point; The determining of the target intersection point according to the first candidate intersection point and the second candidate intersection point comprises: Determine a third depth value corresponding to the second candidate intersection point; acquiring, according to a second coordinate position of the second candidate intersection point in the two-dimensional coordinate system, a fourth depth value corresponding to a third object point in the target scene; the third object point represents a point on the surface of an object in the target scene at the same position as the second candidate intersection point in the two-dimensional coordinate system; Determine the target intersection point from the first candidate intersection points and the second candidate intersection points according to the third depth value and the fourth depth value; The determining the target intersection point from the first candidate intersection point and the second candidate intersection point according to the third depth value and the fourth depth value comprises: determining a third depth distance between the second candidate intersection point and the third object point according to the third depth value and the fourth depth value; According to the first depth distance and the third depth distance, taking the intersection point with the smallest depth distance between the first candidate intersection point and the second candidate intersection point as the target intersection point; Determining the target color corresponding to the target reflection point according to the target intersection point and the scene color corresponding to the target scene includes: Determine a third coordinate position of the target intersection point in the two-dimensional coordinate system; Obtaining a target scene color corresponding to the object at the third coordinate position in the target scene; The target scene color is used as the target color.

2. The method according to claim 1, characterized in that The target light is obtained by: Based on a three-dimensional space coordinate system, determining the reflected light according to the preset point and the target reflection point; According to the reflected light and the target reflection point, the corresponding incident light is determined, and the incident light is mapped to the two-dimensional coordinate system to obtain the target light.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: Acquire material information of the surface of the object where the target reflection point is located in the target scene; Adjusting the target color according to the material information; The rendering of the target scene according to the target intersection point, the target reflection point and the target color comprises: The target scene is rendered according to the target intersection point, the target reflection point and the adjusted target color.

4. A scene rendering device, characterized in that: The device comprises: A first sampling module is used to sample points on a target light ray in a target scene according to a first preset step length to determine a first candidate intersection point; a first depth distance between the first candidate intersection point and a first object point is less than or equal to a preset distance threshold, and the first object point represents a point on an object surface in the target scene at the same position as the first candidate intersection point in a two-dimensional coordinate system; A second sampling module, used for sampling points around the first candidate intersection point on the target light according to a second preset step length to obtain a second candidate intersection point; the second preset step length is smaller than the first preset step length; A first determination module, configured to determine a target intersection point according to the first candidate intersection point and the second candidate intersection point; A second determination module is used to determine a target color corresponding to a target reflection point according to the target intersection point and the scene color corresponding to the target scene; the target reflection point is a reflection point corresponding to the target light; A rendering module, used for rendering the target scene according to the target intersection point, the target reflection point and the target color; The first sampling module is used to sample points on a target light ray in a target scene according to a first preset step length to obtain a first sampling point; determine a first depth value corresponding to the first sampling point; obtain a second depth value corresponding to a second object point in the target scene according to a first coordinate position of the first sampling point in the two-dimensional coordinate system; the second object point represents a point on the surface of an object in the target scene at the same position as the first sampling point in the two-dimensional coordinate system; and when it is determined according to the first depth value and the second depth value that a second depth distance between the first sampling point and the second object point is less than or equal to the preset distance threshold, use the first sampling point as the first candidate intersection point; The first determination module is used to determine a third depth value corresponding to the second candidate intersection point; obtain a fourth depth value corresponding to a third object point in the target scene according to a second coordinate position of the second candidate intersection point in the two-dimensional coordinate system; the third object point represents a point on the surface of an object in the target scene at the same position as the second candidate intersection point in the two-dimensional coordinate system; determine the target intersection point from the first candidate intersection point and the second candidate intersection point according to the third depth value and the fourth depth value; The first determination module is configured to determine a third depth distance between the second candidate intersection point and the third object point according to the third depth value and the fourth depth value; and according to the first depth distance and the third depth distance, take the intersection point with the smallest depth distance between the first candidate intersection point and the second candidate intersection point as the target intersection point; The second determination module is used to determine the third coordinate position of the target intersection in the two-dimensional coordinate system; obtain the target scene color corresponding to the object at the third coordinate position in the target scene; and use the target scene color as the target color.

5. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.

6. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Rendering method based on indirect reflection highlight calculation in screen space

    CN105261059A

  • Scene rendering method and device, electronic equipment and storage medium

    CN115994974A

  • Scene rendering method, device and equipment, computer readable storage medium and product

    CN116310036A

  • System and method for blending data sampling techniques

    US20050285851A1

  • Image processing apparatus and method therefor

    US20150256806A1