This has been asked several times, but never answered… sooooo, any way to do it?
Yes, it’s quite doable. In the island demo there is a custom script to duplicate textures. This can be used to export splat/lightmap textures. You can set the lightmap in project view for terrains. I didn’t find import script for splatmaps in final island demo.
Here’s code(I think it’s originally written by OTEE) for overwriting texture(works with splatmaps). Put this one to Asset/Editor folder.
@MenuItem("Assets/Overwrite Texture")
static function Apply () {
var texture : Texture2D = Selection.activeObject as Texture2D;
if (texture == null)
{
EditorUtility.DisplayDialog("Select Texture", "You Must Select a Texture first!", "Ok");
return;
}
var path = EditorUtility.OpenFilePanel("Overwrite with png", "", "png");
if (path.Length != 0)
{
var www = new WWW ("file:// " + path);
while (![url]www.isDone[/url])
;
www.LoadImageIntoTexture(texture);
}
}
Thanks Phantom, I didn’t know about that script.
Anyone know of any way to import these maps? It would be very useful to be able to “tweak” these in a paint app or allow an off-site artist to create them.
Thanks Phantom. Is there a default editor script folder so I can reuse these scripts in other projects?
Btw. if you only want to assign a custom lightmap you can simply drag it onto the lightmap slot in the terrain data asset in the project view. (Select it in the inspector)
Thanks Joe!
This doesn’t seem to be working for me in 2.0.2 – did something change or am I not dragging the right thing to the right slot?
-
I have a new lightmap image in PNG format. I set its import settings to ARGB 32 bit, and it is the same pixel dimensions as the lightmap in my terrain.
-
I have twirled down the terrain object in the Project view so I can see the lightmap element.
-
I try to drag my external lightmap image onto the lightmap element in the terrain.
-
Nothing happens – the lightmap is not replaced.
Is there something about the format of external file? Or am I dragging to the wrong spot? Or?
I’d love to be able to do this to burn tree shadows into the lightmap.
Thanks,
Steve
Update:
This works just fine.
I failed to look at the inspector after selecting the terrain object in the project view. You can easily swap the lightmap there.
One thing that might seem a bit confusing is that the Terrain Object’s hierarchy will still show the generated lightmap and not the one you swapped in.