Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a procedural terrain system for Unity. And I'm looking for ways to efficiently cast self-shadows on it. If it wasn't procedural, I could simply bake a lightmap using Beast. But, I can't because the terrain mesh is created at runtime. What kind of methods can be done for this, I'm sure it has been done before. If possible, I'm looking for a solution that works for non-pro.

I was thinking that maybe some kind of onetime ray-tracing method might be a solution.

share|improve this question
up vote 2 down vote accepted

There isn't a way to bake lightmaps at runtime using Beast (Unity's lightmap engine). Beast only works in the editor. However, you can run editor functions from the command line using -executeMethod so if your procedural level was XML you could send it to a server, run an editor method similar to this (javascript):

static void PerformBuild () {

I didn't compile this yet, so it might not be all the code neccesary. Here are a few links that I used as a reference:

share|improve this answer
That's an interesting idea. Thanks! – Daniel Pendergast Jan 21 '14 at 11:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.