Using floating point data textures


As an experiment, I’d like to load data from a GeoTiff texture and pass it through to a shader. The goal is to generate colors, using the unconstrained values in the geotiff. This experiment is part of my larger exploration into the world of Cesium. I’m currently using Resium in a Create-React-App.

I’ve got a primitive describing a rectangle, to which I’ve assigned a new materialappearance. My shader is in the source property for the material assigned to the material appearance, not in fragmentShaderSource of the appearance.

I’d like to pass a new WebGLTexture with GL.R32F format as a uniform into the material. I’ve grabbed the WebGLContext from the viewer, and am creating a new texture succesfully.

However, when I try to assign my texture to a uniform in the material, I get a Fabric Error: ‘Uniform is invalid type’

Does anyone know what I’m doing wrong? How can I my desired effect?

Thank you for your help

Hey @MatthiasVL - welcome to the Cesium community!

I wanted to mention that we do have an open feature request for making this kind of thing easier: So if you make some progress here it would be great to share it with the community.

I think Fabric (CesiumJS’s material system) may be expecting the image passed to be a URL or an HTMLImageElement. You can read a bit about how Fabric works here:

This is where it checks for the uniform type:

You may need to extend this to allow passing a texture directly.