US11810241B2ActiveUtilityA1

Systems and methods for ray traced contact shadows

Assignee: ELECTRONIC ARTS INCPriority: Mar 31, 2022Filed: Mar 31, 2022Granted: Nov 7, 2023
Est. expiryMar 31, 2042(~15.7 yrs left)· nominal 20-yr term from priority
Inventors:Dustin Hulm
G06T 15/06G06T 7/13G06T 7/50G06T 15/20G06T 15/60G06T 2215/12
39
PatentIndex Score
0
Cited by
2
References
20
Claims

Abstract

A method, device, and computer-readable storage medium for generating shadows in an image of a scene. The method includes: generating a shadow map to determine pixels in shadow; for each pixel in shadow, performing a sampling of neighboring pixels; for each pixel in shadow, computing an average brightness of the sampling to generate a shadow mapped shadow value; determining a set of close shadow edge pixels, which are shadow edge pixels that correspond to locations on an object that are below a threshold distance to an occluding object; for each pixel in the set of close shadow edge pixels, performing ray tracing to determine a ray traced shadow value; and outputting shadow values for pixels in shadow, wherein the output is based on the ray traced shadow value for the close shadow edge pixels, and the output is based on the shadow mapped shadow value for other shadow pixels.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A method for generating shadows in an image of a scene, the method comprising:
 generating, by one or more processors, a shadow map to determine which pixels in screen space are in shadow; 
 for each pixel identified as being in shadow in the shadow map, performing, by the one or more processors, a sampling of neighboring pixels; 
 for each pixel identified as being in shadow in the shadow map, computing, by the one or more processors, an average brightness of the sampling of neighboring pixels in the shadow map to generate a shadow mapped shadow value for the pixel; 
 determining, by the one or more processors, a set of close shadow edge pixels, wherein each pixel in the set of close shadow edge pixels is an edge pixel on a border between a shadow region and a non-shadow region, and wherein each pixel in the set of close shadow edge pixels corresponds to a location on an object that is below a threshold distance to an occluding object in a direction towards a light source; 
 for each pixel in the set of close shadow edge pixels, performing, by the one or more processors, ray tracing from the location on the object corresponding to the pixel to determine a ray traced shadow value for the pixel; and 
 outputting, by the one or more processors, shadow values for the pixels identified as being in shadow in the shadow map, wherein for pixels in the set of close shadow edge pixels, the shadow value is based on the ray traced shadow value, and wherein the shadow value is based on the shadow mapped shadow value for pixels in shadow other than the pixels in the set of close shadow edge pixels. 
 
     
     
       2. The method according to  claim 1 , wherein generating the shadow map comprises:
 generating a depth map from a point of view of the light source; 
 rendering the scene from a camera viewpoint, including coordinates of objects corresponding to pixels in screen space; 
 for each pixel in screen space, comparing the coordinates of the object in the pixel to the depth map to determine whether the pixel is in shadow or not in shadow; and 
 generating the shadow map based on results of the comparing. 
 
     
     
       3. The method according to  claim 1 , wherein, for a given pixel, the sampling of neighboring pixels comprises selecting eight neighboring pixels of the given pixel in the shadow map, including a pixel above the given pixel, a pixel below the given pixel, a pixel to the left of the given pixel, a pixel to the right of the given pixel, and four diagonal pixels. 
     
     
       4. The method according to  claim 1 , wherein, for a given pixel, performing the ray tracing comprises casting a single ray from a location on an object corresponding to the given pixel towards the light source to generate the ray traced shadow value for the given pixel. 
     
     
       5. The method according to  claim 1 , wherein for a subset of the set of close shadow edge pixels, the shadow value is based on blending the shadow mapped shadow value and the ray traced shadow value. 
     
     
       6. The method according to  claim 5 , wherein blending the shadow mapped shadow value and the ray traced shadow value comprises a computed a weighted average of the shadow mapped shadow value and the ray traced shadow value. 
     
     
       7. The method according to  claim 1 , wherein the threshold distance is based on a type of the light source. 
     
     
       8. A non-transitory computer-readable storage medium storing instructions that, when executed by one or more processors, causes a computing device to generate shadows in an image of a scene, by performing the steps of:
 generating a shadow map to determine which pixels in screen space are in shadow; 
 for each pixel identified as being in shadow in the shadow map, performing a sampling of neighboring pixels; 
 for each pixel identified as being in shadow in the shadow map, computing an average brightness of the sampling of neighboring pixels in the shadow map to generate a shadow mapped shadow value for the pixel; 
 determining a set of close shadow edge pixels, wherein each pixel in the set of close shadow edge pixels is an edge pixel on a border between a shadow region and a non-shadow region, and wherein each pixel in the set of close shadow edge pixels corresponds to a location on an object that is below a threshold distance to an occluding object in a direction towards a light source; 
 for each pixel in the set of close shadow edge pixels, performing ray tracing from the location on the object corresponding to the pixel to determine a ray traced shadow value for the pixel; and 
 outputting shadow values for the pixels identified as being in shadow in the shadow map, wherein for pixels in the set of close shadow edge pixels, the shadow value is based on the ray traced shadow value, and wherein the shadow value is based on the shadow mapped shadow value for pixels in shadow other than the pixels in the set of close shadow edge pixels. 
 
     
     
       9. The computer-readable storage medium according to  claim 8 , wherein generating the shadow map comprises:
 generating a depth map from a point of view of the light source; 
 rendering the scene from a camera viewpoint, including coordinates of objects corresponding to pixels in screen space; 
 for each pixel in screen space, comparing the coordinates of the object in the pixel to the depth map to determine whether the pixel is in shadow or not in shadow; and 
 generating the shadow map based on results of the comparing. 
 
     
     
       10. The computer-readable storage medium according to  claim 8 , wherein, for a given pixel, the sampling of neighboring pixels comprises selecting eight neighboring pixels of the given pixel in the shadow map, including a pixel above the given pixel, a pixel below the given pixel, a pixel to the left of the given pixel, a pixel to the right of the given pixel, and four diagonal pixels. 
     
     
       11. The computer-readable storage medium according to  claim 8 , wherein, for a given pixel, performing the ray tracing comprises casting a single ray from a location on an object corresponding to the given pixel towards the light source to generate the ray traced shadow value for the given pixel. 
     
     
       12. The computer-readable storage medium according to  claim 8 , wherein for a subset of the set of close shadow edge pixels, the shadow value is based on blending the shadow mapped shadow value and the ray traced shadow value. 
     
     
       13. The computer-readable storage medium according to  claim 12 , wherein blending the shadow mapped shadow value and the ray traced shadow value comprises a computed a weighted average of the shadow mapped shadow value and the ray traced shadow value. 
     
     
       14. The computer-readable storage medium according to  claim 8 , wherein the threshold distance is based on a type of the light source. 
     
     
       15. A device for generating shadows in an image of a scene, the device comprising:
 a memory storing instructions; and 
 one or more processors configured to the execute the instructions to cause the device to:
 generate a shadow map to determine which pixels in screen space are in shadow; 
 for each pixel identified as being in shadow in the shadow map, perform a sampling of neighboring pixels; 
 for each pixel identified as being in shadow in the shadow map, compute an average brightness of the sampling of neighboring pixels in the shadow map to generate a shadow mapped shadow value for the pixel; 
 determine a set of close shadow edge pixels, wherein each pixel in the set of close shadow edge pixels is an edge pixel on a border between a shadow region and a non-shadow region, and wherein each pixel in the set of close shadow edge pixels corresponds to a location on an object that is below a threshold distance to an occluding object in a direction towards a light source; 
 for each pixel in the set of close shadow edge pixels, perform ray tracing from the location on the object corresponding to the pixel to determine a ray traced shadow value for the pixel; and 
 output shadow values for the pixels identified as being in shadow in the shadow map, wherein for pixels in the set of close shadow edge pixels, the shadow value is based on the ray traced shadow value, and wherein the shadow value is based on the shadow mapped shadow value for pixels in shadow other than the pixels in the set of close shadow edge pixels. 
 
 
     
     
       16. The device according to  claim 15 , wherein generating the shadow map comprises:
 generating a depth map from a point of view of the light source; 
 rendering the scene from a camera viewpoint, including coordinates of objects corresponding to pixels in screen space; 
 for each pixel in screen space, comparing the coordinates of the object in the pixel to the depth map to determine whether the pixel is in shadow or not in shadow; and 
 generating the shadow map based on results of the comparing. 
 
     
     
       17. The device according to  claim 15 , wherein, for a given pixel, the sampling of neighboring pixels comprises selecting eight neighboring pixels of the given pixel in the shadow map, including a pixel above the given pixel, a pixel below the given pixel, a pixel to the left of the given pixel, a pixel to the right of the given pixel, and four diagonal pixels. 
     
     
       18. The device according to  claim 15 , wherein, for a given pixel, performing the ray tracing comprises casting a single ray from a location on an object corresponding to the given pixel towards the light source to generate the ray traced shadow value for the given pixel. 
     
     
       19. The device according to  claim 15 , wherein for a subset of the set of close shadow edge pixels, the shadow value is based on blending the shadow mapped shadow value and the ray traced shadow value. 
     
     
       20. The device according to  claim 19 , wherein blending the shadow mapped shadow value and the ray traced shadow value comprises a computed a weighted average of the shadow mapped shadow value and the ray traced shadow value.

Join the waitlist — get patent alerts

Track US11810241B2 — get alerts on status changes and closely related new filings.

We store only your email — no account needed. See our privacy policy.