Houdini indie export to Cycles(standalone)
16607 34 2- mandrake0
- Member
- 642 posts
- Joined: 6月 2006
- Offline
- Gerbrand
- Member
- 62 posts
- Joined: 3月 2014
- Offline
- mandrake0
- Member
- 642 posts
- Joined: 6月 2006
- Offline
Gerbrand
Nice !!!
I tried it straight away!
I just made a particle emitter, and used the copy sop to get some geo on there.
I can load the individual files, but not the sequence.
Is there a way to import a sequence, or am I jumping the gun ?
Anyways, awesome work!!
sequence's are not my prioritys at the moment first target is that the import works with the geo file.
i don't even know whats the best way for the sequence import i thinking of a modifier where you can
select the geo file and set the frame range but thats just a option.
what would be your preferd way for a integration?
- Gerbrand
- Member
- 62 posts
- Joined: 3月 2014
- Offline
well for non-changing topology we already have obj with mdd.
This works as a modifier
To be honest with you, I would love it if it is allot like the file sop in houdini.
That way its always reading it from disk, so if we make changes in houdini, it should just update on reload.
Most of the things i can't render in blender right now, is changing topology stuff, like particle systems and liquid meshes.
Cameras are a real pain, but I have my workarounds.
Being able to render a sequence of changing topology is right at the top of my personal list
This works as a modifier
To be honest with you, I would love it if it is allot like the file sop in houdini.
That way its always reading it from disk, so if we make changes in houdini, it should just update on reload.
Most of the things i can't render in blender right now, is changing topology stuff, like particle systems and liquid meshes.
Cameras are a real pain, but I have my workarounds.
Being able to render a sequence of changing topology is right at the top of my personal list
- Enivob
- Member
- 2617 posts
- Joined: 6月 2008
- Offline
@Gerbrand: It was not too hard to extend the Blendgraph Meshfoot node to include the *.json format that Mandrake0 provided.
This gives scrubbable JSON sequences inside of Blender 2.76. Of course Meshfoot already scrubbed .OBJ sequences.
Here is the code tweak I made to the bg_node_meshfoot.py script to allow loading of JSON files. You can see the other file format support as well.
if self.extension_type == “.WRL” or self.extension_type == “.wrl”:
try:
io_scene_x3d.import_x3d.load_web3d(mesh_name)
attempt = True
except:
attempt = False
elif self.extension_type == “.JSON” or self.extension_type == “.json”:
print (“Attempting to read JSON file format.”)
from . import h2c
from . import h2bimporter
h2c.load(mesh_name)
h2bimporter.load(h2c.hdata)
attempt = True
elif self.extension_type == “.3DS” or self.extension_type == “.3ds”:
io_scene_3ds.import_3ds.load_3ds(mesh_name,bpy.context)
attempt = True
elif self.extension_type == “.LWO” or self.extension_type == “.lwo”:
io_import_scene_lwo.load_lwo(mesh_name,bpy.context)
attempt = True
I get 4fps playback inside of Blender of a crumbling building whose file size is 2MB per frame.
I get 24fps inside of Houdini along with pyro and debris in the same scene.
Blender will never be able to achieve the speed of Houdini because all imports go through a single core python script that is parsing ASCII files.
NOTE: I stripped all attributes from the object before exporting the JSON sequence from Houdini.
This gives scrubbable JSON sequences inside of Blender 2.76. Of course Meshfoot already scrubbed .OBJ sequences.
Here is the code tweak I made to the bg_node_meshfoot.py script to allow loading of JSON files. You can see the other file format support as well.
if self.extension_type == “.WRL” or self.extension_type == “.wrl”:
try:
io_scene_x3d.import_x3d.load_web3d(mesh_name)
attempt = True
except:
attempt = False
elif self.extension_type == “.JSON” or self.extension_type == “.json”:
print (“Attempting to read JSON file format.”)
from . import h2c
from . import h2bimporter
h2c.load(mesh_name)
h2bimporter.load(h2c.hdata)
attempt = True
elif self.extension_type == “.3DS” or self.extension_type == “.3ds”:
io_scene_3ds.import_3ds.load_3ds(mesh_name,bpy.context)
attempt = True
elif self.extension_type == “.LWO” or self.extension_type == “.lwo”:
io_import_scene_lwo.load_lwo(mesh_name,bpy.context)
attempt = True
I get 4fps playback inside of Blender of a crumbling building whose file size is 2MB per frame.
I get 24fps inside of Houdini along with pyro and debris in the same scene.
Blender will never be able to achieve the speed of Houdini because all imports go through a single core python script that is parsing ASCII files.
NOTE: I stripped all attributes from the object before exporting the JSON sequence from Houdini.
Edited by - 2016年1月5日 22:47:47
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- mandrake0
- Member
- 642 posts
- Joined: 6月 2006
- Offline
Enivob looks nice didn't know about blendgraph :-) well my target was more that you can render with cycles or any other opensource render bringing both community's a small step closer. :-). i didn't optimize the python code for speed because i know it's much slower then a c/c++ implementation.
a production bgeo/geo importer wasn't my target.
the only real solution would be when the alembic and openvdb importer is done in blender.
a production bgeo/geo importer wasn't my target.
the only real solution would be when the alembic and openvdb importer is done in blender.
- Gerbrand
- Member
- 62 posts
- Joined: 3月 2014
- Offline
Hey Enivob
This sounds awesome!!
I watched the meshfoot video on vimeo, but it assumes I'm smarter than I am
How do i get meshfoot or this improved version to run in blender?
Where do i find the script?
never used scripts in blender before
I'm real green in blender. I've only been messing with importing and rendering stuff.. too much houdini to still learn
Please help
This sounds awesome!!
I watched the meshfoot video on vimeo, but it assumes I'm smarter than I am
How do i get meshfoot or this improved version to run in blender?
Where do i find the script?
never used scripts in blender before
I'm real green in blender. I've only been messing with importing and rendering stuff.. too much houdini to still learn
Please help
- Gerbrand
- Member
- 62 posts
- Joined: 3月 2014
- Offline
ok I will answer my own question in case there are other noobs like myself struggling with this
go here:
http://blenderartists.org/forum/showthread.php?252844-Script-Meshfoot-OBJ-Sequence-Manager-%28revised-for-Blender-2-76%29&p=2102852&viewfull=1 [blenderartists.org]
in post#1 there is a blender file.
load that in blender, and create a text editor window.
at the bottom of the window you will find a button called“brows text to be linked” (it looks like a little note pad, but not the one on the left corner of the pannel.)
click it and you should see the “frame_meshfoot.py” file
Save this for future use
The blend graph thing looks interesting, but that is a challenge for another day.
Right now I need to get paying work done, and this will get me there!!
Thanks for this guys!!
It should save lives until we get alembic and proper vdb support.
G
go here:
http://blenderartists.org/forum/showthread.php?252844-Script-Meshfoot-OBJ-Sequence-Manager-%28revised-for-Blender-2-76%29&p=2102852&viewfull=1 [blenderartists.org]
in post#1 there is a blender file.
load that in blender, and create a text editor window.
at the bottom of the window you will find a button called“brows text to be linked” (it looks like a little note pad, but not the one on the left corner of the pannel.)
click it and you should see the “frame_meshfoot.py” file
Save this for future use
The blend graph thing looks interesting, but that is a challenge for another day.
Right now I need to get paying work done, and this will get me there!!
Thanks for this guys!!
It should save lives until we get alembic and proper vdb support.
G
- Gerbrand
- Member
- 62 posts
- Joined: 3月 2014
- Offline
hey guys, earlier I claimed to have a workaround for getting cameras into blender from houdini.
It seems my workaround only worked for the scene I was testing with.
Do you guys know of a fool-proof way to get cameras into blender?
FBX seems to point the camera in a really weird direction.
Also, I treid installing blendgraph, but I cant find the addon.
It is suppose to be in this post, but I don't see a link
http://blenderartists.org/forum/showthread.php?322496-AddOn-Blendgraph-2-7-UPDATED-%28on-hiatus%29 [blenderartists.org]
Thanks guys
It seems my workaround only worked for the scene I was testing with.
Do you guys know of a fool-proof way to get cameras into blender?
FBX seems to point the camera in a really weird direction.
Also, I treid installing blendgraph, but I cant find the addon.
It is suppose to be in this post, but I don't see a link
http://blenderartists.org/forum/showthread.php?322496-AddOn-Blendgraph-2-7-UPDATED-%28on-hiatus%29 [blenderartists.org]
Thanks guys
- mandrake0
- Member
- 642 posts
- Joined: 6月 2006
- Offline
- Gerbrand
- Member
- 62 posts
- Joined: 3月 2014
- Offline
I don't know what it is with me and code…
I understand code, but I can't write it.
Node based “code” works for me
So update on the camera:
This is how i do it now:
Parent null under camera in houdini (CAMNull)
Rotate in objectspace 0,180,0
duplicate camera and kill animation
set the following expresion in camera transforms:
origin(“”, “/obj/CAMNull/”, TX), origin(“”, “/obj/CAMNull/”, TY), origin(“”, “/obj/CAMNull/”, TZ)
origin(“”, “/obj/CAMNull/”, RX), origin(“”, “/obj/CAMNull/”, RY), origin(“”, “/obj/CAMNull/”, RZ)
rightclick on transform parameters and bake (i think this might be new in h15)
export fbx 2013 (not ascii)
import into blendor at scale 100
This seems to work just fine, Maybe I should learn python to turn that into a button, or I could leave it to smart people like you
Oh and blendgraph has been deleted from the internet, so that is a bit of a dead-end.
The footmesh script works, but in some cases you need to assign the material for each frame of the animation.
So I'm still hoping you come up with something more user-friendly.
Something where you don't need to re-import if you make changes, just re-export from houdini, and maybe refresh in blender
G
I understand code, but I can't write it.
Node based “code” works for me
So update on the camera:
This is how i do it now:
Parent null under camera in houdini (CAMNull)
Rotate in objectspace 0,180,0
duplicate camera and kill animation
set the following expresion in camera transforms:
origin(“”, “/obj/CAMNull/”, TX), origin(“”, “/obj/CAMNull/”, TY), origin(“”, “/obj/CAMNull/”, TZ)
origin(“”, “/obj/CAMNull/”, RX), origin(“”, “/obj/CAMNull/”, RY), origin(“”, “/obj/CAMNull/”, RZ)
rightclick on transform parameters and bake (i think this might be new in h15)
export fbx 2013 (not ascii)
import into blendor at scale 100
This seems to work just fine, Maybe I should learn python to turn that into a button, or I could leave it to smart people like you
Oh and blendgraph has been deleted from the internet, so that is a bit of a dead-end.
The footmesh script works, but in some cases you need to assign the material for each frame of the animation.
So I'm still hoping you come up with something more user-friendly.
Something where you don't need to re-import if you make changes, just re-export from houdini, and maybe refresh in blender
G
- mandrake0
- Member
- 642 posts
- Joined: 6月 2006
- Offline
- Enivob
- Member
- 2617 posts
- Joined: 6月 2008
- Offline
I played around a bit with the code, but I have never been able to do a pixel perfect camera transfer into Blender from other apps.
I included a few useful properties of the camera but they are not implemented yet. I also created the camera manually rather than through bpy.ops which simplifies the math a little. In this implementation the math is contained only in the animation loop which means you don't have to change it in two places.
I was playing around with the swap matrix trying to land on a solution quickly but there is more than axis swapping going on between these two apps as far as coordinates are concerned.
#
# This Script Exports the Houdini Camera to Blender
#
# USAGE:
# In Blender open the Text Editor and load the generated script.
# Execute the RunScript
#
# TODO:
# - Fix Axis Problem
# - Creating a Custom ROP Node for simple Handling
# - Add more Parameters (Focal, Aperture, Clipping….) NOTE: not sure if i will add it
# - Better Version with Tuple's -> smaller Filesize
# get Camera
node = hou.parm(“getCamera”).eval()
# Other useful camera properties.
n = hou.node(“/obj/cam1”)
fl = n.parm(“focal”).eval()
fu = n.parm(“focalunits”).eval()
ap = n.parm(“aperture”).eval()
nc = n.parm(“near”).eval()
fc = n.parm(“far”).eval()
ic = n.parm(“iconscale”).eval()
rx = n.parm(“resx”).eval()
ry = n.parm(“resy”).eval()
pr = n.parm(“aspect”).eval()
sh = n.parm(“shutter”).eval()
fd = n.parm(“focus”).eval()
st = n.parm(“fstop”).eval()
# Framerange
frame_start = hou.playbar.playbackRange()
frame_end = hou.playbar.playbackRange()
# creates Python File for Blender
file = open(“test.py”, ‘w’)
# Python File Header for Blender
file.writelines('# Creates a Camera from Houdini Camera: ‘ + str(node) + ’\n')
file.writelines('# Load this script in the Python Editor and Run it\n')
file.writelines('# License Type: Public Domain\n')
file.writelines('__Author__ = “Francis Pimenta”\n')
file.writelines('__Version__ = 0.1\n\n')
file.writelines('import bpy\n')
# Make a camera object and link it to the scene.
file.writelines('ca = bpy.data.cameras.new(“ca_camera1”)\n')
file.writelines('obj = bpy.data.objects.new(“camera1”,ca)\n')
file.writelines('bpy.data.scenes.objects.link(obj)\n')
# loop
frame = frame_start
while frame <= frame_end:
# Houdini set Frame and getting Transition / Rotation
hou.setFrame(frame)
file.writelines('\n# Frame: ‘ + str(frame) + ’\n')
#Atom's coordinate attempt.
mtx = n.worldTransform()
# You can remap axis this way.
#swap_matrix = hou.Matrix4( (-1,0,0,0, 0,1,0,0, 0,0,-1,0, 0,0,0,1) ) # -X Y -Z
swap_matrix = hou.Matrix4( (0,0,1,0, 0,-1,0,0, 1,0,0,0, 0,0,0,1) ) # Z -Y X
#swap_matrix = hou.Matrix4( (0,0,1,0, 0,-1,0,0, -1,0,0,0, 0,0,0,1) ) # Z -Y -X
mtx = mtx * swap_matrix
pos=mtx.extractTranslates()
rot=mtx.extractRotates()
# Blender Rotation to Euler
cam_euler_x = ((rot)/360)*6.28
cam_euler_y = (rot/360)*6.28
cam_euler_z = (rot/360)*6.28
file.writelines('obj.rotation_euler = %s\n' % cam_euler_x)
file.writelines('obj.rotation_euler = %s\n' % cam_euler_y)
file.writelines('obj.rotation_euler = %s\n' % cam_euler_z)
file.writelines('obj.keyframe_insert(data_path=“rotation_euler”, frame=' + str(frame) + ‘, index=-1)\n’)
file.writelines('obj.location = %s\n' % pos)
file.writelines('obj.location = %s\n' % pos)
file.writelines('obj.location = %s\n' % pos)
file.writelines('obj.keyframe_insert(data_path=“location”, frame=' + str(frame) + ‘, index=-1)\n’)
frame += 1
file.close()
hou.setFrame(1)
I included a few useful properties of the camera but they are not implemented yet. I also created the camera manually rather than through bpy.ops which simplifies the math a little. In this implementation the math is contained only in the animation loop which means you don't have to change it in two places.
I was playing around with the swap matrix trying to land on a solution quickly but there is more than axis swapping going on between these two apps as far as coordinates are concerned.
#
# This Script Exports the Houdini Camera to Blender
#
# USAGE:
# In Blender open the Text Editor and load the generated script.
# Execute the RunScript
#
# TODO:
# - Fix Axis Problem
# - Creating a Custom ROP Node for simple Handling
# - Add more Parameters (Focal, Aperture, Clipping….) NOTE: not sure if i will add it
# - Better Version with Tuple's -> smaller Filesize
# get Camera
node = hou.parm(“getCamera”).eval()
# Other useful camera properties.
n = hou.node(“/obj/cam1”)
fl = n.parm(“focal”).eval()
fu = n.parm(“focalunits”).eval()
ap = n.parm(“aperture”).eval()
nc = n.parm(“near”).eval()
fc = n.parm(“far”).eval()
ic = n.parm(“iconscale”).eval()
rx = n.parm(“resx”).eval()
ry = n.parm(“resy”).eval()
pr = n.parm(“aspect”).eval()
sh = n.parm(“shutter”).eval()
fd = n.parm(“focus”).eval()
st = n.parm(“fstop”).eval()
# Framerange
frame_start = hou.playbar.playbackRange()
frame_end = hou.playbar.playbackRange()
# creates Python File for Blender
file = open(“test.py”, ‘w’)
# Python File Header for Blender
file.writelines('# Creates a Camera from Houdini Camera: ‘ + str(node) + ’\n')
file.writelines('# Load this script in the Python Editor and Run it\n')
file.writelines('# License Type: Public Domain\n')
file.writelines('__Author__ = “Francis Pimenta”\n')
file.writelines('__Version__ = 0.1\n\n')
file.writelines('import bpy\n')
# Make a camera object and link it to the scene.
file.writelines('ca = bpy.data.cameras.new(“ca_camera1”)\n')
file.writelines('obj = bpy.data.objects.new(“camera1”,ca)\n')
file.writelines('bpy.data.scenes.objects.link(obj)\n')
# loop
frame = frame_start
while frame <= frame_end:
# Houdini set Frame and getting Transition / Rotation
hou.setFrame(frame)
file.writelines('\n# Frame: ‘ + str(frame) + ’\n')
#Atom's coordinate attempt.
mtx = n.worldTransform()
# You can remap axis this way.
#swap_matrix = hou.Matrix4( (-1,0,0,0, 0,1,0,0, 0,0,-1,0, 0,0,0,1) ) # -X Y -Z
swap_matrix = hou.Matrix4( (0,0,1,0, 0,-1,0,0, 1,0,0,0, 0,0,0,1) ) # Z -Y X
#swap_matrix = hou.Matrix4( (0,0,1,0, 0,-1,0,0, -1,0,0,0, 0,0,0,1) ) # Z -Y -X
mtx = mtx * swap_matrix
pos=mtx.extractTranslates()
rot=mtx.extractRotates()
# Blender Rotation to Euler
cam_euler_x = ((rot)/360)*6.28
cam_euler_y = (rot/360)*6.28
cam_euler_z = (rot/360)*6.28
file.writelines('obj.rotation_euler = %s\n' % cam_euler_x)
file.writelines('obj.rotation_euler = %s\n' % cam_euler_y)
file.writelines('obj.rotation_euler = %s\n' % cam_euler_z)
file.writelines('obj.keyframe_insert(data_path=“rotation_euler”, frame=' + str(frame) + ‘, index=-1)\n’)
file.writelines('obj.location = %s\n' % pos)
file.writelines('obj.location = %s\n' % pos)
file.writelines('obj.location = %s\n' % pos)
file.writelines('obj.keyframe_insert(data_path=“location”, frame=' + str(frame) + ‘, index=-1)\n’)
frame += 1
file.close()
hou.setFrame(1)
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- Gerbrand
- Member
- 62 posts
- Joined: 3月 2014
- Offline
Did you test my method for the camera?
From what I could see, it was a perfect match.
I must say, I'm not sure what to do with your script or Houdini file.
Do I need to export the camera, or is there some live link witchcraft going on here?
Don't get me wrong, I'm all for live link witchcraft
Another idea would be to get Houdini engine to just work in blender.
You would need a engine license for each blender render node, but it's maybe not such a bad solution.
I don't know what would be the most work, so ignore me if I'm talking crazy
G
From what I could see, it was a perfect match.
I must say, I'm not sure what to do with your script or Houdini file.
Do I need to export the camera, or is there some live link witchcraft going on here?
Don't get me wrong, I'm all for live link witchcraft
Another idea would be to get Houdini engine to just work in blender.
You would need a engine license for each blender render node, but it's maybe not such a bad solution.
I don't know what would be the most work, so ignore me if I'm talking crazy
G
- mandrake0
- Member
- 642 posts
- Joined: 6月 2006
- Offline
the script creates a python file where you can execute in blender. Enivop made a fix for the camera position i had some trouble to get the correct values.
The houdini engine in blender would be interesting but at the moment my c++ knowledge is limited so not at the moment. but i will look into the houdini engine when i have got some spare time because i like the thin client approach.
The houdini engine in blender would be interesting but at the moment my c++ knowledge is limited so not at the moment. but i will look into the houdini engine when i have got some spare time because i like the thin client approach.
-
- Quick Links