mattatz/unity-volume-rendering

rendering volumes with non-equal dimensions?

russellu opened this issue · 2 comments

Hey do you know how to properly set up the 3d texture for a volume with non-equal dimensions, ie, a volume that is 200x200x100, instead of 200x200x200?

when i use your code, it stretches the z-axis in the above sample, so the volume looks stretched. however, when i change the vertices here

var vertices = new Vector3[] { new Vector3 (-0.5f, -0.5f, -0.5f), new Vector3 ( 0.5f, -0.5f, -0.5f), new Vector3 ( 0.5f, 0.5f, -0.5f), new Vector3 (-0.5f, 0.5f, -0.5f), new Vector3 (-0.5f, 0.5f, 0.5f), new Vector3 ( 0.5f, 0.5f, 0.5f), new Vector3 ( 0.5f, -0.5f, 0.5f), new Vector3 (-0.5f, -0.5f, 0.5f), };

it just cuts out part of the volume (ie, for the above example i would change all the z vertices to -.25 or 0.25, so that the mesh would take only half the space in the z (fitting the proportions of the 200x200x100 volume).

i am unable to set up a mesh with a texture of differently sized dimensions

here is the issue i posted on unity answers ,with a pic:

https://answers.unity.com/questions/1546255/3dtexture-does-not-scale-to-matrix-dimensions.html

you may find it easier to apply this shader to a cube, then scale the cube

you may find it easier to apply this shader to a cube, then scale the cube

solved 💯