Fake Lighting with vertex normal

Hi! I’m trying to create a scene with fake lighting. With using vertex color and a vector3(as direction) into a dot, and then using the result as an alpha in a lerp node I’m able to get the result I’m looking for. However I can’t figure out how to blend a normal map correctly with this setup… Should’t I blend the normal map with the vertexNormal? but how?

Jørgen

Hi!
Try for blend normal map and vertex normals with Blend_Screen node

or material function BlendAngleCorrectedNormals - Corrects the normal direction of normal map that is overlayed on other normal maps (Typically this would be a detailed map).

Thanks for quick reply! I’ve been messing around with the blendAngleCorrectedNormals, but cant really figure it out. If I connect a pixelnormal and a V3 (for direction) into a dot and connect it to the emissive f.ex. the direction of the “light” is constant if I rotate the object. When I use a normal map and pixelsnormal and blend those in a blendAngleCorrNormals and feed that into the dot with the V3, the overall “light” is constant if i rotate but the “light” on the normal map is reversed at a certain rotation so it doesnt come out correctly. For instance, if i rotate the object along the Z axis above 180 degrees the Up vector in the normal gets reversed so that the “light” suddenly seem to come from below. So it seems like the normal map gets reversed at some point. If I don’t rotate the object but instead scale it to -1 in the Z axis, the “light” on the normalmap is still correct.

There is no need to blend normals, just use the normal map directly.
However you’ll need to transform your normalized light vector to tangent space.

ok, thanks man! However, I’m not exactly sure how to hook this up, can you please tell me the nodes and connections? I’m sorry, still trying to get my head around this. :stuck_out_tongue:

Sure,

Ok thanks you so much man! Now it looks good! However I noticed something… I set the light vector to .5, .5, 1, and everything looks good. But when I rotate the object (which is a quad plane with the face normal in the positive Z direction) around on the Z axis the lit hightlights from the normal map rotates with the object the first 90 degrees, so at 90 degrees it looks like the ligth comes from a different direction. During the next 90 degrees of rotation the light direction returns to the same as before. Is this normal?

Well, if you use a plane that’s an issue with your geometry being one-sided. Does it look right on a cube or sphere?

Well, I guess it does. Looks like the light comes from below, but it stays the same when rotated, yes. Any possible solution with a plane?

Flipped the green channel on the normal map, that did the trick it seems! :wink:

Edit: Ups, no it didn’t…

Here’s how it looks. You can see the problem. On the rotated surface the hightlight from the normal map and light vector dotted together gives a different result. It is very noticeable since it seems like the light comes from below or something… Any ideas?

For fake shine/specular reflection, you kind of need light vector and camera vector, then you make dot product of them (but that is where i am lost, so i may be wrong). Bigger the dot more shine the pixel should be.
I am working on material like that. Ie. material with fake light, using normal maps for shadows, and using camera+normal map for specular shine.

There is also second way for doing it: with ambient cubemap. It works well, but requires texture. Because I am doing it for mobile i rather find pure vector solution.

Ps. try to dot camera vector with this fake light material from picture above. Or google for UDK materials that have sun reflection, googling for this in UE4 is futile as almost every link leads to new features.
Here is such material, group D does that shine: Hourences.com – Tutorials – UE3 Water Outdoors
Idea is same, but needs to be translated to ue4 and use blueprints. Something like this should do specular shine.

Thanks man! But this was actually my bad… I want static lighting so no need for camera vector. Anyway, it turns out I’ve messed up when blending normal maps, that’s why it didn’t came out right. I also normalized and transformed the normal maps to World, instead of the light vector. Now everything looks and acts perfect. :smiley:

Maybe I’ll implement the specular thing later on, so thanks for the idea! :wink:

I have fake lighting in material like showed above and it works good. But when I add something to World Position Offset (for e.g. RotateAboutAxis), light is rotating with mesh.
Anyone knows how to make this properly?

This is my material:

Bro where is the material?