# 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 :) Commented 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. Commented 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 :) .... Commented 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:

• 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. Commented Apr 13, 2022 at 20:11
• @ugorek The link is fixed, now. Thanks. Commented May 30 at 18:27
• What type of node are the "U" and "V" nodes in your screenshot? I haven't been able to figure that out from what's shown in the image. I did download your linked .blend file, but when I try to open it, Blender immediately crashes, so I can't see what those nodes are that way. Commented Jun 9 at 17:50
• Hi, @Lawton! It's a bit concerning that the file crashes for you.. I'm having no trouble with it.. that's got me looking for local dependencies, I've opened it on more than one machine.. The 'U' and 'V' labelled nodes are Map Range > Float. They take the -.0.5 to 0.5 range of X and Y Positions in the default 1m grid, and map it ot 0 to 2*pi. Nowadays, there's a Map Range > Vector, so you can do it in one. Commented Jun 10 at 6:08