# How do I create a 3D parametric surface using Geometry nodes?

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:

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:

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.

• 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 :) Apr 13, 2022 at 18:18
• @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. Apr 13, 2022 at 19:06
• 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 :) .... Apr 13, 2022 at 19:19

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

so here is an example:

I took the example from math surface -> cosinus

formula:

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:

(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:

Here's the .blend

• 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. Apr 13, 2022 at 20:11