Custom 3d Model - Lighting Issue

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Majo64
Posts: 11
Joined: Fri, 21. Aug 09, 19:42
x3ap

Custom 3d Model - Lighting Issue

Post by Majo64 » Mon, 25. May 20, 16:37

Hello everyone,

I'm currently experimenting with custom ship models and I've been able to get a bunch of ships into the game. However, I've recently encountered a problem with a couple of 3d models that I've been unable to fix.

The issue is related to how the custom ship shows up in the game. While the model and the material show up as they should, the way the ship is lit by stars/planets is rather strange. Unlike the vanilla ships in the game, the custom ship is either completely dark as if not hit by any light, or it's surface completely lights up, regardless of which side is facing the actual light source in a sector. Whether the ship lights up or is covered in darkness seems to only be dependent on its rotation.

I've made a short video clip to demonstrate the issue (including an Argon Buster to further highlight the way the lighting should be): https://youtu.be/CUtkpMe960U

At first I thought the issue was related to either the material properties or the texture compression, so I completely replaced the custom ship's material with a vanilla material and the issue still persists. It seems the problem might be related to the 3d Model itself or perhaps its UV map but at this point I don't know any way to make my way around this issue.


So my question is; has anyone ever experienced similar lighting issue and might know a way to fix it?

HarvaldX3
Posts: 1
Joined: Tue, 25. Apr 17, 16:18
x3ap

Re: Custom 3d Model - Lighting Issue

Post by HarvaldX3 » Mon, 25. May 20, 23:34

perhaps the dds files are missing mipmaps, or an incompatible dds format like BC7.

Majo64
Posts: 11
Joined: Fri, 21. Aug 09, 19:42
x3ap

Re: Custom 3d Model - Lighting Issue

Post by Majo64 » Mon, 25. May 20, 23:48

As I mentioned, I already tried completely replacing the custom ship's material (including all textures) with a vanilla material (it was the Teladi M5's Material, I simply copied it from the respective .bod file into the custom ship's .bod file). So I already tried using textures that have the right compression, unfortunately that resulted in the same lighting issue.

User avatar
Killjaeden
Posts: 5366
Joined: Sun, 3. Sep 06, 18:19
x3tc

Re: Custom 3d Model - Lighting Issue

Post by Killjaeden » Thu, 28. May 20, 22:06

Majo64 wrote:
Mon, 25. May 20, 23:48
As I mentioned, I already tried completely replacing the custom ship's material (including all textures) with a vanilla material (it was the Teladi M5's Material, I simply copied it from the respective .bod file into the custom ship's .bod file). So I already tried using textures that have the right compression, unfortunately that resulted in the same lighting issue.
Never seen anything like that
Check if your custom material would work OK on a vanilla ship to ensure its really not the material.

If the material is truly not the problem - check the model for anomalies. Flipped/inverted faces. Make sure smoothing groups are applied properly.
now that i think about it, consicering all faces are lit at the same time - Maybe the face normals (of the model) all point in the same direction? Something may have broke them either on export or in your software. What software do you use? Recalculate the face normals, reexport and check again. Check youtube tutorials how to do it in your software package if you dont know.
[ external image ]
X-Tended TC Mod Team Veteran.
Modeller of X3AP Split Acinonyx, Split Drake, Argon Lotan, Teladi Tern. My current work:
Image

Majo64
Posts: 11
Joined: Fri, 21. Aug 09, 19:42
x3ap

Re: Custom 3d Model - Lighting Issue

Post by Majo64 » Fri, 29. May 20, 21:13

Thanks for the suggestion. The face normals however all appear to be correct.

After trying once more to apply a vanilla material, this time I simply used one of the generic Meta_argon materials found on larger ships, the issue shown in the video in my first post did not occur again, at least not on the entirety of the ship. Now, the lighting issue only applies to parts of the model as shown in the image below.

https://imgur.com/a/osvo0KA
The picture shows the underbelly of the ship which is covered in shadow as the lightsource is on the opposite site. There are however some areas on the wings that are lit as if exposed to the light. At the same time, there are certain areas that are exposed to the light and still covered in shadows.

It's not impossible to assume that the initial issue actually was related to the properties of the .dds files in some way as the use of a vanilla material in this case does change the outcome. That said, there's still a notable issue with the way some of these areas are lit.

This new issue might have something to do with the model's vertex normals as within the viewport of gmax with smooth-shading enabled, the model shows a similar shading effect as shown in the first picture above.
https://imgur.com/a/WDlUUUx

Not sure where exactly the issue lies so I have to do some more testing.

User avatar
Killjaeden
Posts: 5366
Joined: Sun, 3. Sep 06, 18:19
x3tc

Re: Custom 3d Model - Lighting Issue

Post by Killjaeden » Mon, 1. Jun 20, 17:33

Majo64 wrote:
Fri, 29. May 20, 21:13
Not sure where exactly the issue lies so I have to do some more testing.
You need to assign different smoothing groups on sharp edges. Either that or split the sharp edge - it has the same effect on shading. Such black shades on the model always indicate that the face normals are too extreme - which can be due to smoothing groups, or simply because the geometry has not properly welded in some areas / has overlapping areas.
You should read this http://wiki.polycount.com/wiki/VertexNormal

The following are two dvanced tutorial that maybe can give you an idea about what it is like in practice - mainly for advanced modern techniques for controlling shading behaviour (in combination with normalmaps) https://www.youtube.com/watch?v=ciXTyOOnBZQ https://www.youtube.com/watch?v=_kONIPr_gBM
Idk if you can actually use custom vertex normals /normal weighting in X3 - mainly depends on if the bod format actually stores this information or not (i dont think so, but its been ages i looked at it)
[ external image ]
X-Tended TC Mod Team Veteran.
Modeller of X3AP Split Acinonyx, Split Drake, Argon Lotan, Teladi Tern. My current work:
Image

Majo64
Posts: 11
Joined: Fri, 21. Aug 09, 19:42
x3ap

Re: Custom 3d Model - Lighting Issue

Post by Majo64 » Fri, 5. Jun 20, 21:22

A temporary solution was to select all faces and select "Auto Smooth". Not perfect but it did fix the vertex normals so the ship now is shaded properly, at least when using a material like the ones on vanilla ships. So it seems the issue mentioned in the first post is related to the .dds file properties.

I'll have to check the individual textures of the custom ship to see which ones are causing the issue.

Majo64
Posts: 11
Joined: Fri, 21. Aug 09, 19:42
x3ap

Re: Custom 3d Model - Lighting Issue

Post by Majo64 » Sun, 14. Jun 20, 17:21

After doing some more testing, I was able to narrow down the issue to the bumpmap of the material. Unfortunately, this is where I'm stuck again.

When using the bumpmap of the texture (saved as .dds DXT5 via GIMP) the material will look like shown in the video from the first post, if I'm using a vanilla texture, say "metal_argon_simple_plating_bump.dds", the material is displayed as intended (minus the correct normal map of course). So the issue is clearly the normalmap file of the material. Am I using the wrong codec to save the .dds? Or is this related to something else?

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”