Image rendering method and related device
Abstract
An image rendering method in this application includes S 1: performing ray tracing-based intersection calculation based on space information of a reflective object and space information of a reflected object to obtain M intersecting points on the reflected object, where the reflected object corresponds to at least one piece of material information, and M≥1; and S 2: determining, in the M intersecting points, a plurality of intersecting points corresponding to target material information, and performing shading based on the target material information and space information of the plurality of intersecting points corresponding to the target material information, to obtain an image of a reflection that is of the reflected object and that is in the reflective object, where the target material information is the at least one piece of material information.
Claims
exact text as granted — not AI-modified1 . An image rendering method, wherein the method comprises:
S 1 : performing ray tracing-based intersection calculation based on space information of a reflective object and space information of a reflected object to obtain M intersecting points on the reflected object, wherein the reflected object corresponds to at least one piece of material information, and M≥1; and S 2 : determining, in the M intersecting points, a plurality of intersecting points corresponding to target material information, and performing shading based on the target material information and space information of the plurality of intersecting points corresponding to the target material information, to obtain an image of a reflection that is of the reflected object and that is in the reflective object, wherein the target material information is the at least one piece of material information.
2 . The method according to claim 1 , wherein the at least one piece of material information are P pieces of material information, the target material information is an i th piece of material information, an initial value of i is 1, and S 2 comprises:
S 21 : determining, in the M intersecting points, a plurality of intersecting points corresponding to the i th piece of material information, and performing shading based on the i th piece of material information and space information of the plurality of intersecting points corresponding to the i th piece of material information; and
S 22 : letting setting i=i+1, and re-performing S 21 , until i=P, to obtain the image of the reflection that is of the reflected object and that is in the reflective object.
3 . The method according to claim 2 , wherein S 21 further comprises:
S 211 : if a reflected object on which a j th intersecting point is located corresponds to the i th piece of material information, performing shading based on the i th piece of material information and space information of the j th intersecting point, to obtain a j th pixel in an image of a reflection in the reflective object, wherein an initial value of j is 1; and
S 212 : setting j=j+1, and re-performing S 211 , until j=M.
4 . The method according to claim 3 , wherein S 1 further comprises:
determining, based on space information of a camera, the space information of the reflective object, and a bounding volume hierarchy (BVH) tree, M intersecting points obtained after a ray from the camera passes through the reflective object and acts on the reflected object, wherein the BVH tree is constructed based on the space information of the reflected object.
5 . The method according to claim 4 , wherein the reflected object each has a unique serial number in the BVH tree, and S 211 comprises:
if a serial number of the reflected object on which the j th intersecting point is located is in a serial number of at least one reflected object corresponding to the i th piece of material information, performing shading based on the i th piece of material information and the space information of the j th intersecting point.
6 . The method according to claim 1 , wherein the method further comprises:
performing rasterization based on the space information of the reflective object and material information of the reflective object to obtain an image of the reflective object; performing rasterization based on the space information of the reflected object and material information of the reflected object to obtain an image of the reflected object; and fusing the image of the reflective object, the image of the reflected object, and the image of the reflection in the reflective object to obtain a target image.
7 . The method according to claim 1 , wherein the space information comprises at least one of the following: vertex coordinates, a vertex normal line, or a triangle index.
8 . The method according to claim 1 , wherein the material information comprises at least one of a color, a metallicity, or a roughness.
9 . An image rendering apparatus, wherein the apparatus comprises:
at least one processor; and one or more memories coupled to the at least one processor and storing programming instructions for execution by the at least one processor to cause the apparatus to: perform ray tracing-based intersection calculation based on space information of a reflective object and space information of a reflected object to obtain M intersecting points on the reflected object, wherein the reflected object corresponds to at least one piece of material information, and M≥1; and determine, in the M intersecting points, a plurality of intersecting points corresponding to target material information, and perform shading based on the target material information and space information of the plurality of intersecting points corresponding to the target material information, to obtain an image of a reflection that is of the reflected object and that is in the reflective object, wherein the target material information is the at least one piece of material information.
10 . The apparatus according to claim 9 , wherein the at least one piece of material information is P pieces of material information, the target material information is an i th piece of material information, an initial value of i is 1, and wherein the programming instructions, when executed by the at least one processor, cause the apparatus to:
determine, in the M intersecting points, a plurality of intersecting points corresponding to the i th piece of material information, and perform shading based on the i th piece of material information and space information of the plurality of intersecting points corresponding to the i th piece of material information; and set i=i+1, and repeat the determining the plurality of intersecting points and performing shading, until i=P, to obtain the image of the reflection that is of the reflected object and that is in the reflective object.
11 . The apparatus according to claim 10 , wherein the programming instructions, when executed by the at least one processor, cause the apparatus to:
if a reflected object on which a j th intersecting point is located corresponds to the i th piece of material information, perform shading based on the i th piece of material information and space information of the j th intersecting point, to obtain a j th pixel in an image of a reflection in the reflective object, wherein an initial value of j is 1; and set j=j+1, and repeating performing shading, until j=M.
12 . The apparatus according to claim 11 , wherein the programming instructions, when executed by the at least one processor, cause the apparatus to determine, based on space information of a camera, the space information of the reflective object, and a bounding volume hierarchy (BVH) tree, M intersecting points obtained after a ray from the camera passes through the reflective object and acts on the reflected object, wherein the BVH tree is constructed based on the space information of the reflected object.
13 . The apparatus according to claim 12 , wherein the reflected object each has a unique serial number in the BVH tree, and the programming instructions, when executed by the at least one processor, cause the apparatus to: if a serial number of the reflected object on which the j th intersecting point is located is in a serial number of at least one reflected object corresponding to the i th piece of material information, perform shading based on the i th piece of material information and the space information of the j th intersecting point.
14 . The apparatus according to claim 9 , wherein the programming instructions, when executed by the at least one processor, cause the apparatus to:
perform rasterization based on the space information of the reflective object and material information of the reflective object to obtain an image of the reflective object; perform rasterization based on the space information of the reflected object and material information of the reflected object to obtain an image of the reflected object; and fuse the image of the reflective object, the image of the reflected object, and the image of the reflection in the reflective object to obtain a target image.
15 . The apparatus according to claim 9 , wherein the space information comprises at least one of the following: vertex coordinates, a vertex normal line, or a triangle index.
16 . The apparatus according to claim 9 , wherein the material information comprises at least one of a color, a metallicity, or a roughness.
17 . An electronic device, comprising a memory and a processor, wherein the memory stores code, the processor is configured to execute the code, to cause the electronic device to:
perform ray tracing-based intersection calculation based on space information of a reflective object and space information of a reflected object to obtain M intersecting points on the reflected object, wherein the reflected object corresponds to at least one piece of material information, and M≥1; and determine, in the M intersecting points, a plurality of intersecting points corresponding to target material information, and perform shading based on the target material information and space information of the plurality of intersecting points corresponding to the target material information, to obtain an image of a reflection that is of the reflected object and that is in the reflective object, wherein the target material information is the at least one piece of material information.
18 .- 19 . (canceled)
20 . The electronic device according to claim 17 , wherein the processor is further configured to execute the code, to cause the electronic device to:
perform rasterization based on the space information of the reflective object and material information of the reflective object to obtain an image of the reflective object; perform rasterization based on the space information of the reflected object and material information of the reflected object to obtain an image of the reflected object; and fuse the image of the reflective object, the image of the reflected object, and the image of the reflection in the reflective object to obtain a target image.
21 . The electronic device according to claim 17 , the space information comprises at least one of the following: vertex coordinates, a vertex normal line, or a triangle index.
22 . The electronic device according to claim 17 , wherein the material information comprises at least one of a color, a metallicity, and a roughness.Join the waitlist — get patent alerts
Track US2024378793A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.