# MCG – InVolume

So, ever wanted to write your own Volume Select modifier. Well, we are sharing a set of compounds with a sample modifier for that purpose :).

So we have taken two approaches to the problem: a “dummy” approach, and a mathematical correct one.

The first one, the “dummy” one, just shoots rays (6 in total) and waits to see if all return report a hit. If all report a hit, it assumes its inside something (sometimes we could be outside :P, I will explain in a bit). This can fail in geometry that is shelled, since it doesn’t take in account the angle between hit normal and the ray direction, and hollow part will report as an inside hit.

The second approach uses only one ray, and does compute the angle between the hit normal vector and the ray direction vector (above 90º we assume its an inside hit), but assumes that the object is closed and watertight, so if a mesh is open, this can have weird results.

So, choose whatever is more suited to the job, both are fast.