That’s right, today you can be the hero that helps remove the tyranny of CustomStencils appearing in SceneCaptures. All ideas and thoughts are welcome and much appreciated!
Imagine a world where I can pick up an x-ray scanner. This scanner can see objects through walls, certainly objects that I cannot see. What could I do with such a device? I could be a hero in my own way, see people trapped in burning buildings, or see the tumor inside my patient. Or maybe I will be the villain and peer into the bank vault and assess, is this heist worth the risk? Full disclosure, the heist is worth my time.
These are all things that cannot be viewed from the perspective of the character and instead require alien technology that fits in the palm of your hand.
Let’s get into the details of where we are at.
I have a camcorder that captures a scene and renders the scene to a screen on the camcorder. Huge thanks to Matt Aspland in CCTV/Security Cameras - Unreal Engine 4 Tutorial for showing how to get to this point.
I have some objects with custom depth set to 3. Within the material, I am accessing the SceneTexture:CustomStencil and able to apply it to the camcorder’s screen. Now the problem, that CustomStencil is captured from the perspective of the character’s camera and not from the perspective of the camcorder’s camera. (*note neat feature for some future applications and come back to this in the future)
Material:
Result:
You can see how the green stencil shows up in the camcorder and it does not show up in the player’s view, woot woot! But that stencil is from the perspective of the player and not from the perspective of the camcorder.
Sooo, let’s get the texture coordinates from the texture and apply it to the UVs of the customstencil.
Now the stencil is showing up a little bit better in the camcorder view, but there is something wonky in that it still uses aspects of the player’s camera angle in the image.
and when I look down:
I feel like there is a transformation that can easily be applied to get the stencil to align with the screen, but I have tried and failed:
I have failed a lot:
No, you don’t understand, A LOT:
And now, I call on this community of heroes for support in this endeavor. I will split whatever is in the vault.