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 way to specify custom shaders #32

Open
bdpedigo opened this issue Apr 22, 2024 · 5 comments
Open

add way to specify custom shaders #32

bdpedigo opened this issue Apr 22, 2024 · 5 comments

Comments

@bdpedigo
Copy link
Contributor

would be nice to have a way to pass in custom shaders, e.g. for a skeleton in the segmentation layer. here's an example workaround I did just by modifying the JSON

shader = """
void main() {
    float compartment = vCustom2;
    vec4 uColor = segmentColor();
    emitRGB(uColor.rgb*0.5 + vec3(0.5, 0.5, 0.5) * compartment);
}
"""
skel_rendering_kws = {
    "shader": shader,
    "mode2d": "lines_and_points",
    "mode3d": "lines",
    "lineWidth3d": 1,
}

state_dict["layers"][1]["skeletonRendering"] = skel_rendering_kws

statebuilder.StateBuilder(base_state=state_dict, client=client).render_state(
    return_as="html"
)
@ceesem
Copy link
Collaborator

ceesem commented Apr 22, 2024

Just adding the shader as text will be trivial, but I would love some assistance/feedback to add helper functions to build a collection of useful shader primitives like this one.

@bdpedigo
Copy link
Contributor Author

would stuff like "color by component" fall under your view of primitives? any other specific examples you can think of?

@ceesem
Copy link
Collaborator

ceesem commented Apr 23, 2024

Yeah, "color by $property" is definitely one — it would be nice to have something that reads the info file and can predict/validate what values might be accessible. I'm also thinking more broadly than skeletons, since annotation layers and such also can have useful shaders.

@ceesem
Copy link
Collaborator

ceesem commented Apr 23, 2024

In this case, for example, how on earth would someone know that it's vCustom2 and not vCustom1 or... whatever?

@ceesem
Copy link
Collaborator

ceesem commented Jul 18, 2024

Skeleton shader support is now integrated into SegmentationLayerConfig objects, although smart defaults are not yet in there.

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

No branches or pull requests

2 participants