Jump to content

Search the Community

Showing results for tags 'code'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Lounge/General chat
    • Education
    • Jobs
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering
    • Compositing
    • Games
  • Coders Corner
    • HDK : Houdini Development Kit
    • Scripting
    • Shaders
  • Art and Challenges
    • Finished Work
    • Work in Progress
    • VFX Challenge
    • Effects Challenge Archive
  • Systems and Other Applications
    • Other 3d Packages
    • Operating Systems
    • Hardware
    • Pipeline
  • od|force
    • Feedback, Suggestions, Bugs

Found 10 results

  1. Hey guys! I'm starting this thread to share few shelf scripts i use and came across, during my houdini journey. Please feel free to add in more! # ADD NODES/OBJECTS TO MANTRA (Customisable) Select node(s) and click on the script to add it to mantra's force object/matte object etc. You can customise where to add by changing the parameter name (line 22) import hou selection = hou.selectedNodes() names = [n.name() for n in selection] my_list = “” if len(selection) < 1 : my_list = "nothing selected, please select at least one object" else: a=1 for sel in selection: my_list = my_list + "\n" + "selected object " + str(a) + ":" + sel.name() a=a+1 hou.ui.displayMessage(my_list, buttons=('OK',)) length = len(selection) print "Number of nodes selected: " + str(length) paths = [n.path() for n in hou.node('/out').allSubChildren() if n.type() == hou.nodeType('Driver/ifd')] selected = hou.ui.selectFromTree(choices=paths) mantras = [hou.node(path) for path in selected] for m in mantras: m.parm('matte_objects').set(' '.join(n.name() for n in hou.selectedNodes())) #CHANGE PARAMETER NAME AS REQURIED print ("Selected mantra nodes : ") + m.name() new_name=' '.join(names) hou.ui.displayMessage("( "+ (new_name) + " ) – added to selected mantra(s) matte objects.", buttons=('*OK*',)) #SETUP DELAYED LOAD Select node(s) and execute. It'll create procedural shader and setup all the parameters. Works on all nodes with 'file' parameter. #function for node variable: return type, description and name def extract_getTypeName(node): nodetype = node.type() description = nodetype.description() type_name = nodetype.name() return type_name #show selection tuple names selection = hou.selectedNodes() print len(selection) my_list = “” if len(selection) < 1 : my_list = "nothing selected, please select at least one object" else: a=1 for sel in selection: my_list = "selected object : " + sel.name() a=a+1 hou.ui.displayMessage(my_list, buttons=('OK',)) #for each object in selection lenght = len(selection) print "DONE!" for i in range(lenght): #create python variable for selected node selected = hou.selectedNodes()[i] if selected: meshop=hou.node('/shop'); meshop=meshop.createNode('vm_geo_file'); meshop.setName('delayed_load_shop_1', 1) targetdshop=meshop.path(); meobj=hou.node('/obj') meobj=meobj.createNode("geo"); meobj.setParms({"shop_geometrypath":targetdshop}); meobj.setName('DELAYED_load_geo_1', 1) targetfile=selected.parm('file') or selected.parm('sopoutput') mefile=meobj.node('file1') meobj.parm("geo_velocityblur").set(1) meobj.parm("vm_forcegeometry").set(0) meshop.parm("file").set(targetfile)
  2. This operator allows you to run an OpenCL kernel as part of your SOP network. Depending on the GPU, some operators can be orders of magnitude faster than even VEX. In this case the OpenCL code is 144 times faster than VEX on GTX 970.
  3. Hello Everyone, http://www.hossamfx.org/math-in-houdini-vol2/ Hello Everyone, Description: In volume two of Math in Houdini training. We will continue exploring the big role of math in creating visual effects and controlling the simulation behavior and this time we will move to more advanced concepts and provide cool projects. I will explain one of most important physical parameter: the gradient. And show you how to use it in rigging and collision and give you wide idea about using gradient in different operations in Houdini also We will go indepth with matrices and learn cool techniques using the matrix: it is the “Frame of Reference” you must know this magic secret about matrix. If you have many questions about Quaternion parameter, So we will dive into this concept and answer all questions with cool projects and we will see how to create quaternion field to effectparticles motion and if you don’t know what is the Vector 4, we will have cool project about using vector 4 inside the wire solver dynamics. And I will show you how it to build your own cloth simulation from scratch, this part will give wide idea about how the dynamic solvers work and what is the constraint , gravity , and how the collision is calculated ….. and many other math topics. Thank you. Lesson plan WHAT IS THE GRADIENT, AND FOR WHAT !!! all dynamic solvers use Gradient and normal and velocity and collision calculations, all this Physical Parameters use Gradient, you absolutely Know what is the Gradient !!! ? 1. Gradient & Slope Relationship– Are there any relationship between it? 2. It can create Normal – slope can create normal, how? 3. Speed and Velocity calculates –it is awesome how slope can calculates speed for everything. 4. Slope & Dot product in Rigging – No more tutorials about how to Rig the wheel. 5. Gradient of surface – Slope can create Gradient 2D field. MATRIX IN DEPTH !!! we will start by talking about for what we need matrix and next it will be more clear how it is easy to use matrix, and Frame of Reference is strong concept that you must have idea on how to use. 6. Why we created the Matrices – to understand matrices I must know for what it was created. 7. Recreating the Matrix – Now we will see how it is more easy with Matrices. 8. Frame of Reference – it is cool Concept you must know how to use with matrices. QUATERNION, NO MORE QUESTIONS ??? you don't know any thing about quaternion! you will know every thing about it, for what, when to use, how to control and how to build field of quaternion to advect particles. 9. What is the Quaternion – You will Have depth understand of this Scary parameter. 10. Quaternion Field part 1 – Quaternion inside Dynamics can create awesome animation in Particles. 11. Quaternion Field part 2 –How to Keep Particles inside defiened Volume using quaternion attribut VECTOR 4 IS A QUATERNION, ... !!! the orient attribute in the Wire solver is very important and you must know how it work, in this project we will manipulate this Attribute to create procedural dynamic animation. 12. Quaternion & Wire Solver – Big role of Quaternion in wire object. 13. Feelers & Quaternion part 1 –Feelers of insects moving around all the time, we will simulate this motion with quaternion. 14. Feelers & Quaternion part 2 –How to control the physical parameters of feelers to get nice real motion. SIMULATION CODE & COLLISION it is very important to get depth understand of how the Dynamic solvers work, we will see how we can build cloth simulation and add collision to this simulation using the Point VOP and Sop Solver. 15. Apply Gravity –Without any dynamics solvers, we will create our solver and start by adding gravity force to objects using the point vop and sop solver. 16. Create Cloth Force – Define the force spring between cloth object points and create pin constraint for new solver. 17. Gradient & Collision –Gradient of Volume is the way to create collision between objects. ِAll Content With Project Files . Full information Here
  4. Hi Please consider changing the default background for the style for "No Syntax Highlighting" to a brighter color. As it is now it's almost impossible to read. I seems a lot of people leave this setting at default, which is fine but please make it easier to read. Something like this will be more than sufficient: pre.ipsCode{ background: #ccc; }
  5. The most powerful wrangle operator due to the sheer fire power of the HDK. Performance increase can vary from a few times to thousands of times depending on the scenario.
  6. Wrangle Nodes

    Today I was investigating how really works wrangle nodes type( more in general vex ) trying some printf debug statment. as written in the reference : "This node runs the snippet on the detail or every point/primitive/vertex (depending on the Class parameter) in the input geometry. The snippet can edit the input geometry by changing attributes. It can access information from other geometry using attributes and VEX functions." so chosing point class parameter and having for example an array/set of points( I don't know how point are actually internally handled by houdini), the code is "applied" to every i-th elements of the array, like a big external "invisible" forEach loop. Correct me if I'm wrong. now, my snippet is very simple: for (int i=0; i <5;i++) { printf("Point processed is %d \n", @ptnum); printf("Number of iteration: %d\n", i); }
  7. Hi there. I need some help with Vex. I've set up a Python Sop with the code below but this is very slow. So my next challenge is to re-create it in vex (or fix the Python code if it can run much faster). Vex is unknown territory, and my vex code fail already with the attempt to create an array with unique cluster values ('clusters' in the Python code). When I foreach() on the array to look up the existing values within the while loop, VEX execution seems to go into an infinite loop if I have a printf() statement anywhere in the code. I've put the vex code in a Attribute Wrangle Sop with Run Over set to Detail (to be able to count over points). My working Python code: node = hou.pwd() geo = node.geometry() # Add code to modify contents of geo. # Use drop down menu to select examples. geo.addAttrib(hou.attribType.Point, "activate_by_cluster", 0) #geo.addAttrib(hou.attribType.Point, "Cd", (0.0, 0.0, 0.0)) # Set threshold for number of points in a cluster before becoming active min_points = 40 clusters = [] for p in geo.iterPoints(): cluster = p.attribValue("cluster"); if cluster not in clusters: clusters.append(cluster) for cl in clusters: active_cluster = False threshold = 0 for p in geo.iterPoints(): if p.attribValue("cluster") == cl and p.attribValue("activate_box") == 1: threshold += 1 if threshold >= min_points: active_cluster = True break if active_cluster == True: for p in geo.iterPoints(): if p.attribValue("cluster") == cl: p.setAttribValue("activate_by_cluster", 1) This is the vex code I got so far: //Global settings int min_points = 400; //Global variables int clusters[] = {0}; //Get the existing clusters from the points int pt_num = 0; while(pt_num < @numpt){ int _cluster = point(geoself(), "cluster", pt_num); foreach(int i; clusters){ if(_cluster != i){ push(clusters, _cluster); } } pt_num++; } //printf("%d", clusters); foreach(int i; clusters){ int active_cluster = 0; int threshold = 0; while(threshold < @numpt){ int _cluster = point(geoself(), "cluster", pt_num); int _activate_box = point(geoself(), "activate_box", pt_num); if(_cluster == i){ if(_activate_box == 1){ threshold++; } } } if(threshold >= min_points){ active_cluster = 1; break; } if (active_cluster == 1){ pt_num = 0; while(pt_num < @numpt){ int _cluster = point(geoself(), "cluster", pt_num); if(_cluster == i){ //setpointattrib(geoself(),"activate_by_chunk", pt_num, 1, "set"); } } } } I've just tried to do the same in vex as I did in Python. Needless to say, it does not work as it is although I get no error messages. In case the intention is unclear: I am looping over the current points looking for the cluster attribute (coming from Cluster Points sop). I then go through the points in each cluster looking for the "activate_box" attribute. If this is 1 and a minimum of points with these conditions is found, set all points in the cluster to have the "activate_by_chunk" attribute to 1. This is used downstream. Please let me know if you have any ideas! Ole
  8. for loop in one line

    i am trying to put a code into a button that will print the values of some parameters, i was able to make a list with t = [x for x in hou.pwd().parms() if x.name().startswith("blend")]; then i can print the list of the parameters that i want with print t; but if i want to do something to each one is when starts to break: t = [x for x in hou.pwd().parms() if x.name().startswith("blend")]; print t; for i in t: print i.eval(); the funny thing is if i print all directly with out doing the filter list does work =( for i in hou.pwd().parms(): print i.eval(); any cool tip that might work? thanks.
  9. i select some nodes on the network tab, and i do get a tuple, i can make it a list, and then sort them. but is not always the same depending on the way the node were selected. can i sort them base on node.name()
  10. My python Code Not working

    Hi guys i'm newcomer in Houdini, my simple code not working and don't show error in Houdini console! i changed the Tag Name to "osk" from "osm" but i don\t see error 'Bad file type' in console. import xml.dom.minidom document=""" <osk version="0.6" generator="CGImap 0.1.0" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> <bounds minlat="40.7432000" minlon="-73.9897000" maxlat="40.8052000" maxlon="-73.9304000"/> <node id="1420631950" lat="40.7711745" lon="-73.9792204" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/> <node id="1420631974" lat="40.7716867" lon="-73.9779803" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/> <node id="1420631985" lat="40.7694268" lon="-73.9788969" user="dchiles" uid="153669" visible="true" version="1" changeset="9189979" timestamp="2011-09-02T04:12:03Z"/> </osk> """ map = xml.dom.minidom.parseString(document) if (map.documentElement.tagName != "osm"); print('Bad File Type') return [/CODE] Thanks
×