Is a Field (from GN) really a function?

From how I understand it after watching and reading a few explanations, Field is not a function even though it’s said to be, I think it’s more likely to be a set of data such that each element in that set is a unique value that is assigned to each corresponding vertex / point.

It’s like a Value Map. Shader Nodes’s Vector Displacement uses that kind of Value Map too, but it doesn’t have a name “Fields”.

I don’t understand how it’s called a function. It’s not a “function” in Mathematical sense.
What exactly is this kind of “function”, though? A “function” in what sense?

Is Field a concept made and defined specifically for Blender?

For me, it’s simple like this,
Circle sockets means that all points / vertices of an object work with one common singular value.
Diamond sockets (Fields) means that a set of different values is applied, such that, each point / vertex of an object is assigned to a unique value.

What do you think? Thank you!

I think of it as a function that takes a geometry context and returns a value per element of that geometry context. To understand why it’s not appropriate to consider it as data, consider this simple example:

The position field is rotated and plugged to to different geometry contexts. If Fields were just data, then the same values would be fed to both geometries. Instead, each field evaluates on each geometry giving completely different values

4 Likes

Any set of ordered data is a mathematical function. f(x) in the range of all integers between 0 and 1 inclusively such that f(0) = 1 and f(1) = 11 is a well described mathematical function. It’s not as pretty as a lot of other functions, but it’s still a function.

But I don’t think people are talking about functions in the mathematical sense, more in the programming sense. Although of course the two are related.

We could consider position to be an array, but we could also consider it to be a method. We could define an array of positions, or we could have an object (geometry) that had a method .getPos(index). Pre-fields, it was more like the first method: you made a list of positions; if your geometry changed, that list didn’t change, and might not be valid for some future comparison. Post-fields, it’s more like the second. Some operation might see a position input and a geometry input and call geometry.getPos().

This percolates backwards in the field system. So set position might be doing something like self= geometry; self.setPos(self.getPos()+vectorMath(scale, self.getNormal(), 2.0)).

You still have the classic “list of data” approach available by capture attribute nodes.

Blender’s geometry node system is not unique. Various approaches have been implemented in other applications. Calling Blender’s approach “fields” or “functions” is probably just a continuation of how those other applications worded things.

In the end, it doesn’t matter how you think about it, so long as your thinking doesn’t lead you to any incorrect conclusions. I do not think of fields as functions while I’m making a GN tree. I’m not sure exactly how I think of them, but not like that. If you find some way of thinking about things that works for you, that’s great, that’s the most you can hope for.

1 Like

Thank you!

A Mathematical function is an operation which assigns each element of set one set to exactly one element of another set, isn’t it?
So a set of something can’t be a Mathematical function, it’s just a set, it doesn’t have an operation, it doesn’t assign anything to anything. A set’s only job is to contain values / elements.

Agreed, f(x) = f(0) = x+1 = 0+1 = 1 is a function. It has an operation, it assigns element 0 (from set Domain) to element 1 (from set Range).
But the set Domain which consists of “all integers between 0 and 1” is not a function, it’s just a set, and a set is not a function.

I know nothing about Programming, but yeah, a definition of Programming’s function that I found is:
“a function is a reusable piece of code, that can be used to repeatedly carry out certain calculations or processes”
, which sounds pretty close to Mathematical function.

If we both agree that Field is like a Value Map (a set), then it could fit Programming’s definition of a function (I know nothing about Programming though), but it definitely doesn’t fit Mathematical definition of a function.

Interesting.

Makes sense.

Great point, but I need to ask around to see if how I’ve been thinking about it was correct or not.

The original design may shed some insights here as well

do note that this is from 2021 so details may have shifted a bit in the years since then but the overall idea should still hold up.

2 Likes

Thank you!

OHHHHH this makes sense, it’s interesting to think of it this way.
A Mathematical function is an operation which assigns each element of set one set to exactly one element of another set
, and a Field seems to have satisfied that definition, it does input something (Geometry / Mesh), process it, and then output something (a value per element, or a Value Map).

But the data that is transferred from Position Node to Set Position Node is a set of values (i.e. a Value Map), isn’t it?
That Position Node alone is a function, from how I understand it, but the Value Map that it outputs to Set Position Node is a set.

A set is not necessarily a mathematical function, but an ordered set is. And all of the sets we’re dealing with in GN are ordered sets.

We don’t just have a massive cloud of vertex positions. That’d be useless. They are ordered. We store our positions as a function of index, f(x)=position(index).

1 Like

Thank you.

Ah got it, I think I don’t know what an Ordered Set is, may I ask what is it?
Is this the Odered Set that you were referring to? Looks like it’s an advanced concept in Real Analysis.

The type of Set that I know, which has its elements in order, is a Sequence.

An ordered set is a set, in a particular order.

I’m not using some formal language. Consider what I originally wrote:

1 Like