There’s a tutorial on “cutting steel with a blowtorch” that talks about how to use paths in a very similar way.
The source-files that you will produce in Blender will consist of the text, and maybe the piece of chalk following the text as it is gradually exposed. It will all be on an Alpha = 0.0 transparent background, anti-aliased and ready for comping.
I suggest that you generate the lighting and the shadows all as separate layers … that is to say, as separate outputs, so that when you get to “comp” you can adjust all of these things separately.
From a pure-compositing point of view, for example, the thing that you need for Blender to tell you about “light #3” is… where it falls on the chalkboard surface (which can be described in a single frame if the light doesn’t move) … and, separately, how it is occluded from the chalkboard plane by the traveling chalk … and, separately, how it falls on the chalk as it moves. An entirely different color or treatment or texture of the light, or the shadow, or both, could be added into the shot in “comp,” as long as you have available to you this information about just how and where it falls. As long as you have it all in clean, detailed, independent channels… a directory full of carefully-labeled EXR files.
You need exactly the same thing from Yafray. (But, heh, you just might discover that you don’t need Yafray.)
If you are going for “complicated photorealism,” as I guess that you are, then you’re going to be putting the shot together in comp, not in the individual source renders. You’ll be building-up the effects one step at a time, running through it over and over again, changing this and bumping that, just like they do at a mixing panel in a recording studio. (“Let’s try a little bit more chalk-dust in light #3…” “Okay, just a sec… got it. Here goes…”)