Closed javagl closed 2 years ago
Thanks @javagl, I tried out your tileset and I see the problem, this is a bug in code I had written. Everything is supposed to be declared as a vec4
, that's clearly not happening
When I run he generated fragment shader it looks like this:
varying vec3 v_color_0; // should be a vec4
struct ProcessedAttributes
{
vec3 positionWC;
vec3 positionEC;
vec3 positionMC;
vec3 color_0; // should be a vec4
};
...
void setDynamicVaryings(inout ProcessedAttributes attributes)
{
attributes.color_0 = v_color_0;
}
I'm not entirely sure, but I think it might have to do with these lines: https://github.com/CesiumGS/cesium/blob/aa0dfaf304600ffb94db5f01d976f81df2665069/Source/Scene/ModelExperimental/GeometryPipelineStage.js#L258-L261 -- I'm not taking into account that these attributes are color_N
since you could potentially have multiple sets of vertex colors.
When trying to render a glTF that contains a "point cloud" with colors that are declared as a
VEC3
withGL_FLOAT
components, it generates an error message:The title and the quick summary here already contain many guesses. For example, I have to admit that I did not try out whether it can render a glTF with
VEC4
colors, but ... based on the error message, I think that theVEC3
is the reason for the crash: The fragment shader code probably contains a hard-wiredvec4
for the colors, and attempting to feed it with avec3
does not work. If this is the case, the fragment shader code "template" has to fetch the information of whether it should usevec3
orvec4
from the glTF accessor.The attached file contains
3DTILES_content_gltf
)ViewerCode.txt
with the sandcastle code where I tested this locally (reduced to the bare minimum to reproduce)ErrorMessage.txt
with the full stack traceCesium testColorVec3 2021-11-30.zip