Jump to content


Popular Content

Showing most liked content on 05/14/2018 in all areas

  1. 1 point
    I put together a simple script to read the .mtl file, typically associated with a .obj, and create a Redshift material for each entry it finds in the .mtl with a map_Kd token. A Redshift material is created and a texture map is linked to the diffuse color with the filename for the map populated with what is found in the .mtl entry. This is useful when importing architectural .obj files that typically have a large number of materials associated with them. Expected .mtl format of supported tokens. #newmtl _4_2_ <- Material name. #Ns 96.078431 <- Specular intensity #Kd 0.640000 0.640000 0.640000 <- Diffuse color. #Ks 0.500000 0.500000 0.500000 <- Specular color. #Ni 1.000000 <- Index of refraction. #d 1.000000 <- Opacity. #map_Kd 21_budova/_4_2_.jpg <- Map name. #map_Kn 21_budova/_4_2_n.jpg <- Map name. The result of one-click texture mapping. Here is the Colosseum auto texture mapped. The path to the .mtl file and texture path is hard coded. Place the code in a shelf tool button and adjust the path to point to your .mtl file. mtl_to_redshift_061618.zip
  2. 1 point
    1.) get the transform of the cube object, or use Extract Transform object if you don't have it. 2.) create an object container, transform it so that it's aligned to the anchor point on the rotating cube, and parent it to the transform from #1 3.) object merge your chain into this new container and make sure the transform mode is set to "into specified object"
  3. 1 point
    1 - to change the FLIP velocity you can update the velocity field (vel) or the particles velocity (v) with a gasfield wrangle (or VOP) // update particles vel (eg: add some vel in X) v@v += {0.1,0,0}; // update velocity field (eg: add some vel in X) v@vel += {0.1,0,0}; to delete the particles, you can use a geometry wrangle (or VOP) // example to delete droplets if(f@droplet>0) removepoint(0,@ptnum); 3 - density is the number of particle per voxel. A gasparticlecount microsolver creates a particlecount field and the values are normalized to create the f@droplet attribute. hope that helps...
  4. 1 point
    use the point deform when scatter with volumes, also u need to unpack your geo fixedscatter.hipnc
  5. 1 point
    you can also use the gasvortexboost DOP
  6. 1 point
    one method: 1) timeshift your geo to any static frame 2) scatter points, in the OutputAttribs tab turn on the first 2 options 3) put down Attribute Interpolate and put your points in first input, deforming geo into second input
  7. 1 point
    not exactly sure what you're after but if you want to calculate the gradient of curvature there is no better and easier way than what toadstorm already mentioned ... curv_gradient.hipnc
  8. 1 point
    Look at the "Confinement" parameter in the Shape tab of the Pyro solver, is based on the Gas Vortex Confinement dop. is a starting point. in other hand, you can create some vorticles forces advecting particles. look at this thread plenty of pyro info and some examples i guess
  9. 1 point
    You can compute the gradient of the curvature field you create, using a second VDB Analysis.
  10. 1 point
    If you find that the script crashes on certain .MTL files, it may be that the names used for materials violate the Houdini naming convention. Most notably, any material that starts with a number. i.e. 03, for example. These files may have been exported from 3DSMax. An example of .OBJ files with number based materials can be found at this link. I have written a short fixup script that will scan a folder of .OBJ files and examine the .OBJ and .MTL for Houdini naming violations. If it finds them, it will re-write the .OBJ and .MTL file with a revised name that meets the Houdini naming convention. # Rewrite the .OBJ and .MTL files to make material names Houdini compliant. # Most notably, 3DSMax exported .OBJ files with a material that starts with a number i.e. 03, for example. # Like the OBJ files found at this link. https://www.turbosquid.com/3d-models/free-3ds-mode-building-ready-city/690329 import os def returnFilesLike(passedFolderName, passedFileExtension = ".obj"): result = [] for file in os.listdir(passedFolderName): if file.endswith(passedFileExtension): result.append(os.path.join(passedFolderName,file)) return result def rewriteOBJFiles(passedPath): lst_files = returnFilesLike(passedPath, ".obj") if len(lst_files): for i,file in enumerate(lst_files): # Scan each .OBJ looking for illegal material names. the_path = os.path.dirname(file) obj_name = os.path.basename(file) just_name = os.path.splitext(obj_name)[0] mtl_name = "%s.mtl" % just_name mtl_filename = os.path.join(the_path,mtl_name) if os.path.isfile(mtl_filename): # A companion .MTL file exists, let's read the .OBJ file. with open(file, 'r') as f: lines = f.read().splitlines() # Remove slash n character at the end of each line. f.close() # Let's scan the .OBJ for illegal material names. needs_repair = False new_prefix = "%s_" % just_name new_lines = [] for line in lines: ary = line.split(' ') if ary[0] == 'usemtl': if ary[1][0].isdigit(): # This material name violates Houdini naming condition. First letter can not be a number. # Add a prefix now. ary[1] = "%s%s" % (new_prefix, ary[1]) new_lines.append("%s %s" % (ary[0],ary[1])) needs_repair = True else: new_lines.append(line) if needs_repair: # This .OBJ needs re-written to correct bad material names. f = open(file, 'w') for line in new_lines: f.write("%s\n" % line) f.close() # Time to read .MTL file. with open(mtl_filename, 'r') as f: lines = f.read().splitlines() # Remove slash n character at the end of each line. f.close() # Let's scan the .MTL for illegal material names. new_lines = [] for line in lines: ary = line.split(' ') if ary[0] == 'newmtl': if ary[1][0].isdigit(): # This material name violates Houdini naming condition. First letter can not be a number. # Add a prefix now. ary[1] = "%s%s" % (new_prefix, ary[1]) new_lines.append("%s %s" % (ary[0],ary[1])) else: new_lines.append(line) # This .MTL needs re-written to correct bad material names. f = open(mtl_filename, 'w') for line in new_lines: f.write("%s\n" % line) f.close() else: print "No [.OBJ] files found at folder [%s]." % (passedFolderName) # NOTE: Remember to make a backup of your original .OBJ/.MTL files before you run this script. rewriteOBJFiles ("C:\Users\Admin\Documents\Models\Blendswap\cc0_14_building_set\obj")
  11. 1 point
    A particle sim is a totally fine way to solve this, but for something like brownian motion for particles in water, you could probably solve this procedurally by just adding some noise to your point positions. I'm attaching an example with both methods; in each case you're starting by converting a box into a volume, scattering a bunch of points into that volume, running your noise through the point positions (either by just adding in the procedural case, or by noise forces via a POP Wind DOP), then attaching a Sprite SOP to visualize the points. underwater_particles.hip
  12. 1 point
    depending on the number of vertices, the easiest method is most probably using setdetailattrib() like in f1's second example. however, for very dense meshes and if performance is important it's better to iterate over the vertices and resize the array in advance instead of appending in a loop. this way you avoid continuous bounds checking of the array. int num = detailintrinsic(@OpInput1, "primitivecount"); f[]@val_array; resize(@val_array, num); for(int i = 0; i < num; i++) @val_array[i] = vector(vertex(@OpInput1, "uv", i)).y; hth. petz
  13. 1 point
    You need to get an instance of hou.Geometry. Sometimes there is no easy way to track what set of calls you need to get hou.Something. You may try to construct it by calling hou.Something(). It may throw an "AttributeError: No constructor defined", which is, I think, will happen with most of hou classes. Even if you can construct hou.Geometry, you obviously need a specific geometry, not an empty one. Fortunately, any SopNode seems to have a Geometry. Here is Python Shell example: >>> node = hou.node('/obj/geo1/platonic1') >>> geo = node.geometry() >>> bb = geo.boundingBox() >>> bb <hou.BoundingBox [-0.92793, 0.92793, -0.975684, 0.975684, -0.789344, 0.789344]> >>> mv = bb.minvec() >>> mv <hou.Vector3 [-0.92793, -0.975684, -0.789344]> >>> tuple(mv) (-0.9279304146766663, -0.9756839275360107, -0.7893444299697876)
  14. 1 point
    I'll just leave this one here. Very easy and controllable way to add details to the simulation, that I wanted to try for such a long time. Cheers! DOP_particleVorticles_v08.hiplc
  15. 1 point
    sel = kwargs['pane'].selectGeometry(geometry_types=(hou.geometryType.Points,), allow_obj_sel=False) cur_node = sel.nodes()[0] items = sel.mergedSelectionString() add_node = cur_node.createOutputNode('add', 'points_to_poly') add_node.setParms({ 'prim0':items, 'closed0':True }) add_node.setDisplayFlag(True) add_node.setCurrent(True, True) Place this code to shelf tool and assign Scene Viewer hotkey. Hope this helps.
  16. 1 point
    Methods to Stir Up the Leading Velocity Pressure Front We need to disturb that leading velocity pressure front to start the swirls and eddies prior to the fireball. That and have a noisy interesting emitter. Interesting Emitters and Environments I don't think that a perfect sphere exploding in to a perfect vacuum with no wind or other disturbance exists, except in software. Some things to try are to pump in some wind like swirls in to the container to add some large forces to shape the sim later on as it rises. The source by default already has noise on it by design. This does help break down the effect but the Explosion and fireball presets have so much divergence that very quickly it turns in to a glowing smooth ball. But it doesn't hurt. It certainly does control the direction of the explosion. Directly Affecting the Pressure Front - Add Colliders with Particles One clever way is to surround the exploding object with colliders. Points set large enough to force the leading velocity field to wind through and cause the nice swirls. There are several clever ways to proceduralize this. The easiest way is with the Fluid Source SOP and manipulate the Edge Location and Out Feather Length and then scatter points in there then run the Collide With tool on the points. Using colliders to cut up the velocity over the first few frames can work quite well. This will try to kick the leading pressure velocity wave about and hopefully cause nice swirling and eddies as the explosion blows through the colliders. I've seen presentations where smoke dust walls flowing along the ground through invisible tube colliders just to encourage the swirling of the smoke. You can also advect points through the leading velocity field and use these as vorticles to swirl the velocity about. The one nice thing about using geometry to shape and control the look, as you increase the resolution of the sim, it has a tendency to keep it's look in tact, at least the bulk motion. As an aside, you could add the collision field to the resize container list (density and vel) to make sure the colliders are always there if it makes sense to do so. Colliders work well when you have vortex confinement enabled. You can use this but confinement has a tendency to shred the sim as it progresses. You can keyframe confinement and boost it over the first few frames to try and get some swirls and eddies to form. Pile On The Turbulence Another attempt to add a lot of character to that initial velocity front is to add heaping loads of turbulence to counter the effect of the disturbance field. You can add as many Gas Turbulence DOPs to the velocity shaping input of the Pyro Solver to do the job. Usually the built-in turbulence is set up to give you nice behaviour as the fireball progresses. Add another net new one and set it up to only affect the velocity for those first few frames. Manufacturing the turbulence in this case. In essence no different than using collision geometry except that it doesn't have the regulating effect that geometry has in controlling the look of the explosion, fireball or flames, or smoke. As with the shredding, turbulence has it's own visualization field so you can see where it is being applied. Again the problem is that you need a control field or the resize container will go to full size but if it works, great. Or use both colliders and turbulence pumped in for the first few frames and resize on the colliders. Up to you. But you could provide some initial geometry in /obj and resize on that object if you need to. Hope this helps...