DragonFF icon indicating copy to clipboard operation
DragonFF copied to clipboard

The problem with rendering alpha textures in the game

Open Calvin-rgb opened this issue 2 years ago • 14 comments

I edited the model, it draws everything correctly in the program, all the settings seem to be correct, for some reason it does not draw the interior of the car through the rear-view window in the game. How to fix it?

In Blender:

Calvin-rgb avatar Oct 25 '22 08:10 Calvin-rgb

*The hierarchy has not changed *Such a bug appears when the player gets into the car

Calvin-rgb avatar Oct 25 '22 11:10 Calvin-rgb

At the same time, I just replaced one alpha texture with another alpha texture

Calvin-rgb avatar Oct 25 '22 11:10 Calvin-rgb

Check #171

It's to do with the order of the models and materials. Make sure the windows are below the chassis in the model hierarchy.

Parik27 avatar Oct 25 '22 12:10 Parik27

Check #171

It's to do with the order of the models and materials. Make sure the windows are below the chassis in the model hierarchy.

Yes, thank you But just like other people, names are very important for the script to work and renaming is not very easy I hope this can be fixed by changing the addon :)

Calvin-rgb avatar Oct 25 '22 12:10 Calvin-rgb

@Parik27 Hello I have studied this problem a bit, as I think it is very important for a modding tool. I used Zmodeler 2.2.6 to edit the car model, and found out that this program, when exporting a DFF car model, moves all alpha materials to the end of the list of the hierarchy of materials. That is, it does not matter how the objects are placed on the stage and in the hierarchy, but it is important in what order the alpha materials are displayed in the general dff hierarchy.

Am I thinking right?

If it still works, it would be possible to add this to DragonFF by adding a couple of parameters when exporting the model to the game. I would like to see a solution to this problem in the near future :)

Calvin-rgb avatar Oct 26 '22 15:10 Calvin-rgb

@Calvin-rgb I don't think it does that. The order of the objects does matter from my testing (read my comments on #171 ). Making the plugin reposition alpha materials on export breaks alpha properties of other objects (I tried by exporting a default GTA model). It also did not fix the issue in #171 which requires repositioning the objects.

The material list is per-object, so even if you moved all alpha material to the bottom of the list, it won't fix the issue if the window model is placed above the chassis.

So to conclude, you can only see vertices through a transparent material:

  • That are placed above the transparent object in the scene hierarchy
  • (in case of the same object), vertices that have a material index higher than the transparent material (in Blender, you can reposition these slots in the material list).

It's not ideal to move all alpha materials to the bottom of the list (even if I add a checkbox, you might have a situation where you would want to have an alpha material placed above non-alpha materials). A more complex solution is required for this issue.

Parik27 avatar Oct 26 '22 17:10 Parik27

@Parik27 I apologize for my wrong thoughts. I hope there is a solution to the problem, we will wait.

Calvin-rgb avatar Oct 27 '22 06:10 Calvin-rgb

There were problems with Z culling of the glass doors, I fixed it. Now I can't fix the interior display through the sunroof I duplicated the hatch object, renamed it "zzz" and deleted its original. According to the hierarchy, it is below the model of the car interior, so what is the problem? @Parik27

Calvin-rgb avatar Oct 30 '22 18:10 Calvin-rgb

Maybe try to implement flags for materials? As it is done in zmodeler, by type glass_mat [flag 4, spec]

Calvin-rgb avatar Oct 31 '22 08:10 Calvin-rgb

I would need the dff file for investigating it.

Is that functionality not available in the DragonFF Materials menu?

Parik27 avatar Oct 31 '22 09:10 Parik27

I would need the dff file for investigating it.

Is that functionality not available in the DragonFF Materials menu?

Here is the model


I was thinking, and I thought maybe this is due to the fact that I set the "Read Material Split" parameter when importing the native model? And because of this, the ID of materials does not work correctly @Parik27

Calvin-rgb avatar Oct 31 '22 09:10 Calvin-rgb

For me, cars don't even import correctly without "Read Material Split" checked. They import with the materials assigned wrong.

ThePortuguesePlayer avatar Oct 31 '22 12:10 ThePortuguesePlayer

For me, cars don't even import correctly without "Read Material Split" checked. They import with the materials assigned wrong.

My imports are fine, even with the Read Material Split turned off

Calvin-rgb avatar Oct 31 '22 12:10 Calvin-rgb

this occurs when the glass, and the surrounding model that you want to be visible through the glass, are connected. select the object that has the glass, go into edit mode, and select the faces that are going to have transparency, and press Y, this will detach it from the chasis, without separating it from its object. export it and check the results. I'm guessing this happens because just importing the model will merge the nearby vertices

Dotterkletch avatar Oct 04 '23 07:10 Dotterkletch