4
$\begingroup$

I am new to Blender.

Suppose I have a Bottom Mesh that is 10 metres deep (X) and 10 metres wide (Y), and a Top Mesh that is 5 metres deep and 5 metres wide. Each is created with a Cube Mesh Node.

I want the maximum value of each coordinate in the Top Mesh to be tied to the corresponding size of the Bottom Mesh. For example, if the Bottom Mesh is 10 metres deep, the Top Mesh should never be able to exceed 10 metres in depth. I could manually set the maximum to 10, but that would not be dynamic. If I later change the depth of the Bottom Mesh, the maximum value in the field would still stay at 10. I could also define it as a percentage of the Bottom Mesh, such as the Top Mesh always being 50 per cent of the Bottom Mesh, but that is not ideal, since I might want it to stay exactly 2 metres smaller than the Bottom Mesh, and absolute values are usually easier to work with.

How can I achieve this?

@EDIT: I don't mean it matematically. But how to actually do it in Blender.

New contributor
Hugo Almeida is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
4
  • 1
    $\begingroup$ The standard way to relate two objects would be to use drivers, I don't think property limits can be driven, as far as I know not even even dynamic. Only way I can think of, is to use math nodes to limit values to some threshold using Min and Max nodes, but you won't get visual feedback in the UI. $\endgroup$ Commented yesterday
  • 1
    $\begingroup$ Yes, unfortunately GN while turing-complete, is very limited in interface. A Python solution could do that. $\endgroup$ Commented yesterday
  • $\begingroup$ Thank you both! $\endgroup$ Commented yesterday
  • $\begingroup$ How could I do it in Python? (not the coding, but where can I learn and apply this in Blender) @MarkusvonBroady $\endgroup$ Commented yesterday

2 Answers 2

4
$\begingroup$

You would do some math on the size parameters before they go into the mesh creating node. Here's a simple setup where we control only the Z parameter of a Cube, employing a Utilities > Math > Math > Minimum node to clamp it to the maximum of two values we give it:

enter image description here Speaking of clamping, you could also use a Utilities > Math > Clamp node instead of Minimum

Specific configuration would depend on what exactly you want the relationship to be, but the main principle is to do your math before using the result as the size parameter. You could add other Math nodes to do further calculations. More granular control (like controlling only the Z here) usually means more and more nodes to separate things first. Here's a simpler setup where you clamp all three dimensions of the smaller cube by the bigger one, which requires a single Utilities > Vector > Vector Math > Minimum node:

enter image description here You can use Utilities > Vector > Combine XYZ and Separate XYZ nodes to... well, combine and separate vectors as needed to manipulate them mathematically

$\endgroup$
2
  • $\begingroup$ Thank you! This works! However, this solution doesn't appear to limit the max amount in the field itself, just the actual size of the mesh. For example, is Big Cube is 10, Small Cube can still have a value of a 100, but the mesh itself won't go past 10. Is there a way to also limit the Max amount in the text field? $\endgroup$ Commented yesterday
  • $\begingroup$ @HugoAlmeida Hmm, that's a really interesting but niche-sounding requirement. Nothing immediate comes to mind. Do you mind explaining what you're trying to achieve with a limitation like that? I can think of a small trick to clamp the slider number like you're imagining but not dynamically, you would need to enter the max value yourself. $\endgroup$ Commented 23 hours ago
2
$\begingroup$

I know this is probably not what satisfies you and it is more of a joke answer - You can alter the relation of a gizmo and a field connected to it using "Math: Add" and "Math: Multiply" nodes. This allows to produce weird behaviors when the (2nd) addend or multiplicand are dynamically related to the same value used as (1st) augend or multiplier (the one with double-link). However it's very limited and you can't e.g. clamp possible range... Except input field can be clamped and you can dynamically scale the gizmo relation:

Imgur mirror (SE image hosting has problems)

Imgur mirror

The highlighted "Value" node holds a very specific value you can copy-paste into your setup:

340282346638528859811704183484516925440

It displays as Inf because Blender input fields have smaller range and precision than float32 used in memory. You could of course avoid set the MIN and MAX input field values to e.g. $-1$ and $+1$ and use 1 as the Value instead.

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.