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

Model with rvmat with >7 Stages rvmat crashes Game #80

Open
dedmen opened this issue May 30, 2018 · 1 comment
Open

Model with rvmat with >7 Stages rvmat crashes Game #80

dedmen opened this issue May 30, 2018 · 1 comment

Comments

@dedmen
Copy link
Contributor

dedmen commented May 30, 2018

with #79 so that SuperExt can work.
When building https://cdn.discordapp.com/attachments/105781923573456896/449707944771321885/wolf_kh.7z

I cannot open the p3d in Mikeros Eliteness Debug: lod size mismatch.
I'm very happy that the rvmat contains the Emissive Stage.. BI and mikeros tools remove it when packing the p3d. I heard mikeros paid tools work.

But when trying to place the model Arma crashes.

BinarizeFail.zip
Armake vs Mikero. Files are different but they should be the same. And armake one is crashing Arma when trying to render. Debinarizing using CfgConvert both files give back the same correct output

p3dOutputs.zip
P3D outputs mikero vs armake. Armake is smaller but contains atleast a reference to my z\wolf\addons\KH\tex\lod0Tex_StairMat_EM.paa Mikeros is bigger, 0 results when searching for EM. Although it was in the binarized rvmat that mikero should be packing.

@dedmen
Copy link
Contributor Author

dedmen commented Nov 25, 2018

Eliteness bug is fixed in #95

The crash is caused by armake writing too many texGen's.
There are only 8 texGen's. in armake they are called stage_transform.
Armake add's one transform per stage, which is simply wrong :D
We should only push a new transform/texGen if the actual transform (uvSource and uvTransform) doesn't exist yet. And throw an error if a user tries to use too many.

https://github.com/KoffeinFlummi/armake/blob/master/src/material.c#L385
Here. Only dynamically add a new transform if we can't find one with same values.

my armake++ hotfix for now is this

    if (num_transforms > 8) {
        logger.error("Too many texGen's being used in RVMAT! Armake will clip excess off and cause weird behaviour! %s\n", path.c_str());

        num_transforms = 8;
        transforms.resize(8);

        for (auto& it : textures) {
            if (it.transform_index > 7) it.transform_index = 7;
        }
    }

atleast until I implement the pushBackUnique style texGen list.

Could also force users to use texGen manually if over 7 Stages.
https://community.bistudio.com/wiki/Multimaterial#Example
But I prefer that armake tries to fix it by itself first. The user must use less transforms either way.

@dedmen dedmen changed the title Model with SuperExt rvmat crashes Game Model with rvmat with >7 Stages rvmat crashes Game Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant