I want to change the transparency of the 3D Tiles model, but I have not been able to modify it successfully. Here is my code:
<script setup>
import { ref, onMounted, onActivated } from "vue";
import { Ion, Viewer } from "cesium";
import * as Cesium from "cesium";
const viewerRef = ref(null);
let viewer;
let tileset = null;
onMounted (() => {
viewer = new Viewer(viewerRef.value, {
});
window.viewer = viewer;
loadTiles();
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(104.6225, 31.77655, 2100),
orientation: {
heading: Cesium.Math.toRadians(0),
pitch: Cesium.Math.toRadians(-35),
roll: 0.0,
},
duration: 0,
});
});
const loadTiles = async () => {
tileset = await Cesium.Cesium3DTileset.fromUrl(
url ,
);
viewer.scene.primitives.add(tileset);
tileset.style = new Cesium.Cesium3DTileStyle({
color: 'color("rgba(255, 0, 0, 1.0)")',
});
tileset.readyPromise.then(function() {})
};
</script>
<template>
<div ref="viewerRef" id="cesiumContainer"></div>
</template>
Edited: The code formatting was broken, and the actual core was posted in another thread - I added the formatted code here