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

cgame: introduce cg_lowModels to load low quality models #2989

Open
wants to merge 1 commit into
base: for-0.55.0/sync
Choose a base branch
from

Conversation

illwieckz
Copy link
Member

@illwieckz illwieckz commented May 8, 2024

Add cg_lowModels to load low quality models.

The purpose of this cvar is to be used in low and lowest presets.

If cg_lowModels is enabled, when looking for buildables/eggpod/eggpod.iqm, load buildables/eggpod/eggpod_low.iqm if it exists.

It is only implemented for buildables for now, I may implement it for player models later.

The purpose is to load a low quality variant of a model for performance purpose.

This may be a low poly model, but I doubt we have the resource to produce some.

What we can do though, is to edit existing IQM models with IQE Browser and delete some bones.

Some low-end old graphics card can only hardware accelerate the model animations if the models have no more than 41 bones.

Some of our models have many more than that, sometime more than an hundreds of that, forcing the game to fallback on a slow CPU implementation.

But many of our models have some bones we can remove, like legs of buildables. Those legs are animated for moving when being hurt or things like that, but removing the leg animation bones and a few others like the head bones do not break the whole animation most of the time.

It looks like Cvar::Latch is not implemented yet on CGame side, this would be appreciated as the cg_lowModels cvar should be latched (we need to reload the models to see a difference).

This commit should works on master but I make this PR target for-0.55.0/sync because since it requires models that are not released, no one can use the cvar yet anyway, and targetting the for-0.55.0/sync makes things easier to me when dealing with the various repositories.

@illwieckz
Copy link
Member Author

illwieckz commented May 8, 2024

Example, default models:

unvanquished_2024-05-08_113419_000

Low models I modified:

unvanquished_2024-05-08_132636_000

@VReaperV
Copy link
Contributor

VReaperV commented May 8, 2024

This may be a low poly model, but I doubt we have the resource to produce some.

We can probably generate them from the original models.

@illwieckz
Copy link
Member Author

illwieckz commented May 8, 2024

The effort of doing low poly models is probably not worth it anyway, the gain would not be worth the effort.
The performance killer here is the amount of bones, which is easy to reduce for most buildables.

@VReaperV
Copy link
Contributor

VReaperV commented May 8, 2024

I agree.

@illwieckz illwieckz force-pushed the illwieckz/low-models branch 4 times, most recently from cabe219 to c7457d5 Compare May 8, 2024 11:40
@@ -526,21 +526,21 @@ static bool CG_ParseBuildableSoundFile( const char *filename, buildable_t builda
return true;
}

static bool CG_RegisterBuildableAnimation( buildableInfo_t *ci, const char *modelName, int anim, const char *animName,
static bool CG_RegisterBuildableAnimation( buildableInfo_t *ci, const char *modelName, const char* foundSuffix, int anim, const char *animName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a single argument with the contents of fileBase from the other function, instead of modelName+foundSuffix?

@@ -182,6 +182,8 @@ Cvar::Cvar<std::string> cg_sayCommand("cg_sayCommand", "instead of talking, chat
// TODO: only works for player models. Buildings and weapons are also relevant
Cvar::Cvar<bool> cg_lazyLoadModels("cg_lazyLoadModels", "load models only when needed", Cvar::CHEAT, false);

Cvar::Cvar<bool> cg_lowModels("cg_lowModels", "load low quality models when available", Cvar::NONE, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cg_lowQualityModels?

@DolceTriade
Copy link
Member

How are you generating these models?

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

Successfully merging this pull request may close these issues.

None yet

4 participants