13

This question asked how to plot the graph of 2D parametric equations using Geometry Nodes. But how about parametric surfaces generated by parametric equations of the form

$$ x = f(u, v)$$ $$ y = g(u, v)$$ $$ z = h(u, v)$$ $$ a \le u \le b$$ $$ c \le v \le d$$

like this parametric "figure 8" immersion Klein Bottle:

parametric Klein Bottle

I know there are other methods for doing this. For example, I can use the XYZ Math Surface option, this time using both $u$ and $v$ rather than just $u$ for a curve:

parametric equations for the figure 8 immersion Klein bottle.

But how do I do this with geometry nodes?

NOTE: this is not a question about surfaces where z is a direct function of x and y (those represented by $z = f(x,y)$) but about equations were $x$, $y$, and $z$ are all calculated as functions of two other variables, $u$ and $v$. The difficulty arises from the fact that you can't solve these using an (x, y) grid.

Marty Fouts
  • 33,070
  • 10
  • 35
  • 79
  • 1
    For diplomacy's sake, if you agree with me about the equivalence of @LuckyOne 's answer, and my later one, and they do answer your question satisfactorily, I would be very happy if you ticked his, not mine :) – Robin Betts Apr 13 '22 at 18:18
  • 1
    @RobinBetts Your wish is my command. I've upvoted both answers, but I'll wait for a day or two to see if anyone comes up with a solution that doesn't have the normals problem; but if a better answer doesn't show I'll except LuckyOne's. – Marty Fouts Apr 13 '22 at 19:06
  • 1
    I'll try to figure out the normals thing.... but atm I can't think of a fix. Maybe if I do a bit of washing-up or ironing :) .... – Robin Betts Apr 13 '22 at 19:19

2 Answers2

13

Will this way do? It's actually the same as @LuckyOne's, and the 2D answer you refer to. Instead of starting with a curve, start with a 'UV' grid, at the desired resolutions. Map the dimensions of the grid to the desired ranges of U and V.

Use the U(X) and V(Y) Positions of the grid's points as the inputs to your expressions for X', Y' and Z'. This is a lazy reproduction of your XYZ surface, imitating your helper functions:

enter image description here

(Excuse the spaghetti.) )In this case, I couldn't figure out how to take the twist out of the normals,though, without applying the modifier and Alt N recalculating:

enter image description here

Here's the .blend

Robin Betts
  • 76,260
  • 8
  • 77
  • 190
  • 2
    Don't put too much effort into figuring out the twist. I think it's an artifact of the object being a Klein bottle. XYZ Surface leaves the same twist in the same place. – Marty Fouts Apr 13 '22 at 20:11
10

Because your formula was too complicated for me...i just took another formula (but the principle is the same)

so here is an example:

enter image description here

I took the example from math surface -> cosinus

formula:

enter image description here

LuckyOne
  • 721
  • 2
  • 11