Light vector material node?

I’m wondering if anyone knows where the value is taken from, or rather what the rules are for it?

It seems that it is taken from the DominantDirectionalLight in the world. However I want to use a second DDL in my world, however then all the materials using this node use the value from the new DDL rather than my main one.

So is there any way to control which DDL this value is taken from?

Does light vector only work with DDL’s or can they be used with normal point lights?

I tried following the C++ rabbit hole. Eventually it gets to a function that translates your whole material into HLSL and by then I was out of my depth.

I’m pretty sure you’re only allowed to have only one dominant light of any type. You can have a dominant directional light and a dominant sky light, but not two dominant directional lights. I haven’t done it in a long time, but I remember UDK refusing to let me drop another light into the scene, or refusing to build, or something like that.

You could just make a horizontal plane, put your material on it, put the mesh in an otherwise black level with two lights and see what happens.

Light Vector applies to all lights, because in forward rendering the material is evaluated once per each light that affects that object.
so if you have one DDL, one spotlight and one pointlight affecting an object and you do a simple blinn specular, you’ll notice 3 specular highlights.

Thanks for the info guys. Very useful.

I’m trying to add a moon for my day/night cycles. I’m able to add a second DDL in via script, but it appears to cancel the other one out, which is a pain because I want to show the moon in the sky while the sun is setting, and as soon as I enable the moon, it cancels the sun DDL, causing the clouds it’s still lighting up to instantly become unlit. Not sure how I’m going to handle it.

Maybe you can have the moon in the sky, and while the sun is setting you start lerping the light color. Then when the sun is under the horizon you start lerping the light direction to come from the moon. Then when it’s night time, the DDL is just moonlight. Then do the reverse when the sun starts rising again.

The idea with Dominant lights is that only one should affect a primitive at once. In the case of a Directional Light since it’s a “general” light that doesn’t affect an encompassed area, the short answer is that you can’t have multiple of them at once.
you can try making your moon a non-dominant Directional Light, or as Nathaniel described you can fade out your moon light before sunrise and fade in after sunset (Ghost of Tsushima did this)

Thanks, yes that’s what I’m doing at the moment and it’s working pretty great :slight_smile:

Interesting… In past experiments you can get alien planet type FX using multiple DDL (in the UDK editor at least - not sure about packaging). For example add 3 DDL’s set as RGB. Initially the last one created or the most recent enabled becomes dominant. However, if you crank up the brightness on each you soon realize the illumination works on all three (in UE4 too). So the landscape is blue, the sky red, and other props green (especially those outside the range of the skydome). As for the OP’s question. You can always use opacity to thin out the sky-material and place an actual moon mesh outside the half-sphere with an emissive boost. You’ll still have to handle the moon’s movement manually though. But visually it looks more real.

Cant have 2 DDL lights at once, just one.
We shared the sun and moon between one DDL. All controlled by matinee.