Skip to content

Conversation

@aidinabedi
Copy link
Contributor

Description

This PR documents the method clearVariants in Material.

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

@mvaligursky
Copy link
Contributor

What use case do you have that needs this to be public?
Currently it's internal function, and clears variants as needed, without you having to do it manually.

@Maksims
Copy link
Collaborator

Maksims commented Oct 31, 2025

Did not know about this method, and it actually pretty useful in case when updating global shader chunks, and need to force material shader updates.

@aidinabedi
Copy link
Contributor Author

What use case do you have that needs this to be public? Currently it's internal function, and clears variants as needed, without you having to do it manually.

@mvaligursky We need to call it in cases when we inherit pc.Material to create our own "smart" material like pc.StandardMaterial, which generate dynamic shader code based on material properties.

@mvaligursky
Copy link
Contributor

Did not know about this method, and it actually pretty useful in case when updating global shader chunks, and need to force material shader updates.

In this case, you just call material.update();

}

/**
* Clears all cached shader variants from the material and mesh instances that reference it.
Copy link
Contributor

Choose a reason for hiding this comment

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

we should add @protected tag on it - allowing derived classes to use it, but not making a public API

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.

3 participants