3
$\begingroup$

I found this youtube clip which shows exactly what I'm trying to do. At about the 10 second mark of the linked video, he shows controls working as integers. That in a nutshell is what I want to do.


I'm trying to figure out how to use Geometry Nodes but I'm starting at a pretty low level of understanding. There is a project I want to develop that I've broken down into a bunch of simpler tasks that I need to learn how to do. This is one of them. I'm using Blender 2.93 beta.

I want to be able to translate and scale by specific increments. Attached is a screen capture showing my node tree and the modifiers tab. I've used the Math node "Snap" to set an increment of 1 unit for scaling. That actually does what I want, only adjusting the cube by 1 unit increments. Success!.... however, the X (Width), Y (Depth) and Z (Height) are connected to the Group Input to give me a control for each under Geometry Nodes in the Modifiers Tab but these controls don't conform to the 1 unit increment. Currently they increase by 0.001 units at a time not by 1. Is there a way of making those controls conform? enter image description here


Re: Chris's answer, This in some ways produce something which is another way of doing the same thing I already did with the snap function plus have added an offset which could be useful. This isn't what I was trying to resolve though. I've attached another pic. On it I've written the length of each of the sides, w=3, D=2 and H=1,but the controls on the right hand side say something different they say W= 3.37 etc These are the pre snapped sizes.

I want the controls on the right hand side (Width, Depth, Height) to say the actual size not the pre.snapped size. In other words the controls themselves should reflect the snap/rounding that is set inside the geometry node tree. Can this be done? enter image description here

$\endgroup$
0

1 Answer 1

4
$\begingroup$

Input sockets can be forced integers, but you have to use a workaround if you're going to plug them into nodes that use float values.

You can use any node that has an integer input type, for instance the Level input of the Subdivide node. Integers have dark green sockets. Plug a new input from the Group Input node into the Level socket.

enter image description here

Delete the Subdivide node. You can now plug the Level integer input into any socket. Blender will automatically convert to the target type if possible.

╔═══════════════════╦═══════════════════════════════╗
║ Integer - v     ║ Conversion                 ║
╠═══════════════════╬═══════════════════════════════╣
║ Float           ║ Rounded                    ║
║ Boolean         ║ False if v <= 0, else True ║
║ Vector          ║ v => (v, v, v)             ║
║ Color           ║ v => RGB(v, v, v)          ║
║ Geometry        ║ Unsupported                ║
║ String          ║ Unsupported                ║
║ Material        ║ Unsupported                ║
║ Texture         ║ Unsupported                ║
╚═══════════════════╩════════════════════════════════╝

enter image description here

To change the Min and Max values of the input, expand the N panel with shortcut N or by cliking on the arrow in the top right of the shader editor or click on View > Sidebar. There, click on the input and it will expand its properties.

enter image description here

$\endgroup$
6
  • $\begingroup$ wow...cool workaround!! Love it! $\endgroup$
    – Chris
    May 31, 2021 at 12:34
  • 1
    $\begingroup$ @Chris Developers are working on dynamic type switching in the node properties so it won't be needed for long I hope :) $\endgroup$
    – Gorgious
    May 31, 2021 at 12:35
  • $\begingroup$ i hope too... ;) $\endgroup$
    – Chris
    May 31, 2021 at 12:37
  • $\begingroup$ Not sure I get it just reading it but I'm about to go to work so I'll have a crack at it later today. Thanks very much Gorgious and I concur with the idea that the node properties is the place for a control switch. (I think you can already do that with Animation Nodes.) $\endgroup$
    – Burnart
    May 31, 2021 at 22:35
  • $\begingroup$ Yes it works great - I used the Triangulate Node to get the Level output from. My little test no longer needs the Snap Maths Node. Thanks again Gorgious the question is answered and solved. $\endgroup$
    – Burnart
    Jun 1, 2021 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.