PDA

View Full Version : lightwave camera -> Blender



bpritchard
04-06-2011, 05:44 PM
Hey everyone,

I'm trying to find the best solution for getting a LW camera over into blender. I'm needing to do some fluid tests (w/fire and such) and i can get models and mdd's over just fine but i can't seem to find any options on cameras.

I've done some searching on the forums (and still am, there are lot of "blender" related threads) but haven't run across the magic bullet.

Any help would be greatly appreciated!
Cheers
Bryan

Simon-S
04-07-2011, 06:30 AM
Do you just want to export your camera motion path?

If so, bake out your keyframes then save out a motion file (.mot) which can be loaded onto your blender camera.

bpritchard
04-07-2011, 06:34 AM
yeah pretty much, i'll give that a go. Didn't realize you could load motion files that easily into blender.

dee
04-07-2011, 06:37 AM
There's a Lightwave motion (.mot) importer in Blender 2.49. Import the motion of your lw-cam to an empty and parent the camera to it. You need to snap the camera pos to the empty and rotate 90° in x.

Unfortunately, I don't know how to get the importer script into Blender 2.5.

vector
02-22-2014, 01:35 PM
Does anybody know how to get it with the lastest version of Blender? Another new way to get it?

jeric_synergy
02-22-2014, 01:56 PM
Is it really necessary to BAKE keyframes? Usually 'baking" means to set a keyframe on every frame--.....

Simon-S
02-22-2014, 11:43 PM
Does anybody know how to get it with the lastest version of Blender? Another new way to get it?

Am I right in thinking the latest version of blender now has support for fbx import...maybe you get you camera data over using fbx?

bazsa73
02-23-2014, 12:35 AM
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.69

50one
02-23-2014, 12:52 AM
Blender has an FBX add-on, you can export all object data you need from Lightwave however not sure if there's a nuke chan export for Lw? Cause that's how you will get the camera data over.

vector
02-23-2014, 02:22 AM
I'll tried that fbx import since it was a beta version and now as a final release and I can't get the camera work in Blender. Collada doesn't work either.

MAybe I have to use some settings I miss. Does anybody get it to work?

Simon-S
02-23-2014, 02:40 AM
Is it really necessary to BAKE keyframes? Usually 'baking" means to set a keyframe on every frame--.....

Actually no, you can just save out a motion file without baking and it should work fine.

50one
02-23-2014, 02:43 AM
I'll tried that fbx import since it was a beta version and now as a final release and I can't get the camera work in Blender. Collada doesn't work either.

MAybe I have to use some settings I miss. Does anybody get it to work?

Well, as I said you won't get camera data with FBX. need to use Nuke chan file and that will work flawlessly.

Simon

Shiny_Mike
02-25-2014, 02:39 AM
Tentative success with:
Baking cam keyframes,
exporting as Collada from 11.6,
running Clintonman's python Collada fixer script from layout: http://www.clintons3d.com/plugins/lightwave/
Importing modified Collada into Blender 2.7 (latest test build)

Camera seemed to come through nicely.. I didn't play around with it much though to look for problems.

vector
02-25-2014, 12:27 PM
Great, Mike. I can't wait to try it!

vector
03-08-2014, 12:39 AM
The rotation doesn't work correctly with that python script (but I'm using Blender 2.69 not 2.7 -still beta- , not sure if it's the problem) , but at least the camera is animated

tischbein3
03-13-2014, 04:00 PM
The rotation doesn't work correctly with that python script

The problem is, blender uses a different camera orientation* then lightwave, to solve the problem, you have to:

- Add a Null
- Copy Camera motion (rotation, translation) to the null.
- Parent the _non-animated_ non rotated non translated camera to the null. (So it share the same place as the null)
- Export as collada (didn't tested fbx)
- In Blender rotate the Camera (not the null) 90 degrees upwards.


* actually its the same orientation (z+) but since z+ is actually "up" in blender, the rotation values are screwed.

Greenlaw
03-13-2014, 08:00 PM
Baking keyframes for a camera is a standard practice when working between different 3D programs, especially if exact camera matching is desired. The reason is because the interpolation between keyframes often varies between different programs. Just an FYI.

Normally, I maintain two versions of the original camera scene--one with the original keyframes in case I want to edit it later, and one with the baked keyframes to match elements rendered in another program (i.e, Vue, Blender, etc.) If your concern is future edit-ability, I suggest doing this.

G.

vector
03-14-2014, 03:08 AM
Ok, thanks to both. Nice advices

bazsa73
10-21-2014, 11:43 AM
Hi Lightwave Dudes!

I'm this close to complete a mot2Blender python script. The only issue is the dastardly
rotational axis swap mess thing.

import bpy
import math
import mathutils
from array import *

#Select an object named OBJECTNAME
Scene = bpy.context.scene
obj = bpy.context.active_object
obj.animation_data_create()

hedinglista = []
picsalista = []
banklista = []

infile = open('G:\\STUFF2013\\BLENDER\\xyz.mot', 'r')
motframe = 1

for line in infile:
if line.startswith("Channel"):
magicword, chanumer = line.split()
int_chan = int(chanumer)
motframe = 1

if line.startswith(" Key"):
if( int_chan < 3 ):
name, xs, a, b, c, d, e, f , g, h= line.split()
if (int_chan == 0 ):
obj.location[0] = float(xs)
obj.keyframe_insert(data_path="location", frame=motframe, index=0)
if (int_chan == 1 ):
obj.location[2] = float(xs)
obj.keyframe_insert(data_path="location", frame=motframe, index=2)

if (int_chan == 2 ):
obj.location[1] = float(xs)
obj.keyframe_insert(data_path="location", frame=motframe, index=1)


motframe += 1

if( int_chan >= 3 and int_chan <= 5):
name, xs, a, b, c, d, e, f , g, h= line.split()

rad = float(xs)
bpy.context.scene.frame_set(motframe)
if( int_chan == 3 ):
hedinglista.append(rad )
#bpy.ops.transform.rotate( value = ( rad ), axis= ( 1 , 0, 0 ) )
if( int_chan == 4 ):
picsalista.append(rad )
#bpy.ops.transform.rotate( value = ( rad ), axis= ( 0,1, 0 ) )
if( int_chan == 5 ):
banklista.append(rad)
#bpy.ops.transform.rotate( value = ( rad ), axis= ( 0 , 0, 1 ) )

bpy.ops.anim.keyframe_insert_menu(type='Rotation')

motframe += 1

for i in range(len(hedinglista)):
obj.rotation_euler=(banklista[i] ,picsalista[i] ,hedinglista[i],)
obj.keyframe_insert(data_path='rotation_euler',fra me=i)

bazsa73
10-29-2014, 03:25 AM
Here is the final solution. Use this script and there is no need to flip/rotate anything at all, it will load a .mot file into Blender to any selected context.

http://visionsupreme.net/plugins/BLENDER/LightwaveMotion2Blender.py

----EDIT----

Using this script eliminates the MDD issue in Blender as well.

In Lightwave:
-Save an MDD and a mot file of the object you want to use in Blender
The motion file doesn't need to be long, a 3 frames is enough. But of course if your object is DEFORMED and TRANSFORMED
at the same time then you need a full length motion file.

In Blender:
-Load the MDD using Blender's MDD reader on your model
-Use my script on top and it fixes the orientational issue
Voilá...

OnlineRender
10-29-2014, 04:10 AM
Here is the final solution. Use this script and there is no need to flip/rotate anything at all, it will load a .mot file into Blender to any selected context.

http://visionsupreme.net/plugins/BLENDER/LightwaveMotion2Blender.py

wicked thank you ... saved , shared & tweeted !

Brötje
10-29-2014, 04:59 AM
Super! Thank you very much!

Now just get the mdd I/O right and we're golden!

bazsa73
10-29-2014, 05:58 AM
Super! Thank you very much!

Now just get the mdd I/O right and we're golden!

You're welcome!
Just save out a .mot file of your object and in Blender just load the mdd and then the .mot using my script.
It works. Tested.

bazsa73
10-29-2014, 06:05 AM
wicked thank you ... saved , shared & tweeted !

Super! Thank you!

allabulle
10-29-2014, 06:38 AM
Thanks!

bazsa73
11-01-2014, 03:29 AM
MDD loader fix for Blender

Works in the following manner:
-load LWO into Blender (use the LWO loader rather than the OBJ, vertex order is messed up with the latter)
-load the MDD as well on top of the selected model in Blender
-run this script on frame 0 (or 1)

this will flip shapekey y and z data as you see in the innermost loop
The first and last frames are messed up but I guess we can live with that.


import bpy

obj = bpy.context.active_object

for shapekey in bpy.data.shape_keys:
#print(shapekey.name)
for keyblock in shapekey.key_blocks:
#print(keyblock.name)
for vert in obj.data.vertices:
#print(obj.data.shape_keys.key_blocks[keyblock.name].data[vert.index].co)
temp_y = obj.data.shape_keys.key_blocks[keyblock.name].data[vert.index].co.y
obj.data.shape_keys.key_blocks[keyblock.name].data[vert.index].co.y = obj.data.shape_keys.key_blocks[keyblock.name].data[vert.index].co.z
obj.data.shape_keys.key_blocks[keyblock.name].data[vert.index].co.z = temp_y

clintonman
11-01-2014, 12:29 PM
You can also try my version of the Blender mdd importer. It adds a checkbox for "Lightwave mode" that swaps the axes. It's about half way down the page:
http://clintons3d.com/tutorials/blenderFluidsForLightwave_2.html

bazsa73
11-01-2014, 01:36 PM
You can also try my version of the Blender mdd importer. It adds a checkbox for "Lightwave mode" that swaps the axes. It's about half way down the page:
http://clintons3d.com/tutorials/blenderFluidsForLightwave_2.html

If I'd known that...