Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Material Flag input on export of PSK #78

Closed
SilverDash opened this issue Feb 22, 2024 · 6 comments
Closed

Add Material Flag input on export of PSK #78

SilverDash opened this issue Feb 22, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@SilverDash
Copy link

Currently you can't specify Material Flags when exporting the PSK model.

A game like UT99 ignores Texture flags and only takes into account the PSK MAT0000 bytes.

I saw that it was supported but just not implemented in the python files.

@cmbasnett
Copy link
Member

You'll have to be more specific about what it is you want here. I'm not familiar with the material flags or what the handling is like. Is there some documentation around this?

@SilverDash
Copy link
Author

SilverDash commented Feb 23, 2024

_write_section(fp, b'MATT0000', Psk.Material, psk.materials)  



    class Material(Structure):
        _fields_ = [
            ('name', c_char * 64),
            ('texture_index', c_int32),
            ('poly_flags', c_int32), <<<<<<<< it would be this bit of data
            ('aux_material', c_int32),
            ('aux_flags', c_int32),
            ('lod_bias', c_int32),
            ('lod_style', c_int32)
        ]

The poly flags section of the PSK contains info on whether or not the texture applied has a specific kind of flag.

Masked, Transparant, 2Sided, ect

I recently had a model with eye textures that needed to be exported with Poly flags set to 2 for masked because older engines like UT99 only read the raw PSK data to determine stuff like that.

struct VMaterial
{
    ANSICHAR            MaterialName[64];
    INT                    TextureIndex;  // texture index ('multiskin index')
    DWORD                PolyFlags;     // ALL poly's with THIS material will have this flag.
    INT                    AuxMaterial;   // reserved: index into another material, eg. detailtexture/shininess/whatever.
    DWORD                AuxFlags;      // reserved: auxiliary flags 
    INT                    LodBias;       // material-specific lod bias
    INT                    LodStyle;      // material-specific lod style
};

Should be the the info the engine side is reading.

An example of the exported PSK data where Mat slot 0 has the flag set for Masked.

image

@SilverDash
Copy link
Author

So basically you'd need to flag the surfaces that you want to apply Masked to. This could be done by looking at the vertexgroup and assigning a value.

@cmbasnett cmbasnett self-assigned this Feb 23, 2024
@cmbasnett cmbasnett added enhancement New feature or request and removed needs more information labels Feb 23, 2024
@cmbasnett
Copy link
Member

I understand. What this would probably look like would be a special panel in the Material properties that would have a big list of the poly flags that could be toggled on and off. Does that sound like what you're looking for?

@SilverDash
Copy link
Author

Pretty much. I'm not sure it's possible for there to be more than one enabled. Not sure if there's an exact spec for the PSK format out there.

I also don't know the full exact list of flags. Would need to experiment. But I assume it's similar to Texture flags in Unreal engine.

@cmbasnett
Copy link
Member

This has been implemented in 6.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants