Parik27 / DragonFF

Blender Add-on to edit RenderWare and GTA Formats
GNU General Public License v3.0
362 stars 128 forks source link

[Bug] The problem of exporting normals on vehicle materials #118

Open Calvin-rgb opened 2 years ago

Calvin-rgb commented 2 years ago

There is a BMW e39 model, the model is displayed normally. I decided to change the model, imported the model into the editor, exported it to the game after the changes and saw a strange display of the door panes:

And after importing this model back, I decided to make sure the grid was correct:

This is how the glass looks before importing the model into the blender:

I understand that the problem is in the addon, since there were no such problems before importing the model.

Calvin-rgb commented 2 years ago

I also tested the model with the Read material split flag, the problem remained

Calvin-rgb commented 2 years ago

I found a solution to this problem, as I found out the problem is in the wrong normals of polygons. You need to select the inverted polygons, make a flip, after which strange shadows will appear on the grid, then make a Set From Faces. *After correcting the incorrect normals, the glass model looks good in the game. изображение

But the question still remains open, can you fix it?

Calvin-rgb commented 2 years ago

I thought that this problem concerns only one model, but for the experiment I opened another model of the Nissan S15, and I again saw the inverted normals of polygons on the glass material: *Incorrect normals are highlighted in red. изображение

By the way: the texture superimposed on the material on these two models is absolutely the same, the texture is a resolution of 1x1 pixels. Drenched in black. BUT I think that this is not a problem because of the material that is superimposed on the mesh, but still the addon cannot correctly read the normals of polygons? @Parik27

Parik27 commented 2 years ago

Could you send me a model that has this issue so I could test it?

Calvin-rgb commented 2 years ago

Of course, I attached two archives at the bottom:

  1. s15_no_bug - the original model, which was not changed with the help of DragonFF
  2. s15_bug_normals - the model after exporting via DragonFF

Note: in order to better see the inverted normals, it is better not to unpack the archive with textures. s15_bug_normals.zip s15_no_bug.zip

@Parik27

Calvin-rgb commented 2 years ago

Can I also add some kind of notification when the model is successfully exported? It's just that my program freezes and I'm waiting for it to stop freezing, and even when it stops freezing, I don't see any notifications about the successful export of the model and I can continue to sit and wait like this🤦‍♂️

Parik27 commented 2 years ago

CC @Calvin-rgb @ThePortuguesePlayer

If you could check the next version in development here it'd be very helpful: https://github.com/Parik27/DragonFF/tree/new-export

I've changed the way the exporter generates the vertices/normals/etc., and it intends to fix custom normal and other geometry related issues. If you could check if the add-on produces correct results for models now, it'd be very helpful.

I tested it with a cube, the results seem pretty promising, however we still need to make sure that anything else hasn't broken and large models export properly.

Comparison: (Left is exported with previous version, right is exported with the latest one on the new-export branch)

I also have pushed a fix for the SAMP 0.3.DL issue with skins getting deleted.

Calvin-rgb commented 2 years ago

I apologize for my long disappearance, I checked this branch of the add-on with that car model for GTA SA. And yet it seems to me that this problem lies precisely in this model, and not because of the script. Perhaps this bug occurred when exporting this machine model to 3ds max.

Calvin-rgb commented 2 years ago

But the work with the export was done well, why can't it be introduced into the standard development branch? @Parik27

Parik27 commented 2 years ago

I can merge it in the main branch, but it is about twice as slow as the previous method to export a model so I wasn't sure.

Calvin-rgb commented 2 years ago

Yes, I think it won't matter how long it takes to export