How difficult would it be to have phong specular highlights be obscured by objects' cast shadows?

In a similar manner to the Unreal default specular reflections? And also phong highlights obscured by objects that block the light source source form view (e.g. a light moved behind a wall causes phong highlight to become invisible, but when the wall is removed and the light can be seen again the phong specular highlight re-appears). Can it be done in Blueprints (or C++) without having to modify the engine?

I’m specifically trying to modify this material:

https://forums.unrealengine.com/filedata/fetch?id=1134815

No other way, but to apply shadowing algorithm, such as shadow mapping.

Okay, thanks.

Where should I ask to commission/pay someone for this if necessary?

Shadow casting will only help with analytical lights. You will still get specular highlights from the environment and sky. The only general way to prevent that is using realtime reflections of some kind. Screen space reflections will work with limitations. Planar reflecions if you only care about flat surfaces. If you want it to be truly correct in all cases, ray tracing is the only way.

Was this directed at me? Do you know of way to have the cast shadows make the phong reflections disappear?

I have tried this anisotropic shader material:
https://forums.unrealengine.com/comm…-hair-material

While cast shadows don’t cause the highlights to disappear completely (with the anisotropic), it does cause them to become considerably darker, which may work well enough for my purposes.

I would like to know how something similar can be done for phong materal.

What you might be seeing is that in the areas in shadow, the light iself is being blocked, but there is still a reflection of the sun in the skybox and/or the skylight.

I’m also okay with the phong highlights becoming darker rather than disappearing completely? (not quite as realistic as disappearing, but still would be an improvement) Is there any way to make emissive receive cast shadows?

I added more explanation of the the material. It may help a little (or a lot!). The “B” of the first multiply node represents the specular color, and the number “0” (or the color black) makes the specular color disappear.

I also found out there is a way to reference shadows and find which part of affected by light just in the material editor by inputting

return Square(Texture2DSampleLevel(LightAttenuationTexture, LightAttenuationTextureSampler, UV, 0));

into a custom node.

More was posted about it here:

https://www.tomlooman.com/wp-content/uploads/2017/03/ue4_shadowman_disney.gif

https://www.tomlooman.com/wp-content/uploads/2017/03/ue4_lightattenuation_visalized.jpg

https://answers.unrealengine.com/storage/temp/133678-lightattenuationoutput.jpg

But you can see that it can be used to modify shadows and change their color and texture. But it only works for forward renderer, but luckily I *am *using the forward renderer.

I would like to know how to make it so when the material receives a cast shadow it’s specular color to become black.

Do you know of a code similar to “LightAttenuationTexture” that can do this?

Thanks.

Edit: I also sent a message to the author of the article about this in case he knows a solution.

Because your material is unlit, it won’t have access to any lighting-related shader variables like LightAttenuationTexture and you’ll have to roll your own shadow mapping by using scene capture components capturing depth into textures.

I found a tutorial on cel shaded materials that may allow for me to have the phong highlights disappear in cast shadows (uses only very simple blueprints and material editor- and no modding of engine)!

What do you think of it?

Do you see any problems with it, or is it a pretty solid way of handling this?

I’m not sure this covers the “objects obscuring the light source also cause the phong highlight to disappear” problem, but maybe for cast shadows it works.

Oh, no. That’s just the first example. The material doesn’t HAVE to be unlit. Maybe I should have posted the rest.
https://forums.unrealengine.com/deve…ar-calculation

https://forums.unrealengine.com/filedata/fetch?id=1134816