Orient objects tangential to another surface

   4326   3   1
User Avatar
Member
350 posts
Joined: June 2016
Offline
Hi,
Using a scatter and new copytopoints SOP to try and wrap tiles or shingles around a sphere.

The issue is that the tiles all have the same orientation. (see attached) They need to wrap the surface.

I've tried adding a new points SOP with Class = points and Attribute = Normal with the VEXpression
 self + value

and can change the direction of the tiles but only globally.

Can anyone have a look at the attached .hip and tell me what I am missing?
Edited by art3mis - June 22, 2017 12:08:56

Attachments:
tiles_wrap_sphere.hiplc (206.5 KB)
attribut_wrangle_Normal.jpg (405.0 KB)

User Avatar
Staff
6219 posts
Joined: July 2005
Offline
After the scatter you don't have normals on those points.

Using the attribute expression will try to create normals for the points. But geometry in Houdini has no history. The points don't know they came from a sphere, so think they are just free floating points and get 0 normals. So “self” is 0, and you are just setting all the normals to a constant value. Thus the global behaviour.

For non-primitive sphere geometry, you could add normals before the scatter. The scatter should then properly copy over these normals onto the points and copystamp would work.

For a primitive sphere it is a bit trickier as it only has a single point. So you have to build the normals after the scatter. For a zero-centered sphere, however, it is rather easy as the normal is the position. So in your Attribute Expression just put @P

You may want the grid to be an XY grid, however, as the Z axis is oriented to the normal. Then add an up attribute to change how the grid is rotated around the normal.
User Avatar
Member
350 posts
Joined: June 2016
Offline
Thanks. Detailed response very much appreciated! And it actually works!
Just 2 questions

1- What would I use instead of @P if my sphere is not centered at origin?
2- Where, how would I add a ‘up’ attribute? I tried using an AttributeCreate SOP below the tile(grid) SOP with a custom variable simply named ‘up’.
Edited by art3mis - June 22, 2017 19:04:36
User Avatar
Member
1743 posts
Joined: May 2006
Offline
1. It's generally why folk build things at the origin, and transform stuff to where it needs to be as a last step.

You could construct it after the fact; on the sphere store @P as another attribute, like with a rest sop or in a then when you construct the normal in a wrangle, subtract that rest position:

@N = @P - @rest;

2. Attrib create you'd need to build before the copy sop. An attrib create would do it, but you can do it in the same wrangle that you build @N:

@up = {0,1,0};
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
  • Quick Links