Showing posts with label pieces. Show all posts
Showing posts with label pieces. Show all posts

Saturday 30 March 2019

constraints between two different objects refresh redux ultra

I've probably made a post about this before. Or I thought I did. .. anyway. I only make notes about things as I actually do them :) Repetition is the key to learning !

If you're trying to create constraints between two different objects, say a bunch of bricks and a big big of plaster wall you have to approach your primitive constraints generation a little differently than usual.
Normally you would put a Connect Adjacent Pieces node down and this would draw lines between your closest points. However if you were to merge the bricks and plaster together and do this, you still end up with lines being generated between brick bits and plaster bits..when all you actually want are the lines exclusively between brick & plaster. Whew.

To achieve this you have to hijack the name attribute of your brick and plaster geometry so that Houdini thinks there are only two names to connect between. Instead of having "brick01,brick02,brick03,plaster01,plaster02,plaster03" you will have "brick,plaster". that's it.
In a Point Wrangle(for packed geo) or a Primitive Wrangle(if you are working with unpacked geo) for each of your objects do something like this -

s@original_name=@name;
s@name="objectA";

where objectA might be "brick", object B might be "plaster". Now merge these two mono-named objects together , promote the name  attribute to point level (if it isn't already) and apply the Connect Adjacent Pieces node to them. Now you should only see lines being generated between the two seperate groups of objects. Brick to Plaster. Plaster to Brick.
Finally you must bring back your original name, so use an attribute rename node for this..


Plug your nice sparkly constraints into the rest of your network!


Wednesday 6 March 2019

point deform tricks

The point deform node is very useful to wrap deform high res geo with lower proxy geo.
To help it along in the case of overlapping objects, you can offset the objects.
Create a  point class attribute for both the high res and proxies.
Then move the pieces both high res and rest-position low-res using @P+=i@class
The deforming proxy geo will stay "as-is".

By seperating the geo in this way you can avoid "some" intersections...


Tuesday 16 May 2017

Getting data from strings

for example, once you've shattered something you end up with a lot of "pieces". Piece1, piece2, piece56000.
You might want to use the number as a seed value.
Usually the piece number is stored in the @name attribute.
In a wrangle, you can strip out the word piece, as follows... (and use atoi, to convert the string number to a number number)


s@testval=s@name;

@testval=strip(@name,"piece");
f@randval=rand(atoi(@testval));