Separate a mesh to groups by continous parts (elements):
Use the Connectivity SOP node to assign each mesh primitive an integer attribute based on the continuous mesh element in belongs to. This attribute can be named “element” or “part” for example.
Use the GameDev Group by Attribute* node to assign each mesh primitive to a different group according to its “part” attribute (if you named it “part” that is..). Set a group name prefix, like “part_” or “element_”. the node will generate numbered groups per each mesh part like so: “element_0”, “element_1”, “element_1″….
Use this group separation as a filter to create whatever part-selective effect you need.
Note: The linked tutorial details additional ways to set this up. Honestly.. I don’t remember why I ended up using this specific method. If you think this method has disadvantages compared to other, I’ll be very grateful if you comment on this.
Took me some time to figure out how to set the points color (“Cd”) attribute with data stored initially in custom points attributes. I kept trying to use the Color SOP node with a “point()” function in its R, G, B fields attempting to refer to the wanted attributes but it didn’t work for me, I also tried various loop setups iterating the geometry points, couldn’t get that to work either.. * I’m new to Houdini so the fact these approaches didn’t work for me doesn’t mean they can’t be used for this..
I finally managed to do this using a Point Wrangle node with the following VEX expression that sets the Cd (color) attribute’s vector components by referring to the 3 custom attributes “att_a”, “att_b” and “att_c” (see image below):
@Cd = set(@att_a,@att_b,@att_c);
What the Point Wrangler node does that I couldn’t achieve by writing expressions into the RGB fields of the Color node or by using loops is that it iterates all its input SOP’s points, and within its expression the attribute name i.e. “att_a” etc. automatically refers to that named attribute in the same point that is now being iterated over.
Note: The reason I need such a workflow in the first place is to generate geometric property masks for a Houdini asset, that will be available for the target shading system via vertex color input. * The Houdini point color attribute propagates to vertex color on output.
After setting the point color, I added an Attribute Delete SOP node to delete the no more necessary custom attributes:
This post covers the most basic steps needed for rendering with V-Ray Next for Houdini.
Note on software versions: At the moment of writing this post V-Ray for Houdini supports Houdini version 18.0.460. I naively thought it would work with a later version of Houdini, I tried to install it on Houdini 18.0.499 thinking to myself “what can a couple of extra numbers do..” but I was wrong, It crushed. so at the moment it has to be Houdini 18.0.460, so when getting started with this, take a moment to see exactly what Houdini build is the installation of V-ray built for and install that specific version of Houdini. * It’s easy, the V-Ray Installation package’s name states the version: “vray_adv_43003_houdini18.0.460.exe” Full installation instructions on the V-Ray for Houdini documentation: https://docs.chaosgroup.com/display/VRAYHOUDINI/Setup+and+Installation
Adding the V-Ray tool shelve to the Houdini UI: Click the “+” button at the right of the available shelves, and from the list, select V-Ray. * This only has to be done once.
Scene preparation note: Surface objects have to be of type Polygon, Polygon Mesh or Polygon Soup for V-Ray rendering:
Setting up V-Ray rendering: There are 3 ways to setup V-Ray as a render output option for your scene:
In the out network, add a V-Ray > V-Ray Renderer node.
In the main menu, Select Render > Create Render Node > V-Ray.
In the V-Ray shelf, click the Show VFB button. This will open the V-Ray VFB (render window), and create both V-Ray Renderer and V-Ray IPR nodes in the out network.
* A V-Ray IPR node is needed for interactive rendering both in the Houdini view-port Region Render and in the V-Ray VFB.
Creating a camera: You guessed it.. 3 ways to create a camera:
Open the camera drop-down menu found at the top right of the view-port, and select New Camera. A new Camera node will be created and the view-port will be set to display the new camera view.
In the Lights and Cameras shelf. press the Camera button, and click inside the 3D view-port to create a new Camera node.
Create a Camera node directly in the obj network by right clicking and selecting Render > Camera.
Note that the rendered image resolution is set in the Camera node’s View properties:
Adding V-Ray Physical Camera properties to the Camera: With the Camera node selected, press the Physical Camera button in the V-Ray shelf. This will add a new V-Ray tab to the Camera node’s properties, containing V-Ray Physical Camera properties. Note, that the Physical Camera exposure settings are setup by default for physical sunlight illumination levels (EV 14), so in many cases, after adding the Physical Camera properties, unless these settings are tuned, your scene will render darker.
Adding light sources: To add light sources, In the V-Ray shelf, press the wanted light source button, click the 3D view-port to create the light node, transform it to the wanted location/orientation, and set it’s settings:
* If no light sources are added, The image will be rendered using default lighting.
Setting up V-Ray materials: In the mat network, right click and select V-Ray > Material > V-Ray Material to create a V-Ray Material node:
Select the V-Ray Material node, name it, and set it’s material settings:
In the obj network, double-click the wanted geometry object to enter its SOP network, and inside its SOP. create a new Material node:
Connect the sphere primitive SOP node’s output to the new Material node’s input, make sure it is displayed by clicking the right most node button so it’s highlighted in blue.
In the Material node’s properties, open the Floating Operator Chooser next to the Material property, to select a material for the surface, and in the hierarchical display, expend the mat network, and select the wanted V-Ray Material:
Now that a material has been set and the Material node is displayed, the objects is rendered with the selected material:
Rendering an image: There are 3 ways to render an image:
In the main menu, select Render > Render > vray
In the out network, click the V-Ray renderer node’s Render button (on its right), to open the Render dialog, and in the dialog press Render.
In the V-Ray shelf, press the Show VFB button to open the FVB (V-Ray’s render window), and there, press the Teapot button at the top right to render the image.