Getting night lights to work on Earth shader

Greetings,

I am following a tutorial on youtube (Earth / Planet Material Shader - UDK Tutorials by Javahawk - YouTube) which uses a lightvector trick to implement night lights from cities on the earth shader in UDK.

I tried using the same technique in UE4 and its not working. Here is a screenshot of my code 817e0a7c49ebdbfb5058372de95abc52046f97d1.jpeg

Some notes: I have tried changing the material domain to “deferred decal” and “light function” from the default option “surface” and still no night lights are showing on the dark side of the planet. For some reason in “surface” mode the light vector produces an error -> Error [SM5] (Node LightVector) LightVector can only be used in LightFunction or DeferredDecal materials

I appreciate any help on this.

thanks

Muunich

UE3 used a technique called forward lighting, which enabled the materials to access the lighting information per light as the object was being rendered. In UE4 on the other hand, a different technique called deferred lighting is used. It allows games to use many, many more dynamic lights than is possible with forward lighting. Unfortunately, one of the major drawbacks is that it can limit the expressiveness of your material system. You my friend have hit that limitation.

Your best bet will be to set a vector parameter yourself which you can treat as a light vector exactly the same as the tutorial does.

For an example of this, check out the clouds in the Stylized sample on the Marketplace. They use a blueprint to set a lighting vector from the sun into the material to light them all fancy like.

Good Luck,

/ Kyle

I am not sure what “Stylized sample” you are referring to on the marketplace. I can not find it. Is it a level within one of the items in the marketplace. I looked through the content examples and levels within that project and still couldn’t find anything.

it’s in the launcher too, under the marketplace tab.

@Laserman Thanks for that :slight_smile: