Hi there !
Issue solved, you can see the resulting effect here :
I’m quite new to Unreal, and I’m far better at programming than rendering and using materials. Whatever, I would like to make some nice effect for a game idea I need to implement, and I’m really struggling. Explanations :
Imagine a 2D side scroller. The character can equip a special flashlight which behaves like a projector. One can light some walls and discover hidden details on it, like ancient texts, crime evidences… Hidden elements must only be seen when lit up by this special projector (you can compare it to UV flashlight if you want), and not render at all when not lit.
Have you got some ideas to guide me to this kind of effects ?
Thanks, happy new year and have a great game-making time
(PS : I’m french, hope my english isn’t too bad)
Check this out: http://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/
There’s a similar setup in the robo recall mod tool if you look at the holo sight on the pistol.
I’m not sure if this would do exactly what you want as it’s mainly for showing 3D silhouettes (not textures) but it could be a good starting point and give you a few ideas on how to approach it.
Thanks ! That’s not exactly what I want, but I surely may help getting to it
Maybe reverting the process, like doing a mesh that is behing background surface (thus invisible), and render it with custom depth if some special light area is going between it and the camera.
If anybody has a solution that is a bit closer to my need, I would be really glad to hear about it ^^
Maybe custom depth and then a post process material function which uses a distorted sphere/box mask that roughly fits the shape of the flashlight cone.
Or maybe a simpler approach would be to plug in Custom Depth to a standard material and then just use that to mask out the elements you don’t want. ( I can’t remember if custom depth can be used in a non post process material)
Hopefully these resources will help you get started. Would love to see if you get it working.
https://forums.unrealengine.com/development-discussion/rendering/74034-how-to-rotate-output-of-box-mask-3d-node
I’m back after a little while, and thanks to what you shared, I went through many other posts and finally found a solution ! (a clean one, I wonder ?)
It’s not based on custom depth in the end, but maybe adding it would be a great idea
I shot a video to show you the effect in game
Here is the summary of the steps I followed :
- Add a *SceneCapture2DActor *as child of the main *CameraActor *in level, make all the target texture linked involved. Add an offset along one of the axis (-2000 in Y for me).
- Add a *BP_LightBeam *linked somehow to your *Character *(I made my own mouse controls to rotate it).
- Add a *SceneCapture2DActor *as child of the main CameraActor, but no transform this time : it’s a the same place. In *ShowOnly *list, select the *BP_LightBeam *–> it will be our mask.
- Create a Material where you get your two target textures. Make it Translucent. Then, taking only the red channel of each texture, multiply them and plug it into *Opacity *pin. For the color, put a constant3 to *EmissiveColor *(for the glittering effect, it’s more complicated, but basicaly I copy-pasted most of the security-camera effect in the UE4 Blueprint example project).
- Add a *Plane *just in front of the *CameraActor *: it will be our “render overlay”. I placed it at 50 units from my camera, with scale 1.0, as my camera has a 90° FOV (thus it takes precisely all the screen). As its material, take the rendering material you just made.
- Having done this, every object you create with the good offset (Y : -2000 for me), making it Unlit, or adding some lights near them, will render as an overlay when the flashlight goes in front of them ! You can now make your “secret scene”
So, do you find this solution too heavy, or is it alright ? (I’m quite new to UE4 but I’m trying things)