materialgen: further work, still WIP.