Multiple Lightmap Caches?

rated by 0 users
This post has 4 Replies | 2 Followers

Top 150 Contributor
Posts 24
SunBurn_Community_Licensee
irrationalistic Posted: 04-08-2012 11:36 PM

I am using multiple scenes that are sharing some objects in between them. I'm not entirely sure how SunBurn keeps track of the generated maps ( I see the unique named files in the LightMapCache folder), but I'm wondering if it is possible to keep track of lightmaps by scene?

Top 10 Contributor
Posts 5,368
Employee
SunBurn_Studio_Licensee

Hi irrational,

SunBurn keeps unique ids on objects added through the editor, these ids ensure objects added in different scenes (or even the same scene) will be able to have unique light maps even when they share the same model.

Let me know if this helps!

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 150 Contributor
Posts 24
SunBurn_Community_Licensee

Perhaps I am handling this whole "multiple scenes" thing wrong then? Based on some idea I picked up from who-knows-where, using the IGF system, this is how I change scenes:


SunBurn.ObjectManager.Clear();
SunBurn.LightManager.Clear();
SunBurn.AudioManager.Clear();
RemoveLayer( _SunBurnLayer );
_SunBurnLayer = new SunBurnLayer( this, "MainContent", "Scenes/" + TargetScene );
AddLayer( _SunBurnLayer );

Whenever I switch scenes using this method, it shows the old scene in the editor as "inactive" and only works with the current scene. While this example is more specific to IGF, I imagine that it has a SunBurn-only based solution. The key thing here is that this system seems to be preventing me from writing two different lightmaps to objects that exist in both scenes...

Top 10 Contributor
Posts 5,368
Employee
SunBurn_Studio_Licensee

Hi irrational,

It's generally recommended to use SceneInterface.Clear() (or SceneInterface.Remove(scene)) when clearing or removing a scene, however your code above should work well too as you're clearing the core managers.

irrationalistic:
preventing me from writing two different lightmaps to objects that exist in both scenes...

I'm not quite following this, how is the same object in both scenes?

Please note if two separate objects are in different (or the same) scenes and share the same model this is fine.  However a single object cannot be in more than one scene - this is because a unique group of objects are created when loading each scene.

Let me know if this helps!

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 150 Contributor
Posts 24
SunBurn_Community_Licensee

Man, I'm sorry, I just realized that the unique id's are serialized and that I had literally copy-pasted the entire scene somewhere in my process! Thanks for the help! I'll try fixing that uid problem and hopefully that will solve it. Can't check it quite yet though. Thanks for the advice on the clearing too :)

Page 1 of 1 (5 items) | RSS