I understand the following traces return the **first **valid hit encountered:
While the following traces return **all **valid hits encountered:
And if I understand correctly, when any of the above (multi or single) traces hit a valid object (e.g. a Cube object), the trace returns data relating to the first point of contact on an object.
In example 1 (see image below), when the sphere trace hits the Cube, I assume the trace returns data for the first contact point on the Cube (i.e. a single vector location representing the collision point). Once the trace returns this data, the trace either stops (single trace), or ignores this Cube object then continues to check if any additional Cube objects collide (multi trace).
However is there a function which behaves more like example 2 in the image below? So when the sphere hits the Cube object, it returns data for all points on the Cube which were hit by the path of the sphere? In other words, if the sphere trace was a light, can I get data for all areas on the Cube which were lit by the light?
I imagine I could create a function which casts multiple parallel line rays in a loop (with each line trace separated by a small distance and together forming the shape of the cast). Then check to see what was Objects were hit, returning an array of object data and location vectors.
However considering this kind of functionality must already exist in Unreal Engine (otherwise how do we have shadows?), it seems like the above method of iterating through a single line trace loop would be reinventing the wheel. I’m wondering how shadows work in Unreal Engine. Are they created with thousands of parallel line traces, (each separated by a very small distance), to calculate individual points of shading? Or are they instead created with geometry (using the geometry of blocking objects) to calculate aggregate **areas **of shading?