0
\$\begingroup\$

Unreal 4.27, newbie and experimenting, will switch to 5 if supporting features are not available in 4.

I have a light on the left side of the room pointed toward the right side. In the middle of the room is a complex shape: a humanoid doing a yoga pose. There is a single color shape of the correct yoga pose in a fixed position on the right wall (like a poster).

How do I determine if the shadow the yoga mesh casts on the wall matches the 2D target shape perfectly? Even better would be some way to access the per-pixel data to calculate a percentage: how much of the 2D target was successfully hidden in shadow, vs failures (shadows falling outside the target on the wall, or target areas not covered in shadow).

I feel like some rendering pass should let me access a 2D representation of the shadowed material on the wall, but maybe I'm overthinking it. If there's no straightforward way to compare the pixels shaded versus not, maybe I could project N rays in a grid from the source of the light to the wall (or vice versa) to build a low resolution 2D representation of the shadow map. Ideally I wouldn't do that route, because the detail (down to the finger position) of the pose is very important to this experiment.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Normally in games we'd solve this the opposite way: pick the position and orientation for the light/shadow-caster that we want to be the solution, then generate the 2D shape by projecting with that input. Then we can score any player-provided position and orientation by checking how close it is to the solution we used to generate the problem in the first place. This saves doing more expensive raster comparisons every frame. Would an inversion like that be applicable to your situation? \$\endgroup\$
    – DMGregory
    Mar 10, 2022 at 1:54
  • \$\begingroup\$ Thanks @DMGregory, that may be the best solution. I'll look into the available library calls and see if there's a built-in way to do this, or if I have to write the code myself. \$\endgroup\$
    – JD.
    Mar 10, 2022 at 14:02

0

You must log in to answer this question.

Browse other questions tagged .