Download

Material detroys lighting

Hi,

i have a problems with shadows on my meshes.
While in many cases, the culprits are either improper set up UV maps or insufficient lightmap resolutions, in this case it seems to be the material setup that detroys the lighting.

Somehow pointlights look sort of like spotlights. They only cast light onto the mesh on one hemisphere:

be0ea5340e0996e0d04da563954c7a63870c99ed.jpeg

If I put another material (just a simple color) onto the mesh, the lighting behaves as expected:

de0d58df0507ab6b8168f7d2754a6dc4d1bf0a7a.jpeg

So it must be the material, but what is wrong with it :confused:

Here is how its set up:

There is a function that blends textured, based on a RGBA mask. The individual channels can also be “disabled” and replaced by a defaul color.
cdad7b085819a5ba0c6f34e946b1f6a3226dfa3e.jpeg

Func2.JPG

This function is used in the material to create the diffuse and normal maps:
328f4084d4292c4678a1805a0738a23d01cc656c.jpeg

c1cb3954c155257f77f0e48c42e2b095e5ce6dca.jpeg

And finally, on instance level, I assign some decent textures:
Inst.JPG

… and that instance is what finally goes onto the mesh.

Has anyone an idea what is going wrong with the lighting here?
(Note: Lighting was built as “production”)

Cheers,
Klaus

remove the normal map input and tell us if it’s still an issue. Just to narrow it down.
ps: never experienced this.

Hi,

Thanks for the reply. :slight_smile: I tested a bit with the normals and indeed it looks like the normal maps are responsible for the bad lighting.
But this is really confusing:

If I disconnect the normal input, the material looks flat, but is lighted correctly:
dfbd27df74d9ab19d6b81768bcdfb324856159ec.jpeg

To see, if maybe the blend function screws up the normals, I just hooked up a single plain normal map to the pin:
a518db392e6169abf02ad29e04408a0ec0ded87a.jpeg

This has the same effect on the lighting :eek:
Viewport2.JPG

I tried now to see if the mesh is somehow involved in this. So I created a simple brush and put the material on it.
On a brush, the material behaves normal:
Viewport3.JPG

The lightmap for the mesh should be ok:
8bb19d9e968314e8b4052152a1f8c9d6e3271299.jpeg

Also, with the simple material, the shading is correct. So I cant see what is going on here :confused:

When I checked the material instance settings, I noticed that I get a warning on the normals. What does that mean?
589ecb5fbed6d1894a40cc4f8a2941f50a41f25e.jpeg

Is there maybe something wrong with the normal texture?
Its settings are:
texture.JPG

Thanks for looking into this :slight_smile:

Cheers,
Klaus

In material editor check the texture sample for normal map and see if it is set to Color or Normal.

5bc186a1530f2e346315a66e87f4983daf968901.jpeg

Hi,

Thanks for the suggestion :slight_smile:
The sample type is “normal”. I checked and also all parameters that deal with normals. They were set to color. I changed them to “normal”.
Now, the error is gone, but I still get that lighting effect.

I tried with a simpler material setup:
The diffuse parameter sampler type is set to “color”, and the one for the normal parameter is set to “normal”.
e95654de2e4748cabea294bb7ad00f1d7a9b2d74.jpeg

With an instance that does not use a normal map:
inst1.JPG

I get a correct lighting:
2a32828f14b3df1ccd5cf2c25bd357d9345bc192.jpeg

Now I use a normal map (that was imported as normal map and is compressed as TCNormalMap, like the one above):
c1b7592487759e53c014311c498b30b78c6a47f3.jpeg

Then I get a broken lighting again :frowning:
1f808382fbea725df454eb73bf554fce86389aa3.jpeg

In the past, I never noticed such problems with normal maps. I feel like someone who forgot how to tie shoes … :confused:

Cheers,
Klaus

Maybe something is wrong with your normal maps themselves. Have you tried plugging a normal map from the starter content?

Hi,

Thanks :slight_smile:
Yupp… Its the normal map dat that causes this.

I migrated some normal textures from the starter content and it looks like this:
020521121c83741ee49e39d900058cf97ef83412.jpeg

So I reviewed the normal map generation process.
I use the NVIDIA photoshop filter to create my nomral maps.
I recreated one of the rock texture normal maps from the diffuse with these settings:
096efc5381dfb98376f317f30093b5ede274816f.jpeg

When imported into UE4, I can see already a difference in the thumb image:
249eb47d15c72cbc94efb6589fe43058cb8029f7.jpeg

When I use that normal in a material, it works :slight_smile:
The normal textures on the lower plane are from the starter content. The wood texture shows the newly rendered normalmap based on the rock diffuse:
0e14c4542e853da53149b29b946cdbef8d3c6f6c.jpeg

So it is established that my (initial) normal maps are crude. I played abit around with the NVIDIA filter parameters.
I have to admit that Im not always sure what Im doing there. I experiment a lot because I cant find a decent description for that filter and what each parameter does.
Its possible that I generated the original normal maps with some absurd value so that the result is overdriving something now. I dont know.
Does anyone have any information about the filters settings :confused:

Cheers,
Klaus

I’ve never used nvidia’s normal map generator so i cant help you there. But i’m glad you found the troublemaker. :slight_smile:

Try to make sure that when you import a normal map that it knows to import it as a normal map, rather than changing settings for the texture after it’s imported. You can make sure it does this by adding the word normal to the file name. I think it was a similar issue in UDK that changing the settings after importing didn’t adjust the texture correctly while having it set correctly will work.

The nvidia normal map tool has a depth setting, usually 3 to 5 are good, also make sure it’s RGB biased / height cant remember the name atm.
Artists usually build their own texture etc by creating the low poly and building a high poly then bake the info.

This isn’t my field a 3d artist should give you some more details about the whole process.