I have a very simple scene, which I will try to describe:
- There is a large square
Plane3d
with normal up direction +Z. - A Camera3d is far above looking down at the plane.
- There is a
PointLight
at the center of the plane, slightly above it. - The material applied to the plane is basically a flat colored
StandardMaterial::default()
with also normal map
Knowing the normal map would not work otherwise, I have generated the plane tangents using Mesh::generate_tangents
. This does make emboss effect of the normal map visible, however there is a clear discrepancy between how the light interacts with the plane when one compares the left side of the screen (which is much darker) with the right side of the screen (which is much lighter). My expectation is that the scene should look symmetrical.
I have tried different normal maps. I have also tried to call Mesh::duplicate_vertices
and Mesh::compute_flat_normals
before calling Mesh::generate_tangents
. It did not help. The only thing that seems to work is to manually generate for every vertex a tangent [0.,0.,1.,0.]
(so the same direction as the plane normal) and apply those using Mesh::insert_attribute
with ATTRIBUTE_TANGENT
. This would render a scene where the normal map effect seems to be correctly applied with symmetrical results.
For very simple cases like Plane3d
that approach is of course doable, but it seems that the same issue exists also for more complex standard shapes such as the Cuboid
.