I am attempting to create a material that self shadows. It’s a brick wall and it uses bump offset for parallax. The one thing it is missing it self shadowing bricks. I couldn’t find any resources on it except an old UDK/UE3 tutorial which I tried: 3D Modeling & Texturing: [How-To] create Self-Shadowing Materials (UDK/UE3)
When I plug it all in though I get this message: “Error [SM5] (Node LightVector) LightVector can only be used in LightFunction or DeferredDecal materials”
The self shadowing part of my material is exactly like his, but here is an image anyway: http://grab.by/zBMc
Since we can’t use the light vector node like this anymore, does anyone have any idea how to achieve these same results? Any help is appreciated.
You can achieve this effect but it can be costly from a performance standpoint becuase you are having to create a dynamic material instance for the object you want to use that calls for the forward vector of a light actor. The material setup is exactly as in UDK with the exception of changing the Light Vector to a Vector Parameter which we adjust in a blueprint. In the blueprint I run a check for a specific type of light (in my case spotlight) and find the closest then get its forward vector.
The method given by you, it seems to me that we should manually specify the light source as a parameter in the Material. So it takes only one light into consideration, right?
The older way (posted by OP), you get Light Vector as a pre-defined parameter into the Material and my understanding is that, that vector gives you the active light for the deferred lighting pass. So if the material is affected by 5 lights, we get contribution from all 5 lights, right? Is there a way to get this in UE4 material editor?
The lose of the ability to pull lighting information into a material is a result of switching to a much more efficient deferred rendering method. IN UDK which is forward rendered, you could pull a light calculation in because light was determined before the material was rendered. In UE4, its the opposite and light is determined and rendered after the material.
Hey joshezzell -
I will look into trying to calculate the light intensity of a light better in blueprints as what I had given you is a 0,1 solution it is applied or not applied. However, the most direct way of really controlling the shading is to add a point or spotlight into the actual blueprint and have that light get its primary direction and intensity from the surrounding light environment which I will also look into as well.
Is this method still valid in 4.6 Eric?
Would you be so kind as to share that 14. example level perhaps?
For peeps like me, who aren’t that BP-savy, it would mean a lot!
Thanks in advance for the assistance.
That particular image you are seeing is actually from my internal test bed, a level I keep with various bugs and issues which Answerhub users have had me look into. I will see what I can do about posting something for you via the Wiki.