Maybe there is nothing wrong. It just looks flat shaded to me.
Mesh normals imported from Blender look wrong with every export type except obj
I'm talking about the faces that are closing the ends as you said. They are inside of another part of the mesh. Though as @cybereality said, I think your mesh is just reflecting the sky colors the way it is because it's all flat shaded.
But if that shading is correct, how come I'm getting different results for obj?
I find it strange that two almost coplanar faces would reflect light that differently. The obj version looks way better to me.
Maybe understanding the difference between the two models will help me understand my issue. Is there any way I can show debug lines to look at the normals in Godot?
They might not be quite as co-planar after the triangulation that happens during rendering.
Try changing the lighting in Godot and see if that helps. You can try disabling the sky ambient light on the world environment and adding a simple directional light to test. Blender and Godot have default environmental light and they may not match up, so you can't compare renders exactly unless you customized the light and made them match.
Many thanks again for your input! But I must reiterate: I have an obj export of this mesh that looks perfectly fine in-game, the lighting of which matches what I can see in blender. So I don't think there's anything I can change on the geometry that would fix my issue.
Nevertheless, I've tried tweaking all the parameters I could find in the export settings, and also removed the caps at the top of the middle pieces, but nothing seems to do the trick.
I think it's a reasonable assumption to think some piece of the import/export pipeline is to blame, but I don't really know what else to try.
I've tried changed illumination settings around, and I haven't found a setup that fixes the problem. Take this shot as a comparison (first is the dae export, second the obj export), you can see the directional light as well.
There's also this one I took where I replaced the environment with a very basic one, with clear color (no sky), zero sky contribution (just in case), and white ambient light with a directional light, just to rule out the possibility that it's a sky reflection:
I see. Yeah, that definitely looks like a problem then.
Do you think I should open an issue on GitHub, then?
- Edited
It is probably worth opening an issue, though a minimum replication project (or in this case, 3D file) would probably be needed to help debug what is going on. There is definitely something strange going on with the importer though, since the normals shouldn't be all wonky like that.
Might not want to use DAE. Have you tried glTF?
- Edited
@TwistedTwigleg no problem, I'll upload the 3d files :+1:. Once I have some time I'll post the issue, then
@Megalomaniak I've tried glTF, FBX and the two collada exporters and they all seem have the same issue. Will make sure to include all the exported files in my example.
Again, thank you all for your time!
I just want to second the problem. My model uses a normal map (baked from a high poly version in blender) and looks absolutely fine in blender using Eevee as renderer.
But in Godot the lighting is messed up and it looks alot like a normal problem.
I am importing the model using gltf but it shows incorrect lighting no matter what I try (I even remodelled it 3 times which took alot of time since I remodelled the high poly version, too, and getting the baking right takes some time as well).
Blender
Godot
Unfortunately for me this is a deal breaker as the complete model consists of multiple meshes (body and wheels and a semitrailer with another 6 wheels not shown here) and bones. I exported the body as obj but was not able to load it into the mesh instance. The mesh is shown in the inspector but not in the viewport. Importing in parts is not a viable workflow for my coming models.
@Setzer22 Please post a link to the github issue when you reported the problem.
I am open for any help offered and willing to help investigate the problem.
@ReimGrab It's good to know I'm not alone! In fact, now that you mention it, I've also experienced issues with normal maps not looking quite right in my other models.
I haven't reported that anywhere yet, but perhaps it's all related to the same importer issue. I will try exporting my other meshes as obj and see if normal mapping works differently on them.
Oh, and here's the github issue link: https://github.com/godotengine/godot/issues/38854
In my case it's either a problem with my model or blenders gltf exporter. I went through the hassle of building Unreal Engine and the model shows the same messed up lighting. The good news is that Godot is working fine. The bad news that I don't have the slightest clue how to fix the issue.
@ReimGrab - Have you tried exporting with a different file type? I'd suggest trying an OBJ file, since it is fairly stable and well-supported, and see if it has the same messed up lighting issue. If it does not, then it is likely something with the encoding to a GLTF/other file process rather than the mesh itself, or at least that is what I would guess.
@ReimGrab it looks like it's either your mesh normals or the normalmap. When importing to godot did you also make sure to invert the normalmap color channel? I think it's y/green channel that might need to be inverted if it's up to the normalmap.
- Edited
@TwistedTwigleg Tried OBJ and it's the same.
@Megalomaniak I, too, think it's a normal/normalmap problem. And no, I did not try to invert any color channels of the map but will try it. Strange is that the wheels and the trailer look ok (not as good as in blender but ok). Is there any documentation/tutorial to learn more about the caveats of importing models from blender?
I have some decent knowledge of 3D math and coding. I have written small custom engines, scientific visualizations and the likes but I am a total noob when it comes to modelling.
Thanks for any help, really appreciate it, since I am totally lost here.
@ReimGrab It looks like the truck in Blender is one smoothing group. In Godot it seems like you have separate smoothing groups. ( The cab of the truck looks separated from the back end ). My best guess is smoothing groups are not exported correctly. Second guess is you baked different smoothing groups in your normal map. If it was normal map, the issue should disappear when you remove the normal map. I would import the same model into different 3D programs to determine if it was my normal map, or smoothing group. I would almost guarantee the problem lies in Blender 2.8's exporter.
@Ghost Thanks, for your input. AFAIK I did not use any smoothing groups. This isn't even my first vehicle. I already modelled a car and a bus which imported fine. I cannot think of anything I did different on the truck.
The left side of the truck looks alot better.
The normalmap is already messed up it blender.
Normalmap applied as albedo texture
But it renders just fine in blender as shown above (wtf???). Looks like I have to ask the blender guys what's going on here. Thanks to anyone for helping and sorry for hijacking the thread.