Notifications
Clear all

[Closed] Morpher Modifier as Point Cache for UE4 import

Hello,

I have been exporting deforming geometry out from 3DSMAX into Unreal 4 / UE4 as an FBX.
Unreal can import geo with the morpher modifier, and it automatically keeps the animation which is very cool.

If you are using one morpher channel to morph from object A to object B…0-100 percent over a number of frames, it works like a charm. Unfortunately there are not a lot of good ways to get a point cache of deforming geo into Unreal. Fabric Engine has a beta Alembic importer, but it’s just getting going, and when the point counts get big, it struggles to put up quick frame rates.

As a hack, I have taken cached deforming geo – one snapshot per frame and loaded it into morpher modifier – one snapshot(frame) per channel (not progressive morph…in one channel, one channel = one frame of cached geo in a sequence). Channel 1 is at 100% at frame one, channel 2 100% at frame two…and do on.

So I’m hand animating this, and making sure that only one channel is at 100%(all others at 0%) and going through frame by frame of a cached animation and hooking this all up. sucks, right?

Question: Can some kind soul on this board help a brother out? I’d love a script that would automate this process:

While the geometry with the morpher modifier is selected, the user is prompted to select an animated/deforming mesh (with the same vert count obviously) and the script populates the morpher channels with the current frame of deformed mesh and animated percentages (100% for current frame, 0% all others)…run through all 100 channels for the morpher modifier?

Extra credit: Could the time value be defined or offset? (like: Frames: 10-60…or 200-300)

Thanks you very much!!!

Bob Dyce

2 Replies

check if it’s what you’re after

try (destroydialog X ) catch ()
rollout X "Anim2morpher" width:125 (
	
	local targets = #() 
	 
	fn getgeo sel = classof sel == Editable_mesh or classof obj == editable_poly
		
	pickbutton pickmesh "select animated mesh" filter:getgeo --width:100
	spinner frames "frames" range:[1,99999,10] type:#integer align:#center tooltip:"snapshots count"
	group "targets:" (
		checkbox hidetargets "hide" checked:true across:2
		checkbox freezetargets "freeze" checked:true 
		button seltargets "select targets" width:100
	)
	
	on seltargets pressed do try (select targets) catch()
	 
	on pickmesh picked obj do (
		
		if targets.count > 0 then if queryBox "Delete previous targets?" then try (delete targets) catch()
		targets = #()
		
		with redraw off (
			
			if classof obj != undefined then (
				
				pickmesh.text = obj.name
				
				local newobj = at time 0f snapshot obj
						newobj.name = uniquename "anim2morph"
						select newobj
				
						addmodifier newobj (Morpher())
						
						for i=1 to frames.value do (
							
							local tmp = at time (i-1) snapshot obj
									 tmp.name = "tgt_" + (((i-1) as time) as string)
							
							if 	hidetargets.checked then tmp.ishidden = true
							if 	freezetargets.checked then tmp.isfrozen = true
								
							WM3_MC_BuildFromNode newobj.morpher i tmp
							
							append targets tmp														

						)
						
						
						for i=1 to frames.value do (						
							
							with animate on (
									
									at time (i-2) WM3_MC_SetValue newobj.morpher i 0.0
									at time (i-1) WM3_MC_SetValue newobj.morpher i 100.0
									at time i WM3_MC_SetValue newobj.morpher i 0.0
										
							)
							
													
						)
				
				
			) else (
						
				pickmesh.text = "select mesh"
						
			)
		
		)
	)
	 
	
)
 createDialog X pos:[100,100]

Thank you very much!! this is great

B