Material color based on visibility

Hi all.

I am trying to make a visibility check application for environmental impact. I am pursuing a way to indentify the areas that are visible from a given point (P) by tinting the materials of the objects present in the scene based on their visibility from that point. I would like that P could be moved to analize the scene interactively

A possible solution could be to place a light in P and consider the visibility of areas of the scene based on its shadow, but I can’t find a way to check in the material editor whether the point in the surface of an object receives the effect of a given light or ir falls into its shadow.

Resuming, What I need is to tint the objects (or parts of them, such in a building façade or the terrain itself, that can be partially visible and partially invisible) with different colours depending on their visibility from point P. Hence I need to set up materials for the objects that take that tint based on their visibility on a per pixel shader basis.

Any ideas?

Thank you in advance.

What you could do is, do a raytrace (easy to do in blueprints) which will give you the object that blocks the line between two points. From there you should be able to set the material to whatever you want.

EDIT: looks like I may have misunderstood your question

Thank you for your reply. Probably you misunderstood the question. The raytrace shoud be done in a per pixel basis, since an object with a unique material may be partially visible and partially occluded. Hence The material has to look different for pixels on visible and invisible areas. The problem is that there is no material node for raytracing (as far as I know) to perform that check.

ZBuffer should have that information (ie. only pixels that are in zbuffer are visible), but i do not have idea how to move ZBuffer information from camera looking trough your point P, into camera that is displaying information. Not sure if that is even possible in unreal materials (ie. pixel shader that uses another camera/viewport information).

Maybe some tricks with shadow could do this.

Yea, I think Nawrot is on the right track. This is the exact same problem a shadow map solves so the most efficient way to do it should be to use a shadow map. I don’t think you can use the implementation used for lights outside of shadowing lighting though. I would look into setting up a camera with a depth pass only render. Then use that as an input texture to your material. Lookup shadow map rendering for details on how this works if you are not familiar with the technique.

This may not be possible to achieve without modifying engine source though.

Edit: Just in case you have not discarded this idea already. If it’s OK that the visibility is not done in the material you could use colored lights with dynamic shadows. You would be limited to what is possible with light functions and the parts not visible will always be in shadow so you can’t apply a different effect there.

Hi Parkar, thank you for your response. Colored lights could be an approach if I could get continuous colour from the light reflection, but, pointlights should be used and they will give me different intensities of colour depending on their angle of incidence into the object’s surface (Lambert) thus giving a range of coloring between black and the light color based on incidence angle, and not on visibility.

I’ve posted a thread just changing the problem to a “continuous colour material under light independently of angle of incidence”. Sound just complex but could be a solution if I could blend a material layer with this result with a emmisive baked textured layer.