Grasshopper gives a different UV for surface than Rhino

Hi all, working on discretizing surfaces in Rhino/Grasshopper, and I’m running into an annoying issue. When I use Grasshopper to evaluate a surface, the UV parameterization given by “EvalSrf” is different than what I see in Rhino–very frustrating since extrusion along the same vector for all surfaces is impossible.

Swapping UV using “Dir” in Rhino strangely does not change the UV in Grasshopper, but flipping the surface Rhino does flip the surface in Grasshopper.

Evaluating either the base surface or reparametrized gives the same result.

How do I evaluate a surface in Grasshopper to give the same UV as I see in Rhino?

blergh_gh.gh (9.7 KB)
blergh.3dm (185.9 KB)

Hello- it looks like in one case you are finding the middle of the domains and in the other you are explicitly setting to 0.5. The domain in the latter case is not normalized, so .5 will not be the middle.

-Pascal

Hey Pascal, thanks for the reply. The domains aren’t the issue, sorry if having the two methods is creating more confusion.

The issue is that in Rhino, the surfaces have UV’s that look like this:

the V-directions of both surfaces are coming from the shared diagonal edge, the U-directions are parallel to the ridge, and the normals are both “up”.

But in Grasshopper, EvalSrf is giving the surface UV vectors that look like this regardless of where the surface is evaluated, or if it’s been reparametrized:

the U and V of the bright red surface is swapped, and both surfaces shared the same normal. Annoyingly, swapping the UV of the bright red surface using “Dir” in Rhino changes the UV grid in Rhino but doesn’t change the UV grid in Grasshopper.

It looks like the Frame output of EvalSrf outputs a plane where Z is aligned with the normal of the surface.

As far as I can tell Planes (in Grasshopper) are right handed (?) / setup for a right handed coordinate system, where X axis is to the right, Y upwards and Z towards you.

For surfaces the normal can be point inwards or outwards without changes to the U or V direction. This would be equal to switching between a right and left handed coordinate system.
Hope that makes sens.

Regarding your file, you can use the point, U and V output of the EvalSrf to create a plane aligned with the UV directions of the surface:

Ah, this is what I was missing. Solved.

Hey @Bernd,

The UV is preserved, but the normals are different. One surface faces up and one faces down which is annoying. Any idea how to change it so both normals are pointing the same direction?

Looking at the file from the first post, the normals are facing in a similar direction:

Hi Bernd,

Thank you for the reply. Here’s an updated script describing the situation:

blergh_r2_gh.gh (20.2 KB)

From what I see, the planes constructed with the UV directions have different normal directions (purple group). This is likely because Grasshopper only creates right-handed planes.

So, I think the next thing to try is to pick either the surface or the flipped surface by comparing their normal to world-z (green group). This still gives the same result…? (pink group).

So now I think my question is how do I get something like a left-handed plane in grasshopper?

My goal is to place a solar panel block on this surface, so the panels all need to face the same way.

You can use the cross product between the normal and either the surface U or V direction, then use those to create a plane that has the normal pointing in the right direction and aligned with the surface:
image

Another way would be to compare the normal of the plane (from UV directions) and surface, then flip if they are pointing in different directions (using e.g. dot product).

You can also use the flip plane component from Pufferfish and a plane from Normal:
image