As described in a previous thread, I wish to render a voxel object made of different materials. I have a RAW file nxnynz chars with 0 = empty, 1 = material A, 2 = material B etc. Let’s assume there are two materials, a green one and a red one. nx ny and ny are typically 256 for the tests.
I tried two methods to render the object. First one is based on loading the RAW file and resampling as described in the gResample code sample. Both materials are set with a density of 1. It works well, although a dark 3D grid superimpose on the object. I suppose this 3D grid is due to a density drop (and hence a darker color) at the bricks border. A call to UpdateApron almost solves this artefact although it can still be seen at some voxels.
The problem is that whereas the interface between exterior of object and void is sharp, there is a diffuse color blend where the materials meet, leading to a diffuse interface between the two materials. I need the interface to be sharp (or reasonably sharp). It does not need to follow the exact voxel shape, but ideally it should transition from say red to green without going through a mixture of the two colors.
The second method I used is the point cloud as descibed in the manual and the example code gFluidSurface. It works also well but the blending between the two materials is even more pronounced depending on the subcell size used.
In both cases the default rendering is used with setColorChannel, no custom rendering kernel. So the main question is : how can I obtain a render with sharp interfaces/color transitions between two materials ?
Two remarks :
-When the object intersects the world box, it seems that the density drops leading to a darker color along the faces of the world limits, as if they were partially shadowed. I’ll try activating voxels on the world faces.
-When using point clouds, if the points coordinates are exact voxel coordinates, e.g. Vector3DF(i,j,k), the program crashes.