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

Rendering error for property textures when 'offset/scale' are defined #12247

Open
javagl opened this issue Oct 10, 2024 · 0 comments
Open

Rendering error for property textures when 'offset/scale' are defined #12247

javagl opened this issue Oct 10, 2024 · 0 comments

Comments

@javagl
Copy link
Contributor

javagl commented Oct 10, 2024

(This came up while creating specs for #12237 )

The following is a sandcastle that loads an embedded glTF that defines a property texture with a 3-element fixed-length normalized UINT8 array property that defines an offset/scale in its class property:

https://sandcastle.cesium.com/index.html#c=tVhbc9o4FP4rGp7IJDVgSEpI0lkHSEtKIFybCx1GtoVRKsuOLIfQnfz3lWwcbGxn027XD2Cf66dzjqQjGQ71OHjCaIUYOAMUrUATedi3lWlAK84KRvDddCiHmCI2KxyAv2cUAIs4OmqABSQeOpjRl72TGZ3RhU8Njh0KDIYgR21bR6aJzM+EL4p7oaIR+GTI8wkXPgMaAOiZI+oJTa8RkQBo34znHme+wX0GydxGHJqQw5gEAJ6xRHaSBAA2G2BWaD9D2yVoFEgI4HEJg0DPQ96OnsQR6DQlO8UEgEIbxUyHZnZMy8dljosYxyjLyKuX+QI/I3NOELX4ck4dZkOCfwrKpNMb1+ejptbVhnPIGFxnmknjCQx+CA2CUB8E+hGiNVhhwdr6AtKVSIrtOhRRnjUY+fC1GzgKbeYIvVoZb6SDceQIb4Yl0otyjPmUN0A1k7nF/4YFZ7HwkDBxXymXD4Aqf6rl8vdMWc+AREC+V4XMAahlCb2kaLuU5Hf8K/4eZWIsat5nskLu42o7eTbCSpwV4pWZCumb9faHqg1TEz03QDkjNBw9Nx2HmdlcYwkpRUQOVKSgIlLx/T+EcqsbUaP/7Roy8WRh3It5kb2CzAqRFWiIBc5zWDwLsbHr/mKBmFwMk0PT1xz1N+UVp+/MgMOKWk1wg5I+ipHemFc2FNG+r8ZjZWMqg5gOQS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sILDb5oZN5bRNcb4T2JEkRc2U5iBZpmMcAV3oGEQA1xMmdQIE1ohVQhFr4oruPh4L4kcfnShEzMMgxptbhpOct7Wx0TM2RslFIKCkWWGEBRjijNnPQ64/ldMNxsd3szGvPku5kuDCK61WKO9VupXzgonHp8TdCnKM1/YdHjMi62XVJUlBJHojgETq+k+8YPxBXD8/ZOQuHTUlz11MRPAJtnGTdR4dlYcBY+ISNxlJ0VPp2WhHxKlTjQxNTqi56UwLUUW1Y+dUOioiinJfGZrckdh+iQ7Vj+Bw

It bails out with

An error occurred while rendering.  Rendering has stopped.
DeveloperError: Invalid vec3 value for uniform "u_example_fixed_length_normalized_UINT8_SCALAR_array_offset".
Error
    at new DeveloperError (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:10062:13)
    at UniformFloatVec3.set (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:37305:13)
    at ShaderProgram._setUniforms (https://sandcastle.cesium.com/CesiumUnminified/Cesium.js:38269:19)
...

According to the specification, this should be possible.

Some starting points for examining the reason and possible solutions:

While addressing the PR linked above, I've been thrown off a little bit by some "surprising" aspects of the implementation. It is not always apparent what the type of offset/scale should be. One specific aspect that surprised me is that ...

  • MetadataClassProperty.offset uses array types (e.g. a 3-element array for a 3D vector)
  • PropertyTextureProperty.offset uses object types (e.g. a Cartesian3 for a 3D vector)

Depending on where and how these values are supposed to be used, both can make sense. (Using different types of types in both places maybe not so much...). But in any case, if the "other" type of type is required for a certain task, then this implies some clumsy back-and-forth conversions, and the special handling of "3-element arrays as vec3 in shaders" require additional attention here.


Edit: When this is fixed, specs that follow the pattern of the one that is now about to be omitted at ed6ad00#diff-e7104646fcc3649a63c2a9e7468b5143778439156f8f4c56fc0e20a8256c4823R3594 may be added.

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