-
Notifications
You must be signed in to change notification settings - Fork 106
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 property attribute point clouds sample #55
Add property attribute point clouds sample #55
Conversation
…com/javagl/3d-tiles-samples into add-property-attribute-point-clouds
Updated the sample to add a README, screenshot and sandcastle. The line
is still to be discussed: It should not be necessary to round up there. |
It seems like the attributes are being interpolated even though the mode is I put together some custom shaders to help debug this. Version 1: vertex shader only approach - works! CLASSIFICATION_SHADER: new Cesium.CustomShader({
varyings: {
v_color: Cesium.VaryingType.VEC3,
},
vertexShaderText: `
void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput) {
int classif = int(vsInput.attributes.classification);
vec3 color = vec3(1);
if (classif == 0) {
color = vec3(0,0.5,0);
}
else if (classif == 1) {
color = vec3(0.5,0.5,0.5);
}
v_color = color;
}`,
fragmentShaderText: `
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
material.diffuse = v_color;
}
`,
}), Version 2: fragment shader approach with custom varying - fails! CLASSIFICATION_SHADER: new Cesium.CustomShader({
varyings: {
v_classif: Cesium.VaryingType.FLOAT,
},
vertexShaderText: `
void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput) {
v_classif = vsInput.attributes.classification;
}`,
fragmentShaderText: `
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
vec3 color = vec3(1);
int classification = int(v_classif);
if (classification == 0) {
color = vec3(0,0.5,0);
}
else if (classification == 1) {
color = vec3(0.5,0.5,0.5);
}
material.diffuse = color;
}
`,
}), |
I have updated the colors with sRGB (not sure whether it's worth updating the screenshot as well), and applied the workaround that @lilleyse suggested. The issue of imprecise |
glTF/EXT_structural_metadata/PropertyAttributesPointCloud/README.md
Outdated
Show resolved
Hide resolved
I actually had noticed that in the comment, but didn't update it when copying the shader from the comment to the sandcastle. Updated. |
A DRAFT for an example showing point clouds with property attributes and statistics.