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

pass custom attribute defined in GeometryInstance to the vertex shader #12319

Open
mickae1 opened this issue Nov 20, 2024 · 0 comments
Open

pass custom attribute defined in GeometryInstance to the vertex shader #12319

mickae1 opened this issue Nov 20, 2024 · 0 comments

Comments

@mickae1
Copy link

mickae1 commented Nov 20, 2024

Feature

For the moment, it's not possible to put custom attribute defined in the GeometryInstance to the vertexShader, this would be great to add more flexibility.

const geometryInstance1 = new Cesium.GeometryInstance(
	{
		geometry: new Cesium.PolylineGeometry({
		  positions : Cesium.Cartesian3.fromDegreesArray([
			0.0, 0.0,
			5.0, 0.0,
			5.0, 5.0
		  ]),
		  width : 10.0,
		  arcType: Cesium.ArcType.GEODESIC
		}),
		attributes: {
                    test: new Cesium.GeometryInstanceAttribute({
                               componentDatatype : Cesium.ComponentDatatype.FLOAT,
                               componentsPerAttribute : 1,
                               normalize : true,
                               value : [50]
                           })
		}
	}
);
const geometryInstance2 = new Cesium.GeometryInstance(
	{
		geometry: new Cesium.PolylineGeometry({
		  positions : Cesium.Cartesian3.fromDegreesArray([
			0.0, 0.0,
			-5.0, 0.0,
			-5.0, -5.0
		  ]),
		  width : 10.0,
		  arcType: Cesium.ArcType.GEODESIC
		}),
		attributes: {
                    test: new Cesium.GeometryInstanceAttribute({
                               componentDatatype : Cesium.ComponentDatatype.FLOAT,
                               componentsPerAttribute : 1,
                               normalize : true,
                               value : [50]
                           })
		}
	}
);





const primitive = new Cesium.Primitive({
  geometryInstances : [geometryInstance1, geometryInstance2],
  appearance: new Cesium.PolylineMaterialAppearance({
	translucent: false,
	vertexShaderSource: vertexShader,
	fragmentShaderSource: fragmentShader,
	material: new Cesium.Material({
	  // https://github.com/CesiumGS/cesium/wiki/Fabric
	  fabric: {
		materials: {
		  // The arrowMaterial provides the color and overall shape.
		  arrowMaterial: {
			uniforms: {
                              genericVariable that can be catched by the fragment shader
                              ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant