Parik27 / DragonFF

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

Export - Cannot Multiply Vertex Colors to Texture #278

Closed Martyste closed 7 months ago

Martyste commented 7 months ago

Hi,

I'm trying to restore unused Beta content for Asterix & Obelix XXL, which used Renderware and DFFs like GTA. The recovered GLTF level meshes from the 2020 remaster need to be converted to DFF before importing into the Original and there's an issue with the vertex colors.

The vertex colors are meant to blend to the textures with "Multiply", but unfortunately, if in my Material Node tree I have anything between the Texture and Principled BDSF, or between the latter and Material Out, DragonFF will ignore that tree and generate a new one, leaving me with a dff containing "mixed" vertex colors instead of multiplied.

Necessary Node Tree on the bottom, auto-generated Node Tree on the top: image

Wrong vertex colors: image

Desired result: image

I know this tool is GTA focused but your blender addon is currently the only way for accurate Beta restoration of this game 20 years later, it would mean the world to me and the Asterix XXL community if there was a way for your tool to accept some vertex color blending modifications for import. Thank you so much.

Parik27 commented 7 months ago

I'm not sure what exactly you want to do. Vertex color blending is defined by the game. If there exists a DFF file with a different vertex colour blending, it might be an extension to the format used by the game. If so, you can share the DFF file and I'll look into it to see what exactly determines that to add import/export support for it.

If you just want to import DFF files with a certain vertex color blending to export in a different format, writing a separate script would be more suitable for that.

Martyste commented 7 months ago

Sector 1.zip Here, you can have both the DFF I exported as well as the source glb ( converted from .gen ) that should still have every parameter intact. You may need the textures in the same folder: textures.zip To explain it as simple as possible, when importing the glb to blender, every material has been assigned a material node tree to accurately depict how each texture should be seen ( alpha, specular, and vertex color multiplied ). But when exporting to DFF, all these trees are considered invalid despite using Principled BDSF at their core, and most parameters are lost. It's fine for Alpha and possibly specular, as the materials can still be given those flags in the game files after import, but the blending or intensity of vertex colors cannot be adjusted. Lastly, DFFs will be supported as GTA VC and SA versions.

Martyste commented 7 months ago

Ro_Sector1.zip And while i'm at it, here's the blender project file ( 4.0.1 ) if you need to test that specifically.

Martyste commented 7 months ago

Well, I am relieved to come back to you with good news, after tons of testing it turns out indeed that DragonFF doesn't mess with the vertex colors, it was actually the conversion from .gen to .glTF and import into Blender that did, and someone made a python script to counterract the problem from another angle: vertex colors must be converted from sRGB to Linear. So things are back to where they should be! I'm sorry for this issue and will promptly close it. Here's a final comparison between a 2002 Beta screenshot and what is now back in place. Wishing you the best going forward, and thank you again for your tool making this possible. image image