Volume redering using Texture3D requires geometry.translate

I have a question regarding texture3D. I am new to the 3D world. I was looking at volume rendering and came across this example https://github.com/mrdoob/three.js/blob/master/examples/webgl2_materials_texture3d.html

My question is about these three lines.

// line 119 - 122
// THREE.Mesh
const geometry = new THREE.BoxGeometry( volume.xLength, volume.yLength, volume.zLength );
geometry.translate( volume.xLength / 2 - 0.5, volume.yLength / 2 - 0.5, volume.zLength / 2 - 0.5 );

const mesh = new THREE.Mesh( geometry, material );

Why we need geometry.translate?

Suppose I change this example to use THREE.MeshBasicMaterial without the volume rendering just a static color, then I don't need any translation.

Can someone please explain why the geometry.translate?



Read more here: https://stackoverflow.com/questions/67932877/volume-redering-using-texture3d-requires-geometry-translate

Content Attribution

This content was originally published by abhishekworld at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: