2
\$\begingroup\$

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.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

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 () {
    Lightmapping.Bake()
}

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:

http://docs.unity3d.com/Documentation/ScriptReference/Lightmapping.html http://docs.unity3d.com/Documentation/Manual/CommandLineArguments.html http://docs.unity3d.com/Documentation/Components/gui-ExtendingEditor.html

\$\endgroup\$
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.