http://iquilezles.org/www/articles/terrainmarching/terrainma...
Be sure to browse his other articles:
http://iquilezles.org/www/index.htm
and his awesome video tutorials (which tend to be more about the math than the code):
https://www.youtube.com/user/mari1234mari
Enjoy!
http://www.playfuljs.com/a-first-person-engine-in-265-lines/
Also read the readme file of this Voxel Space engine. Maybe this is already enough to understand the principle.