Search the Community

Showing results for tags 'code'.

• Search By Tags

Type tags separated by commas.

Forums

• General
• Lounge/General chat
• Education
• Jobs
• Marketplace
• Houdini
• General Houdini Questions
• Effects
• Modeling
• Animation & Rigging
• Lighting & Rendering
• Compositing
• Games
• Tools (HDA's etc.)
• Coders Corner
• HDK : Houdini Development Kit
• Scripting
• 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 27 results

1. vex Remesh using only VEX

Hello to everyone! I'm creating this topic just to see if someone is able to break down the remesh node in VEX. The point is to achieve a faster result using a wrangler or more as a substitution for the remesh or polyreduce. So here you have some questions: 1. Is it better to use the original mesh (deleting and modifying the mesh) or creating a new one (generating points)? 2. Is the source code used in the remesh node faster than any script that could be written in VEX? If you find a way or you have an idea about how to do it, don't hesitate to share it with the community!
2. Calculate the rotation difference between two similar geometries

In short, how can I calculate the transformation matrix, or just rotation similar to how a geometry constraint/rivet works, where you define a few points as reference to glue a geo to an animated one? Long one: I want to procedurally animate the preroll of some packed RBDs, by comparing frame 1 and 2 of the simulation and project the objects backwards in time using that offset. It's a pre-broken sphere, so for translation, I find the average position of all points for both frames to calculate the offset per frame, which works great. [@P -= offset * backwardFrame;] The rotation part isn't as accurate though. I believe multiplying a rotation matrix with a scalar [@P*= rotMatrix*time] doesn't produce the desired results, so I am trying to calculate an axis and a rotation value that describes the difference between these two frames. I am currently picking the positions of 1 random but similar point in both geometries relative to their center, which I cross to find the axis. Then I use an acos(dot()) to get the angle between these two vectors. It almost works, but not 100% and picking a different point changes the result a bit. I guess that's happening because I need to take in consideration more than 1 points into the two geometry. thank you
3. how to generate params from a wrangler with code

i am creating a attribute wrangler and will create 2 params, from the UI i can click that little icon and will create it for me, super easy. I did try to to grab the param and press "push button" h=hou.node('/obj/box1_Grooming/pointwrangle_width') ex=h.parm("exportlist") hou.Parm exportlist in /obj/box1_Grooming/pointwrangle_width> ex.pressButton() but nothing happen =( i inspect the button via "edit parameter interface" to see if there was a code or a callback attach to it,but didnt find anything... =( how could i create those params?
4. [Python] .asCode() function and the SOP level solver node

Hey, bit of a specific use case here, but has anyone successfully used the .asCode() Python function with the SOP solver? I can't seem to get it to save and recreate the nodes inside of the sop level solver node. I spent some time researching it but haven't found anyone even mentioning this problem. Everything else seems to work fine with the function even the DOP level SOP solver. It's just the SOP level solver that has this issue. I'm kind of at my wit's end trying to figure this out. I might be missing something super simple or obvious here, but I'm hoping someone else has encountered this and figured out what is happening. I suppose it could also be a bug, I haven't taken the time to dig through all the change logs on the SideFX website. I'm currently encountering this in Houdini 18.0.348 (which has known issues with the .asCode() function) as well 18.0.597 (where those issues have supposedly been resolved). If anyone has any insight I'd really appreciate a nudge in the right direction. Cheers, Brandon
5. How can I read and format text files and write attributes?

Hi all, ** The thing I want to do is to obtain the coords from this kind of file and write vector positions. The positions corresponds to the place and orientation of each photo was taken. I want to track the path in wich the photos was taked. I have a file called cameras.sfm from "structure from motion" created with meshroom app (not inside houdini). I can read the file and split the lines with python, but I don't know how can I give format and write attributes to pass to an object. I'm new coding in python The file has two basic sections: - one called "views" that is an array of specs of a camera... that I don't need, but at the bottom of the file, is an array is what I need to give some format and pass to the attribute in sop level The array starts with the tag "poses": And each "pose" has an Id, maybe could be usefull to write an attribute for the id and others for the vector for the values in transform/rotation and the "center" I have some code for read the file and print/split lines but... I need help, hope you can guide me Thanks in advanced...
6. How to set up a houdini dev environment?

Hello, I was wondering if anyone has dabbled with building a custom environment for Python development in Houdini. My goal is to simulate the hython shell in visual studio code and run my script with corresponding feedback in a Houdini session. The SideFx documentation on Command-Line Scripting is a great start. I understand bash scripting and setting \$PATH variables but with that said I am a noob for creating this kind of interwoven setup and could use some guidance.
7. volume visualization node controlled by coding

Hello, I am simulating a data driven project. Say I have a volume node that generated a sphere volume, I also have 200 columns data that will fit into 0 - 10 range, and these 0 - 10 values will be used to generate different 200 color point in the color ramp slider in volume visualization node, and the effect I want to achieve is that 200 shells of spheres are colored based on 200 column data, and each shell's color also changes based on each row's data in each column. Like the screenshot I attached here, but I need more color points. What I want to do definitely needs coding, but I don't know where I could code to manipulate volume visualization node. Hope someone could help! This seems boring, but I really need some inspiration for my project~ Many thanks in advance!!!
8. some basic question about SOP_PointWave Example code

hello everyone,i'm learning c++ and I'm new to Houdini HDK. I was reading another topic, someone told that you can use example files and manipulate them. so I have some questions for you: as you can see the header code and it's definition namespace HDK_Sample { /// Run a sin() wave through geometry by deforming points /// @see @ref HOM/SOP_HOMWave.C, SOP_HOMWave, SOP_CPPWave class SOP_PointWave : public SOP_Node { public: SOP_PointWave(OP_Network *net, const char *name, OP_Operator *op); virtual ~SOP_PointWave(); static PRM_Template myTemplateList[]; static OP_Node *myConstructor(OP_Network*, const char *, OP_Operator *); /// This method is created so that it can be called by handles. It only /// cooks the input group of this SOP. The geometry in this group is /// the only geometry manipulated by this SOP. virtual OP_ERROR cookInputGroups(OP_Context &context, int alone = 0); protected: /// Method to cook geometry for the SOP virtual OP_ERROR cookMySop(OP_Context &context); private: void getGroups(UT_String &str){ evalString(str, "group", 0, 0); } fpreal AMP(fpreal t) { return evalFloat("amp", 0, t); } fpreal PHASE(fpreal t) { return evalFloat("phase", 0, t); } fpreal PERIOD(fpreal t) { return evalFloat("period", 0, t); } /// This is the group of geometry to be manipulated by this SOP and cooked /// by the method "cookInputGroups". const GA_PointGroup *myGroup; }; using namespace HDK_Sample; void newSopOperator(OP_OperatorTable *table) { table->addOperator(new OP_Operator( "hdk_pointwave", "Point Wave", SOP_PointWave::myConstructor, SOP_PointWave::myTemplateList, 1, 1, 0)); } static PRM_Name names[] = { PRM_Name("amp", "Amplitude"), PRM_Name("phase", "Phase"), PRM_Name("period", "Period"), }; PRM_Template SOP_PointWave::myTemplateList[] = { PRM_Template(PRM_STRING, 1, &PRMgroupName, 0, &SOP_Node::pointGroupMenu, 0, 0, SOP_Node::getGroupSelectButton( GA_GROUP_POINT)), PRM_Template(PRM_FLT_J, 1, &names[0], PRMoneDefaults, 0, &PRMscaleRange), PRM_Template(PRM_FLT_J, 1, &names[1], PRMzeroDefaults), PRM_Template(PRM_FLT_J, 1, &names[2], PRMoneDefaults), PRM_Template(), }; OP_Node * SOP_PointWave::myConstructor(OP_Network *net, const char *name, OP_Operator *op) { return new SOP_PointWave(net, name, op); } SOP_PointWave::SOP_PointWave(OP_Network *net, const char *name, OP_Operator *op) : SOP_Node(net, name, op), myGroup(NULL) { mySopFlags.setManagesDataIDs(true); } SOP_PointWave::~SOP_PointWave() {} OP_ERROR SOP_PointWave::cookInputGroups(OP_Context &context, int alone) { return cookInputPointGroups( context, // This is needed for cooking the group parameter, and cooking the input if alone. myGroup, // The group (or NULL) is written to myGroup if not alone. alone, // This is true iff called outside of cookMySop to update handles. // true means the group will be for the input geometry. // false means the group will be for gdp (the working/output geometry). true, // (default) true means to set the selection to the group if not alone and the highlight flag is on. 0, // (default) Parameter index of the group field -1, // (default) Parameter index of the group type field (-1 since there isn't one) true, // (default) true means that a pointer to an existing group is okay; false means group is always new. false, // (default) false means new groups should be unordered; true means new groups should be ordered. true, // (default) true means that all new groups should be detached, so not owned by the detail; // false means that new point and primitive groups on gdp will be owned by gdp. 0 // (default) Index of the input whose geometry the group will be made for if alone. ); } OP_ERROR SOP_PointWave::cookMySop(OP_Context &context) { OP_AutoLockInputs inputs(this); if (inputs.lock(context) >= UT_ERROR_ABORT) return error(); duplicatePointSource(0, context); fpreal t = context.getTime(); float phase = PHASE(t); float amp = AMP(t); float period = PERIOD(t); if (error() >= UT_ERROR_ABORT) return error(); if (cookInputGroups(context) >= UT_ERROR_ABORT) return error(); GA_Offset ptoff; GA_FOR_ALL_GROUP_PTOFF(gdp, myGroup, ptoff) { UT_Vector3 p = gdp->getPos3(ptoff); p.y() += SYSsin( (p.x() / period + phase) * M_PI * 2 ) * amp; gdp->setPos3(ptoff, p); } if (!myGroup || !myGroup->isEmpty()) gdp->getP()->bumpDataId(); return error(); } my first question is: we have this int header file : SOP_PointWave(OP_Network *net, const char *name, OP_Operator *op); where is it's definition in *.c file? ----------------------------------------------------------------------------------------------------------------------------------------- my second question is: void newSopOperator(OP_OperatorTable *table) { table->addOperator(new OP_Operator( "hdk_pointwave", "Point Wave", SOP_PointWave::myConstructor, SOP_PointWave::myTemplateList, 1, 1, 0)); } why this function is void? I know because it won't return anything, but why it shouldn't? why newSopOperator's parameter is a class (i know a class is custom data type) but why? and what is table in the parameter? ----------------------------------------------------------------- BEST REGARDS
9. Python - Integer to String

In the Python SOP, I've run into a wall trying to get an integer converted to a string. In the larger picture, I'm trying to subtract 1 from a value which is currently part of a string. There are probably neater ways to write these steps, but I'm fairly new to Python so I'm writing it all out to make things easier to follow. I start with a string such as: string = "f27" Then remove the 'f' like so: string = string[1:] Convert it to an integer: integer = int(string) Subtract 1 from the value: integer -= 1 set new string string_new = "f" + str(integer) The last line returns an error on the Python SOP: TypeError: str() object is not callable. This is confusing because these same steps work just fine in the Python shell. Is there an alternative to str(), or am I using it wrong?
10. Opchange "issue"

Hi guys, Just a quick question I hope have a simple answer! I have a dual boot setup and switch back and forth between Win and Linux. Due to files having to point to same location I have a variable in the .env that point to each respective mounting place \$NAS. Now, I imported an FBX through the File menu and it pops in as expected, but all the nodes have the full path in them. With the Textport I can do the "opchange" operation to switch the mounting place to the variable - but when I do that it converts the variable to it's value (the original path). My question now is: Can I somehow do the opchange without the Textport converting the variable to it's value and simply make it put the variable there instead of the path? I hope my rambling is not too confusing. Thanks a bunch, Jack
11. Context-Sensitive Rule-Based Hotkey System

http://patreon.com/posts/33249763 http://gumroad.com/l/houdinisupercharged In this video I will show you some of the inner workings of the context-sensitive rule-based hotkey system that I implemented and one I have been using for a while to speed up my workflow inside Houdini. It's a very light-weight and flexible system that allows an arbitrary number of actions to be assigned to any key, with extensive modifier key and state support (Ctrl, Shift, Alt, Space, LMB, MMB, RMB, selection state). It's deeply integrated into the overlay network editor workflow.
12. Setting up VS Code for Houdini Python

Hi, Im new to python, Im trying to use vscode as external editor but it really sucks at being intuitive for a beginner... 1) Im trying to add the hou.module so I can see the functions but It doesnt show the functions: my settings.json looks like this: { "python.pythonPath": "C:\\PROGRA~1\\SIDEEF~1\\HOUDIN~1.287\\python27\\python.exe", "python.linting.pylintEnabled": false, "python.linting.enabled": true, "python.linting.flake8Enabled": true, "[python]":{}, "python.jediEnabled": false, "python.autoComplete.extraPaths": [ "C:\\Program Files\\Side Effects Software\\Houdini 18.0.287\\houdini\\python2.7libs\\Hou.pyc" ], } (I tried without the [] brackets too) 2) Also when I edit a .py Code tells me: Linter flake8 is not installed. And when I click Install is says: There is no Pip installer available in the selected environment. Can someone help? Im using: Windows 10 Houdini 18 VS Code v 1.41.1 Python v 2.7.15 64-bit
13. How to find Node name for createNode in Python

Hi, How do I find the name of a node to pass into the 'createNode()' function? I'm following a tutorial, and in it he writes: .createNode(“ifd”) to create a mantra node. But I can't figure out where I find this. I've printed the node using the ‘.asCode()’ function, but I'm not really sure what I'm looking for. Thanks a lot
14. Scale metaball by bounding box size?

Hi Guys, For a tool i'm working on i need the radius of my metaball to be affected by the size of a painted region from a terrain, can anybody suggest how this would be done? It needs to change as the user paints but i'm getting stuck on the exact terminology of the code i would need to type into the region field on the metaball, this is what i currently have typed into the radius field on the metaball but it isn't working: getpointbbox_size(/obj/leaf_pile/"bound1", 0) Any suggestions would be greatly appreciated!
15. Mantra Distributed Rendering "No Code Generator Available" Error/Bug

Hi, I am currently trying to use mantra in distributed rendering mode. (mantra -H machine1,machine2) It all works as expected, but as soon as I connect something into a cached shader (for example a constant into the principled shader), the error “No Code Generator Available for opshader_path_xyz” pops up and it doesn't render at all anymore. It also happens with custom cached shader assets. All works well in non distributed rendering mode. If I unlock the asset, then it seems to work again since the asset is then "in the file", but this is unfortunately not useful in production. Additional Info: I am using windows and the “Force VEX Shader Embedding” checkbox is on. Has anyone experienced this error before? If no I'll submit a bug report. Cheers, Luca
16. Translating expressions from v14 to v16.5

Hi there. I’m having some trouble translating two parameter expressions in this tutorial using Houdini 14 to Houdini 16.5: https://player.vimeo.com/video/130386299 The first expression is for the Value parameter in a attribute create node (given the name “WIDTH”). It is meant to tapper the octopus tentacle geometry. The attribute was created as a Ramp Float (given the name “cross”), in a null node named “Cross_RAMP.” The expression looks like this: chramp(“../Cross_RAMP/cross”,\$PT/\$NPT,0) The second expression is meant to help centralize control for the Scale parameter in a sweep node. The expression look like this: point(“../WIDTH”,\$PT,”width”,0) So the null where the ramp was created is being tapped in the attribute create node, which is being tapped by the sweep node. But it is not working. The errors I get for these offer some leads, but I’m too new to code expressions to sort it out on my own. Wading through the online documentation and trial and error has not yet proven fruitful. I could use some help. Would someone tell me the proper expression to write, either with a VEX snippet, or other such replacement code? Thanks in advance for time and efforts.
17. Environment variables question.

Is there a environment variable that will allow Houdini to open in manual when Houdini is fired up? That being said, is there an env variable that will also allow me to save incrementally? Thanks for your help Midi

20. Change background color for "No Syntax Highlighting"

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; }
21. C++ Wrangle: The Last Frontier In Custom Tool Development From Within Houdini

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.
22. OpenCL Wrangle SOP: Geometry Manipulation on the GPU using OpenCL

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.
23. 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); }
24. Need help with Python -> VEX

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
25. 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.
×

• Support

×
• Create New...