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

GSplatComponent API improvements #6734

Open
willeastcott opened this issue Jun 20, 2024 · 3 comments
Open

GSplatComponent API improvements #6734

willeastcott opened this issue Jun 20, 2024 · 3 comments
Assignees
Labels
area: assets area: graphics Graphics related issue V2 Work for initial release of V2 engine

Comments

@willeastcott
Copy link
Contributor

Check out: https://playcanvas.github.io/#/loaders/gsplat

To create the 3DGS entity, the example does:

    const createSplatInstance = (resource, px, py, pz, scale, vertex, fragment) => {
        const splat = resource.instantiate({
            debugRender: false,
            fragment: fragment,
            vertex: vertex
        });
        splat.setLocalPosition(px, py, pz);
        splat.setLocalScale(scale, scale, scale);
        app.root.addChild(splat);
        return splat;
    };

    const biker = createSplatInstance(assets.biker.resource, -1.5, 0.05, 0, 0.7);

Is there any reason this can't adhere to our standard addComponent style? Here's a sketch:

    const biker = new pc.Entity();
    biker.addComponent('gsplat', {
        asset: assets.biker,
        debugRender: false,
        fragment: fragment,
        vertex: vertex
    });
    biker.setLocalPosition(px, py, pz);
    biker.setLocalScale(scale, scale, scale);
    app.root.addChild(biker);
@willeastcott
Copy link
Contributor Author

Interestingly enough, debugRender doesn't actually seem to do anything!

@mvaligursky
Copy link
Contributor

apart from passing vertex and fragment, this all works already.
#7053 updates examples to use it.

@willeastcott
Copy link
Contributor Author

Ah interesting, you're right! Nice. So yep, if we can think of a better API to set up custom shaders, that'd be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: assets area: graphics Graphics related issue V2 Work for initial release of V2 engine
Projects
None yet
Development

No branches or pull requests

3 participants