|
|
Hi all, I need to be able to render arbitrary functions easily. In other words,
the following function would draw a sphere by checking a giant 3D grid of
say... 100x100x100 voxels to check if the point is in the sphere:
// Check through multiple x, y and z voxels to draw a sphere:
bool sphere(float x, float y, float z) { // x, y and z are normalized to 1 or
less.
float f = sqrt(x^2 + y^2 + z^2)
if (f<1.0) return 1; // Part of sphere
else return 0; // Not part of sphere
}
Is this easy to do in Povray or maybe some other 3D software? An equivalent to
voxels would be to trace rays to see if it intercepts the function. Either way
is fine as long as a sphere is produced from the above 'code'/function.
Post a reply to this message
|
|