Geometry Nodes: adjust a parameter by camera distance

Hello,

I’m trying to find a simple way to dynamically change subdivision levels in a GN tree, based on the distance of the object from the camera. But for some reason it doesn’t seem to work as I imagined.

In this example, I’m using two geometries outside the GN tree to test it faster. I will keep a null object to tell the center of the object that is being affected (now called ‘wreath center location’) but I will remove the camera placeholder and plug the actual camera there later. The Map Range allows me to put in thresholds for the max distance from where I keep the subdivision at 0, and to set the max subdivision for a closeup. But yey, it doesn’t work. I also tried swapping the Target and Source Position drivers, but that didn’t change anything.

Any tips will be super welcome. Thank you!

This setup works fine for me. Is it possible that you have the original geometry “weath leaf” still visible in your viewport so that it is covering the instance created by geometry nodes?
Try hiding wreath leaf.

Good idea. I checked it and the original instance is indeed hidden. I tested swapping the subdiv node with transform node and plugging the map range into scale, but when I move the camera placeholder, the scale stays at the ‘to min’ value (so it means the Distance output is giving 0). But hearing that it works for you pushes me to at least stay about this approach. Plan B would be with raytracing I guess.

Here is my file, if you want to take a look at it:
AutosSubdiv.blend (989.0 KB)

Ok, I found the issue. I was using a null as the center location and it needs to be a mesh.

I hope this will come handy to future travellers!

Ah, yes. The geometry Proximity requires geometry to work.

If you want to use an empty you could use a vector math node set to distance instead of the geometry proximity node.
It is probably better performancewise, too to use a vector math node.

1 Like

Ah true! I completely forgot it already has a distance calculation… Perfect!

1 Like