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 AudioReactiveBlendshapes.cs and related files #320

Merged
merged 2 commits into from
Sep 8, 2024

Conversation

fundale
Copy link
Contributor

@fundale fundale commented Sep 7, 2024

A small utility script based off AudioReactiveLight.cs for blendshapes, allowing a user to quickly drive blendshapes by specifying their index in an array.

A small utility script based off `AudioReactiveLight.cs` for blendshapes
if (audioLink.AudioDataIsAvailable())
{
// Convert to grayscale
float amplitude = Vector3.Dot(audioLink.GetDataAtPixel(delay, band), new Vector3(0.299f, 0.587f, 0.114f)) * 100f;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm this grayscale conversion looks sus to me. In the 4band section, each channel means a different thing (they are different levels of filtering, not chroma values). You should probably just select 1 single channel, and maybe put the channel select on a dropdown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Set it to access the pixel's red value for now,
I like the idea of having an option to select which channel to read from a pixel, though that may be better as a enum in a different file

@pema99
Copy link
Collaborator

pema99 commented Sep 7, 2024

Thanks looks nice - check my comment


public class AudioReactiveBlendshapes : UdonSharpBehaviour
#else
public class AudioReactiveBlendshapes : MonoBehaviour
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use [RequireComponent(typeof(SkinnedMeshRenderer))] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SkinnedMeshRenderer is now required

Require SkinnedMeshRenderer,
remove unused _dataIndex,
skip Vector.Dot and instead access pixel's red channel
@pema99 pema99 merged commit 7956eb2 into llealloo:master Sep 8, 2024
@fundale fundale deleted the utility-blendshape-script branch October 13, 2024 18:44
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.

2 participants