Creating materials in worker threads does not work, this relies on BKE functions which must only be called from the main thread. Create the foreground/background materials in advance before starting the trace job. Pull Request: https://projects.blender.org/blender/blender/pulls/139532