Unity import script

Anything you want to share!
User avatar
AdamB
Site Admin
Posts: 2294
Joined: Wed Apr 16, 2008 10:11 am
Location: Brighton, UK
Contact:

Re: Unity import script

Post by AdamB » Thu Mar 11, 2010 7:18 pm

LightUp exports the lighting as multi-layer materials.. ie the material has 2 textures.

Unfortunately, while this is completely valid FBX, there are quite a few modellers which simply ignore the extra lighting texture. :-(

Unity handles it correctly as does the Autodesk Quicktime viewer plugin.

EDIT: And of course Autodesk Max/Maya imports LightUp perfectly.

Future versions of LightUp will offer an option to bake the 2 textures together which should mean modellers can treat it as a regular 1-texture per material import.

Adam
Developer of LightUp http://www.light-up.co.uk

Rush3fan
Posts: 12
Joined: Thu Mar 11, 2010 5:35 am

Re: Unity import script

Post by Rush3fan » Thu Mar 11, 2010 9:58 pm

Baking the shadows into textures will ruin the point in tiling them right? Why not add an option to export the lightmap only. I know there would be a lot of people from the 3drad comunity who would use this tool if it supported it. :) Currently most of us use Giles which takes forever to load, especially in complex scenes.

User avatar
AdamB
Site Admin
Posts: 2294
Joined: Wed Apr 16, 2008 10:11 am
Location: Brighton, UK
Contact:

Re: Unity import script

Post by AdamB » Fri Mar 12, 2010 8:44 am

Completely do-able but then you've lost your (diffuse) textures, No?
Developer of LightUp http://www.light-up.co.uk

Rush3fan
Posts: 12
Joined: Thu Mar 11, 2010 5:35 am

Re: Unity import script

Post by Rush3fan » Fri Mar 12, 2010 4:14 pm

Its really simple in 3drad. You add two skinmeshes (visual models) one is the original model with the diffuse maps, the other mesh has all the shadow maps applied. All you need to do to get the mixxing is set the second skinmesh to the "shadowmap" shader.
ShadowMap_Sample.jpg
Here's an example I whipped up in a few seconds.
ShadowMap_Sample.jpg (85.74 KiB) Viewed 16028 times

Greg767
Posts: 1
Joined: Wed Mar 31, 2010 6:59 pm

Re: Unity import script

Post by Greg767 » Thu Apr 01, 2010 9:57 am

Hi,
I've imported my simple room model using lightup in unity and when I walk around in it Unity crashes (usually when I hit some walls). Also all transparent textures that are transparent in Sketchup (like glass table-top) are not transparent in unity.
Could you please help with these issues or just give me a hint what the problem could be.
Thanks a lot
Greg

ev350
Posts: 1
Joined: Thu Apr 08, 2010 4:07 pm

Re: Unity import script

Post by ev350 » Thu Apr 08, 2010 4:09 pm

It wont let me add the script, each time it just says the .js needs to be outside the editor folder. and my building misses walls when you walk inside. I mean WTF

User avatar
AdamB
Site Admin
Posts: 2294
Joined: Wed Apr 16, 2008 10:11 am
Location: Brighton, UK
Contact:

Re: Unity import script

Post by AdamB » Thu Apr 08, 2010 6:52 pm

Greg767 wrote:Hi,
I've imported my simple room model using lightup in unity and when I walk around in it Unity crashes (usually when I hit some walls). Also all transparent textures that are transparent in Sketchup (like glass table-top) are not transparent in unity.
Could you please help with these issues or just give me a hint what the problem could be.
Thanks a lot
Greg
[Unity crashing when you touch a wall sounds like a scripting error you have in your Unity setup for player collision. Its nothing to do with LightUp]

Material color+alpha doesn't appear to be honored by the Unity FBX importer. The colors are all there in the FBX file exported by LightUp but appear to be ignored by Unity. A workaround is to use transparent textures (texture with alpha) or to manually tweak once imported.

Adam
Developer of LightUp http://www.light-up.co.uk

User avatar
AdamB
Site Admin
Posts: 2294
Joined: Wed Apr 16, 2008 10:11 am
Location: Brighton, UK
Contact:

Re: Unity import script

Post by AdamB » Thu Apr 08, 2010 6:57 pm

ev350 wrote:It wont let me add the script, each time it just says the .js needs to be outside the editor folder. and my building misses walls when you walk inside. I mean WTF
The Editor script "LightUp.js" should be copied in Explorer/Finder to the Editor folder in your Assets. It will then be picked by Unity.

Your building missing faces will be because Unity, like most realtime engines, draws the "front faces" of polygons only. You need to model your building using consistent "facedness" - SketchUp/LightUp doesn't mind which orientation you use for your faces, but if you're targeting realtime engines, you do need to be aware of this.

Adam
Developer of LightUp http://www.light-up.co.uk

ajon1993
Posts: 4
Joined: Tue Jul 27, 2010 9:48 pm

Re: Unity import script

Post by ajon1993 » Tue Jul 27, 2010 10:01 pm

Ok so let me get this straight, i actually make a folder in the Unity hierarchy and make one inside it called editor and that is where i put the script? Or do i make a folder outside of Unity using explorer and add it that way?

I'm asking because i did it by going to c:\program files\unity\editor and when i import my .fbx into Unity, the textures show up in the hierarchy but they are not applied to the model once i drag it inside Unity, its just the standard grey color. I also tried the first way i mentioned above and it did the same thing. =/
Last edited by ajon1993 on Tue Jul 27, 2010 10:48 pm, edited 1 time in total.

User avatar
AdamB
Site Admin
Posts: 2294
Joined: Wed Apr 16, 2008 10:11 am
Location: Brighton, UK
Contact:

Re: Unity import script

Post by AdamB » Tue Jul 27, 2010 10:13 pm

Inside your "Assets" folder, you should have a sub-folder called "Editor". Inside this you can place scripts that will be automagically picked up during the import process.

You should place the LightUp.js script inside the Editor folder to ensure its invoked and auto-assigns materials.
Developer of LightUp http://www.light-up.co.uk

Post Reply