Comments (4)
see https://github.com/lebarba/WebGLVolumeRendering/tree/master/3DTextureConverter
from cesiummeshvisualizer.
JavaScript code:
function convert3DTexture(rawData, width, height, depth, flipY) {
var newWidth = width * maxTilesWidth;
var newHeight = height * maxTilesHeight;
var canvas = document.createElement('canvas');
canvas.height = newHeight;
canvas.width = newWidth;
var ctx = canvas.getContext('2d');
var imageData = ctx.getImageData(0, 0, newWidth, newHeight);
var realPosX, realPosY;
var index = 0;
for (var z = 0; z < depth; z++) {
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++) {
var value = rawData[index++];
realPosX = x + (z % maxTilesHeight) * width;
var yPos;
if (flipY) {
yPos = height - y - 1;
}
else {
yPos = y;
}
realPosY = yPos + parseInt(z / maxTilesWidth) * height;
var colorIdx = realPosX + realPosY * newWidth;
colorIdx *= 4;
imageData.data[colorIdx] = value;
imageData.data[colorIdx + 1] = value;
imageData.data[colorIdx + 2] = value;
imageData.data[colorIdx + 3] = value;
}
}
}
ctx.putImageData(imageData, 0, 0);
return canvas;
}
from cesiummeshvisualizer.
Thank you ,Now i get the canvas ,then ,i met the error ,when i put the canvas to the cubeTex:,the show nothing. Thank for you help,i use canvas.toDataURL('image/png');but not show the volume rendering.
from cesiummeshvisualizer.
ye. i use the C# code generate the texture ,it's work Thank you.
from cesiummeshvisualizer.
Related Issues (20)
- 请问能绘制点、或者动态的场吗?
- 请问这个支持模型文件加载吗?
- 是否支持给Cesium中加载的gltf、glb模型和3DTiles模型添加物理属性
- 用threejs生成了3D文字,但是使用scene.pick无法获取 HOT 2
- 示例代码有错 HOT 2
- 请问有交流的QQ群或者其他的地方吗 HOT 1
- 请问下模型加载上去以后,位置漂移的问题 HOT 1
- cesium Can Volume rendering draw it directly HOT 1
- demo中的initCesium.js有非压缩版么
- TTFLoader 示例引入initCesium报错
- 访问示例代码404 HOT 1
- Cannot read properties of undefined (reading 'fetchArrayBuffer') in initCesium HOT 1
- 加载dae文件,无法pick到,pick为undefined HOT 1
- The map can't show HOT 1
- Can I change black to transparent? HOT 3
- The Color Steps don't work?
- 无法绕固定的点旋转地球
- 如何动态的更新渲染参数? HOT 2
- 体绘制如何解决遮挡的问题 HOT 1
- 如何调坐标轴线的样式粗细之类的
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cesiummeshvisualizer.