Occlusion

florisdejonge's Avatar

florisdejonge

13 Jun, 2021 06:59 AM

While working on my landscape generator I was looking for a way to suggest depth. Since to plot such designs one would have to remove hidden lines when certain shapes would occlude other ones. In addition, I’d already seen Seo Hyo’s recent posts with rows of shapes that occlude each other. This effect can be reached by just adding a fill, but the plotter doesn’t bother with fills. So I made an occlusion-node, based on Johns mask-node. It’s slow, and it’s fiddly to get the settings right, but it works quite well.

Floris

  1. Support Staff 1 Posted by john on 13 Jun, 2021 08:13 AM

    john's Avatar

    Floris,

    This is a great idea for a node!

    One problem. The file will not open because it needs a copy of my now deprecated make_curve node. The node calling this was buried inside your Network1 node; even though that node is not rendered it still prevents the file from opening.

    I fixed this by removing the dependency and replacing the offending node inside your Network1 node. Now the file is exactly as you posted it, but will open and no longer requires any external code libraries.

    Openable version attached.

    I think this node could be cleaned up and simplified a bit. Do you mind if I try? I think this is a very useful node.

    John

  2. Support Staff 2 Posted by john on 13 Jun, 2021 12:21 PM

    john's Avatar

    Floris,

    I was so excited by your node that I went ahead and made a simplified version. Actually, I made two nodes.

    Occlude_path takes just two inputs: the shape list and minimum length (for mask sensitivity). No need to hook all those extra lists or fiddle with size of range or number of shapes. It uses all the shapes for masking instead of trying to guess which shapes are within range of occlusion, so should work with any arrangement. It is roughly the same speed as your node.

    The one caveat is that the shapes have to be in order from back to front - the same assumption you made. This can normally be done by simply building the list in the right order of sorting it by Y position.

    Occlude_path only works with paths. For geometries, use occlude_geo instead. Works exactly the same, but runs a little slower. Occlude_geo works for any shape, path or geometry. But if your shapes are simple paths, you can shave a few seconds by using occlude_path instead.

    The total render time for all four clusters was slightly faster using my simplified nodes: 42 seconds instead of 48. I wish we could make a faster mask node. I fear that if you had to occlude a thousand shapes it would be too slow to use.

    Please give this a try and see if it works for you.

    Thanks!

    John

  3. 3 Posted by florisdejonge on 13 Jun, 2021 03:22 PM

    florisdejonge's Avatar

    Hi John,

    Thanks for replying and for further developing this concept! I don’t mind you trying to simplify and improve this node at all. In my opinion it’s one of the main reasons for sharing ideas on the forum.

    I indeed assumed I had replaced all the old mask-nodes (from the 2.2 library) for the one in the new (2.3) library. Apparently, I forgot one. Might I suggest you add the version number in the comment of the node in the library? That way it’s easy to track whether a network is in need of updating.

    This new version of the occlusion-node is, as you said, faster and cleaner. It also works with the houses and tress I made earlier. Which means there’s another tool to use. So, that’s great! When applied with scattered points, I indeed sorted them by the Y axis.

    I mentioned some trouble I encountered with the mask node, but I haven’t been able to replicate the problem in a controlled way to be able to explain it.

    Floris

  4. Support Staff 4 Posted by john on 13 Jun, 2021 11:19 PM

    john's Avatar

    Floris,

    Good. Glad it's working. I spent a little more time trying to speed it up but was not successful. I guess we'll have to live with the slow performance for now.

    Your suggestion about adding version numbers to revised nodes is a good one. I will try to do that from now on.

    John

  5. Support Staff 5 Posted by john on 11 Jan, 2023 10:32 AM

    john's Avatar

    UPDATE

    I have just released an improved node, occlude, that replaces both of the above node and runs significantly faster:

    http://support.nodebox.net/discussions/show-your-work/538-occlude-node

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • occlusion_24052021.ndbx.zip 88.2 KB
  • Schermafbeelding_2021-06-13_om_08.54.51.png 273 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

06 Feb, 2025 01:37 AM
04 Feb, 2025 06:32 AM
04 Feb, 2025 05:04 AM
30 Jan, 2025 09:31 AM
30 Jan, 2025 09:08 AM

 

30 Jan, 2025 08:40 AM
24 Jan, 2025 07:50 AM
22 Jan, 2025 11:42 PM
21 Jan, 2025 09:43 AM
21 Jan, 2025 09:41 AM
21 Jan, 2025 09:36 AM