Skip to content

Normalize Texture Sizes to allow Texture2DArray Generation #5

@transcendtient

Description

@transcendtient

This will allow GPU instancing for any number of animations by setting the appropriate uv.z to index the slice you want to animate.

I did this by passing textureSize into the private IEnumerator CreateAllAnimationTexturesForRig(Vector2Int[] sizes, int vertexCount, int fps, AnimationClip[] clips, GameObject original, Vector2Int maxSize) {

Here is the relevant changes.

for (int clip = 0; clip < clips.Length; clip++) {
            Texture2D result = new Texture2D(maxSize.x, maxSize.y, DefaultFormat.HDR, TextureCreationFlags.None);
            Debug.Log(sizes[clip].ToString());
            float clipTime = clips[clip].length;
            int frames = sizes[clip].y;

            //Color[] clearColors = new Color[sizes[clip].x * sizes[clip].y];
            Color[] clearColors = new Color[maxSize.x * maxSize.y];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions