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

More flexible channels, types #42

Open
kylebarron opened this issue Sep 17, 2020 · 1 comment
Open

More flexible channels, types #42

kylebarron opened this issue Sep 17, 2020 · 1 comment

Comments

@kylebarron
Copy link
Owner

Right now I allow a maximum of 4 channels (bands) at a time in memory. At some point a user may wish to have 5 bands in a single algorithm.

A possible solution is to optionally store/allocate two image textures. I.e. right now I pass one vec4 image through the pipeline, but in the future you could pass two: vec4 image; vec4 image2.

Since I believe WebGL supports overloading, most algorithms could have code like:

vec4 sigmoidalContrast(vec4 arr, float contrast, float bias) {
...
}

vec4[2] sigmoidalContrast(vec4 arr1, vec4 arr2, float contrast, float bias) {
	arr1 = sigmoidalContrast(arr1, contrast, bias);
	arr2 = sigmoidalContrast(arr2, contrast, bias);
	return arr1, arr2;
}

(not sure if it's possible/how to return multiple textures from a function).

@kylebarron kylebarron changed the title Allow more than 4 channels More flexible channels, types Sep 20, 2020
@kylebarron
Copy link
Owner Author

You could add a general maxChannels argument. Then you change the signatures for DECKGL_MUTATE_COLOR and DECKGL_CREATE_COLOR to match that. E.g. for maxChannels=3 you'd have:

fs:DECKGL_MUTATE_COLOR(inout vec3 texture1, in vec2 coord)

For maxChannels=5 you'd have:

fs:DECKGL_MUTATE_COLOR(inout vec4 texture1, inout float texture2, in vec2 coord)

Note that you'd have to update each glsl function for every possible overloading...?

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

1 participant