<p>You might want to look into signed distance field textures.  They are very efficient and high quality for monochromatic images like shadows.  They work by storing a clamped, signed distance from the pixel to the shape.  Working this way, the distances play nicely with the bilinear interpolation of texture sampling, so you can have very nice results for very low resolution.  You can also give them a soft edge to have a soft shadow look.</p>

CC BY-SA 3.0
2015-11-03T03:12:17.680Z
2015-11-03T03:12:17.680Z
Alan Wolfe
<p>Given a 3D space and a light source, I use ray casting to determine the shadows generated in the scene. If I'm to store the shadow data (boundary of the shadow, object which cast the shadow, etc.) what is an efficient way to go about it?</p>

<p>Edit:</p>

<p>Its basically for an application where I want to be able to move the shadow around manually to see the change in the 3d objects position. Say I apply a force to the shadow of a ball, I can actually see the ball move and also the change in the shadow. So I need to be able to set up colliders for the shadow and hence need a way to be able to store the boundary of the shadow and information about the object that cast it to carry out the actions.</p>

CC BY-SA 3.0
2015-10-19T06:15:54.390Z
In my understanding, raycasting isnt very good for boundary information. Depthmaps also dont dont benefit from raycasting. Deepshadow maps might benefit from raycasting. Otherwise you would just be better of baking lightning to model uv maps or some kind of voxel tree. Possibly per vertex/face. The question is a bit hard to swallow, could you specify it a bit. Best is not defined, efficient in this case is not terribly defined either
joojaa
CC BY-SA 3.0
2015-10-19T12:19:21.930Z
Are you asking for something geometric such as Franklin Crow's [Projected Shadow Volumes](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.424.6834)?
Simon F
CC BY-SA 3.0
2015-10-20T01:03:27.893Z
I apologize for being so vague.. Its basically for an application where I want to be able to move the shadow around manually to see the change in the 3d objects position. Say I apply a force to the shadow of a ball, I can actually see the ball move and also the change in the shadow. So I need to be able to set up colliders for the shadow and hence need a way to be able to store the boundary of the shadow and information about the object that cast it to carry out the actions.
ichigo1191
CC BY-SA 3.0
2015-10-20T15:40:47.627Z
@ichigo1191 your comments are giving a lot more detail than the question, which makes a big difference. I recommend you [edit] the question to include the extra detail all in one place. Comments are not guaranteed to last forever.
trichoplax is on Codidact now
<shadow-mapping><shadow>
Storing shadow data
ichigo1191
# Storing shadow data

(Asked by: username_0 on 2015-10-19)

Given a 3D space and a light source, I use ray casting to determine the shadows generated in the scene. If I'm to store the shadow data (boundary of the shadow, object which cast the shadow, etc.) what is an efficient way to go about it?

Edit:

Its basically for an application where I want to be able to move the shadow around manually to see the change in the 3d objects position. Say I apply a force to the shadow of a ball, I can actually see the ball move and also the change in the shadow. So I need to be able to set up colliders for the shadow and hence need a way to be able to store the boundary of the shadow and information about the object that cast it to carry out the actions.

**Tags:** shadow-mapping, shadow

> **Comments:**
> **username_1**: In my understanding, raycasting isnt very good for boundary information. Depthmaps also dont dont benefit from raycasting. Deepshadow maps might benefit from raycasting. Otherwise you would just be better of baking lightning to model uv maps or some kind of voxel tree. Possibly per vertex/face. The question is a bit hard to swallow, could you specify it a bit. Best is not defined, efficient in this case is not terribly defined either  
> **username_2**: Are you asking for something geometric such as Franklin Crow's [Projected Shadow Volumes](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.424.6834)?  
> **username_0**: I apologize for being so vague.. Its basically for an application where I want to be able to move the shadow around manually to see the change in the 3d objects position. Say I apply a force to the shadow of a ball, I can actually see the ball move and also the change in the shadow. So I need to be able to set up colliders for the shadow and hence need a way to be able to store the boundary of the shadow and information about the object that cast it to carry out the actions.  
> **username_3**: @username_0 your comments are giving a lot more detail than the question, which makes a big difference. I recommend you [edit] the question to include the extra detail all in one place. Comments are not guaranteed to last forever.  

---

## 1 answers

### Answer by username_4 on 2015-11-03. Score: 0

You might want to look into signed distance field textures. They are very efficient and high quality for monochromatic images like shadows. They work by storing a clamped, signed distance from the pixel to the shape. Working this way, the distances play nicely with the bilinear interpolation of texture sampling, so you can have very nice results for very low resolution. You can also give them a soft edge to have a soft shadow look.


---

