Wellbore algorithm

Does anyone know the algorithm for creating wellbore(oil welbore with formation around it) with 3D cells? Each of these cells should be able to be color controlled individually. Any suggestion is very much appreciated.

Suf.