Make Objects Invisible but Still Have Reflections

I am trying to make objects/particles/decals/THINGS IN GENERAL invisible to the player’s view directly, however, these things still need to have reflections (That the player CAN see) on things like mirrors/reflective items. I have been unable to produce this effect with the simple “Owner No See” and “Only Owner See” options.

I have been messing around with Planar Reflections for high quality reflections, and the Planar Reflection actor has “Hidden Actors” and “Show Only Actors” arrays, but I haven’t been able to use those either to get the effect that I need.

I have thought of trying to use things like Custom Depth, Render Targets, or even overlaying multiple Camera feeds onto the same player screen/viewport. However, I don’t know enough about those to know how to do it, or if they’re even possible.

Any help or suggestions on how to get this effect would be greatly appreciated.

If you’re wanting only reflective objects to have reflections, then you’d need reflection probes, the other methods (SSR and planar reflections) only work in real-time so the objects would have to be visible. Probes are rendered beforehand so you’d have those generated and then when gameplay starts you would hide all of the objects that you don’t want visible, except for the objects that will be reflecting things.

That is part of my problem. I need these reflections to be updated in real-time. The invisible objects will be moving around the level, so their reflections need to be updated in real-time. I need the player to be able to find these invisible objects by the reflections that they make. And since some of these items are going to be moving, I need a way to simulate real-time reflections.

I don’t know if actual reflections will handle this kind of effect, so I’m open to suggestions on how to fake a reflection in materials maybe through post-processing or custom depth or something.

So you want objects to be visible to reflection capture but not to the player camera?
I have an idea:
Get the player camera world position every tick, and store that to a material parameter colllection. Then, in the material (for the objects you want to be reflected, but hidden), get the difference between the camerapositionWS, and the material parameter collection. If there is any slight difference between them, make the object’s opacity 1. If there is no difference, make the opacity 0 - the only camera that will have no difference is the player camera.

Edit: I am assuming the material node “cameraPositionWS” gets the position of the camera that is rendering the current frame, not the player camera, is that correct?

Amazing! My initial tests are promising! As far as I can tell, this is a valid way to make it work. I don’t know yet what the limitations/problems with this method are (If any). I’m going to keep expanding on this suggestion, and hopefully post some screenshots in this thread later. If anyone else has any other suggestions/methods to get this effect working or improve upon this method as well, I would appreciate them as well, just in case there is a better way that has been overlooked.

Anyways, thanks for the help!

Initial Results

Alright, so I’ve done a few tests with this technique, and it does work pretty well. It’s not 100% perfect, but I’ll get into that in a bit. First of all, the effect is really easy to implement. This is my method of implementing the invisibility effect in a Material Function that can be used in an kind of material.

Important Note: The “if” node needs to have an “Equals Threshold” appropriate for 1 frame’s distance of your player’s movement speed. I have been unable to fix a 1 frame differential between the values of the “Camera Position” node and the stored position of the player’s camera. This difference is unnoticeable if the player is not moving, but if they are, then material might think that the player’s camera is actually too far away from “Camera Position” to make the object invisible.

If-Statement.PNG

The Inputs and Output can handle (In my particular version) Scalars, and Vectors (Up to Vector 3 in my case, but they could handle a Vector 4 if I wanted them to). This allows them to be able to handle textures and masks as well as just the 0-1 values. Also, even though I am using this method only for opacity, it is fully capable of doing this for any material attribute, not just opacity. Here is what the Material Function looks like in a material.

Material-Function-03.PNG

Here are some examples of the effect being used in conjunction with Planar Reflections to get the desired result.

Mesh’s Reflection with Normal Material vs. Invisible Material

Meshes.PNG.jpg

Particle Systems with Normal Material vs. Invisible Material

Now, I did run into a little bit of trouble trying to get this to work with particles, and I’m not 100% happy with the results, but it turns out that Particles in general have a difficult time with reflections, so I found this post (Particles aren’t reflected by Planar Reflection) that helped me solve (Mostly) the reflection problem.

Deferred Decals Using Invisible Material

Deffered-Decals.PNG.jpg

So far, it seems to be a really nice solution. I think that it’s robust enough for pretty much all my needs, so I am going to use this method unless I find something that is significantly better. However, I am still interested to hear other solutions or improvements to this method if anyone has some. Anyways, thanks again for the help! I really appreciate it!

3 Likes

Hello Meganaught ,

Thanks for the tut! I find out what I was missing! :smiley:

hello… i also want to go through this solution but in my case there is a slight difference…instead of a player or something…i am working on a production sequence in which the objects i want to be invisible but not in reflections. so instead of making the objects invisible to the player’s camera i want it invisible to the cine camera actor… i have a cine camera actor which has my imported tracked camera data… so pls could any one help me out with this…it would be a great help to me…And also one more thing… i m still learning UE4 so pls could someone help me out to take out the player camera world position and store it in material parameter collection…that would also be great…Thank you in advance