LightWave to Unity Quickstart

BigHache

Kamehameha Chameleon
I started making notes to myself for preparing LightWave files for Unity and thought it might be useful to other users. I'll try to maintain this PDF and update it as software developments require, as I discover new things, or folks make suggestions.

This isn't an end all be all guide, just a one page "good suggestions for getting started". That may evolve in the future but for now it's just very simple.
 

Attachments

  • LW2Unity Quickstart.pdf
    95.4 KB · Views: 410

Gungho3D

A.K.A "The Silver Fox"
Hey BigHache - that's kind of you.

I usually model-in-place and then set up pivot points in Layout via Nulls ... is that the setup you are describing, or do you specifically mean the "Move Pivot" tool in Layout?
 

BigHache

Kamehameha Chameleon
Hey BigHache - that's kind of you.

I usually model-in-place and then set up pivot points in Layout via Nulls ... is that the setup you are describing, or do you specifically mean the "Move Pivot" tool in Layout?

Using a Null in Layout only for the top-level of the hierarchy is what I'm describing. After that using the Move Pivot in Layout for the individual layers.

You can use a Null to act as a pivot for each layer, my concern would be you may be unnecessarily making your file a bit more complex by adding Nulls where they're not absolutely needed. Additionally, that layer's pivot, should you need to select that part in Unity, is still at origin. I try to work as simply as possible, especially when working with a game engine.


Nice! I haven't gotten 2018 yet so I haven't delved through much of the docs. Next month's budget. I'm glad to see some good documentation for Unity.
 

Gungho3D

A.K.A "The Silver Fox"
1. Using a Null in Layout only for the top-level of the hierarchy is what I'm describing. After that using the Move Pivot in Layout for the individual layers.

2. You can use a Null to act as a pivot for each layer, my concern would be you may be unnecessarily making your file a bit more complex by adding Nulls where they're not absolutely needed.

3. Additionally, that layer's pivot, should you need to select that part in Unity, is still at origin. I try to work as simply as possible, especially when working with a game engine.

1. Ok, understood

2. Nulls as pivots has worked great for me (inside LW), especially in setting up / readying more complex mechanical rigs at work, great for linkages and hydraulics

3. Understood, especially with respect to game engine deployment as you say
 

BigHache

Kamehameha Chameleon
Nulls as pivots has worked great for me (inside LW), especially in setting up / readying more complex mechanical rigs at work, great for linkages and hydraulics

Yes, absolutely. For rigs you're not going to get away from using Nulls. :)
 

Gungho3D

A.K.A "The Silver Fox"
Yes, absolutely. For rigs you're not going to get away from using Nulls. :)
So, just looking to think this through (don't have Unity installed here to test) ...

Example: take a basic hydraulic piston setup, let's say both ends get to pivot to some degree around where they are fastened to a given structure
1. I tend to receive models where hydraulics are modeled in place ...
2. ... meaning on occasion having to separate out components, e.g. both ends of a hydraulic setup
3. The piece-of-cake solution has been to pivot each section using a Null (sometimes 2 as a means of enforcing full motion alignment) ...
4. ... and, *prior to* parenting geometry to the Null, getting the null to point to (target) the base of the opposing hydraulic component

This all works well, is easy to set up, is precise and scale well. I'm sure other gurus have other ways ...

The key question is, however: does a setup something like the above - with hierarchies and pivots and targeting details - does this come across to Unity intact, or is there some other way to achieve such an end reslut?

I would value your thoughts or anyone else's for that matter regarding the above ...
 

BigHache

Kamehameha Chameleon
Yay! Hydraulic actuators! I've done a lot of these at work, though in Max. Same scenario, geo is in place. Same principle too.

Typically I've been using the hardware as the LookAt Constraints because the geo is already there, though if you use geo or a Null it doesn't matter. What we typically do is animate in the 3D software and export an FBX with that animation baked. Then we just have C# scripts that control playback of the baked FBX animation.

Unity does have a LookAt Constraint though I've not used it yet. In principle it should work the same as Layout or any other 3D software. If you do this within Unity I would think you would not want to have anything too complex, however. The overall size of your project will probably determine how much of a hit on performance this could become.
 

Gungho3D

A.K.A "The Silver Fox"
Yay! Hydraulic actuators! I've done a lot of these at work, though in Max. Same scenario, geo is in place. Same principle too.

Typically I've been using the hardware as the LookAt Constraints because the geo is already there, though if you use geo or a Null it doesn't matter. What we typically do is animate in the 3D software and export an FBX with that animation baked. Then we just have C# scripts that control playback of the baked FBX animation.

Unity does have a LookAt Constraint though I've not used it yet. In principle it should work the same as Layout or any other 3D software. If you do this within Unity I would think you would not want to have anything too complex, however. The overall size of your project will probably determine how much of a hit on performance this could become.
Interesting. And thanks heaps.

As in all things 3D, bottom line is to roll up one's own sleeves and find a way. But help like yours makes it easier ...
 

gar26lw

New member
lightwave needs a batch exporter similar to the Autodesk Unity Game exporter:

https://knowledge.autodesk.com/supp...B0258B21-83AE-4DF6-B7AB-3FA7F63F371A-htm.html

this allows you to export animation takes to a single fbx file.



you also want to be able to export groups as individual FBX's and export groups that are offset from the origin, where the exporter resets the group to 0,0,0 upon export, so models come in at zero on the origin in Unity.

here is an example script that does batch fbx export, with offset compensation:

http://josbalcaen.com/scripts/max/batch-exportimport/

 

wingzeta

Active member
lightwave needs a batch exporter similar to the Autodesk Unity Game exporter:

https://knowledge.autodesk.com/supp...B0258B21-83AE-4DF6-B7AB-3FA7F63F371A-htm.html

this allows you to export animation takes to a single fbx file.



you also want to be able to export groups as individual FBX's and export groups that are offset from the origin, where the exporter resets the group to 0,0,0 upon export, so models come in at zero on the origin in Unity.

here is an example script that does batch fbx export, with offset compensation:

http://josbalcaen.com/scripts/max/batch-exportimport/


Did you put in a feature request? Could be a good feature for LW in game dev, and maybe not so hard to implement. Could also be useful for studios doing real-time animation rendering in game engines too, with the ability to export takes, and a streamlined update process. You make these things easier, and you are welcomed in more pipelines.
 

tcoursey

New member
Just searched the forum for Unity and found this thread. Glad to see there is some fresh discussion in this area.

My questions relate to asset managment and materials and such. In LW you can have models saved (LWO's) and bring them right into Layout and begin using them. Fully textured and setup (we use Octane, but is the same for native LW surfaces).

In Unity I don't see this as possible. Am I missing something? Does each and every model that you bring into Unity have to be surfaced with settings? I know some of the texture albedo maps come in...

Currently if I am making a model and want to make a change, I go back to Modeler make change, export from Layout to FBX, overwriting the existing one in the Assets folder of Unity and it comes in just fine....but any new materials don't get extracted. So when I extract them it makes a new copy of all the ones I already had setup. It's a mess.

I'm doing something wrong as far as a pipeline I'm sure. Can anyone shed some light on this area? I can start a new thread if need be...but thought this would be as good a place as any. Thanks!
 

tcoursey

New member
I think I'm following what's going on. I'll do some tests tonight to see if I can help.

Cool thanks! I'm sure there is a best practice for Lightwave to Unity and back (sort of) But it may be different than I'm used to LW only. As games are very "asset" driven and everything needs to be it's own model.

But more than anything I would want to begin a library of assets (furniture etc) that could just be dropped in so to speak. And I just don't see that yet. Always have to touch them once they've been imported. From what I've ready and seen from others....it's just how it is unfortunately... Maybe together we can figure out the lest abrasive way! lol.
 

BigHache

Kamehameha Chameleon
Well regarding assets and bringing into Unity, yes if you're importing FBXs into a new project then you will need to drop the textures on your models each time. What may be better is to create an asset project that acts like a template with all the textures set up and import it into any new project ready to go. You could break it up into furniture projects, lamdscaping, etc. Think of assets in the Unity asset store and make your own.
 

BigHache

Kamehameha Chameleon
Currently if I am making a model and want to make a change, I go back to Modeler make change, export from Layout to FBX, overwriting the existing one in the Assets folder of Unity and it comes in just fine....but any new materials don't get extracted. So when I extract them it makes a new copy of all the ones I already had setup. It's a mess.

export_fbx_dialog.png
LW 2015 Dialogue

Just so we're all starting at the same point, are you checking Materials in the FBX export dialogue? If not, any new materials you've added should not show up in Unity.
 

BigHache

Kamehameha Chameleon
I've started creating a workflow for myself having figured out several things not to do. It's getting late, I didn't spell check, and there might be some errors or things that could be more efficient.

Substance Painter doesn't seem to care for any sort of parenting from 3DS Max, but doesn't seem to mind LightWave's hierarchy so I suggest setting that up as soon as possible.

This is definitely not a one-size-fits-all, but could help someone with questions getting started on a workflow of their own.

I've looked at the LightWave to Unity linking thing, but I personally don't recommend it. Keep everything sectioned to each step in your pipeline.

If anyone has questions I'll do my best to try and answer. Not because I'm the foremost expert on this but I think this conversation isn't happening enough.

View attachment LW2Unity Workflow.pdf
 

GraphXs

GraphX
If you plan on doing animation in Unity, as well as hierarchy's, you can just export out of modeler and skip the step of exporting layout. **Layout FBX exports IMO has some drawback(unless doing layout animation) because it append the model save name to each object layer, modeler doesn't and keeps just layer name in Unity, though I didn't see if they fixed that yet in 2018 export)

Just make sure you do these things first:

-Name all layers (top node will be file name)
-Name all materials (it is a good thing to label material names with "mat" behind them or your model layer names "XXX_mesh" So unity doesn't append a number behind one or the other if they use the same name.
-Don't parent anything in modeler (doesn't come over to unity, but I usually just set up the hierarchy animation in unity)
-For uv spaces in one mesh only use two UVs. For example all model layers use "UV_Diff" and some that have lightmaps also use "UV_Lightmap" in lum channel.
((if you use more than two it might pick the wrong uv, so please clean up uvs before export))
-Make sure you change the material to use material name(not texture name) in unity (a script can be made for this to be default in unity)
-The Unity flip Z checkbox is great in 2018 on export. (Though I just always had my mesh facing the other way before they added this)
 

BigHache

Kamehameha Chameleon
I've noticed that too about each layer automagically acquiring the model name and it is annoying. Still present in 2018.0.3.

My current project is requiring me to model in place rather than at origin. If I were to export from Modeler and bring into Unity, the pivot for that FBX will be at origin but the model will not. No go.
Also, I have models that need the ability to be rotated in Unity on odd angles and I have to parent layers to a rotated Null since LW does not allow/recognize rotating of pivots for FBX.

You do bring up good points, thank you for adding to the discussion. :rock:

Again like I said, the workflow I laid out is not all encompassing, it was a solution for my current project. Hopefully more folks will chime in as more start using LW in a game engine pipeline.
 

GraphXs

GraphX
Pivot positions will be respected per modeling layer from modeler. So if ya have an object far away from origin in a layer, ya can have that pivot be near the mesh. FBX export will respect that.
 
Top Bottom