zenustech / zenoblend

Zeno Blender Addon (WIP)
Mozilla Public License 2.0
37 stars 5 forks source link

Add LineViewer node #9

Closed hooyuser closed 3 years ago

hooyuser commented 3 years ago

LineViewer node is an output node designed for previewing the colored lines from zeno PrimitiveObject directly in Blender 3DViewport.

A similar way might be used for create some useful overlay in 3DViewport, such as bounding box, vdb hierarchy, sdf ray marching, etc.

archibate commented 3 years ago

I used to use numpy arrays in these cases for dense data, not sure how the difference in perf.

无法顺畅的大口呼吸,是活着的最好证明

---Original--- From: "Derived @.> Date: Mon, Sep 6, 2021 17:03 PM To: @.>; Cc: @.***>; Subject: Re: [zenustech/zenoblend] Add LineViewer node (#9)

@hooyuser commented on this pull request.

In zenoblend/main.cpp: > @@ -162,6 +166,46 @@ PYBIND11_MODULE(pylib_zenoblend, m) { return meshPtr; }); + py::bind_vector<std::vector<float>>(m, "FloatVec3");
This can treat std::vector as a PyObject which behaves like Python internal object list, without really converting it into a list. I guess this will get better performance when dealing with a large buffer. c.f. https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html#binding-stl-containers

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

hooyuser commented 3 years ago

Maybe I should seek for some profiler for performance tuning?For now, I doubt any operation involving copying buffer could be performance bottleneck and these ideas towards optimization are worth considering.

As for GPU optimization, we can offer an option to disable color vertex buffer. And since geometry shader is known for its performance issue, a fallback to simpler shaders without geometry shader may also help in the case of huge data to be drawn.

I guess this as well as other performance profiling task can be a long-term project. I'm working to implement VDBAnalyzer and VDBAdvect Node initially for SDF/LevelSet, LineViewer node is a useful tool for me to visualize the result of these VDB nodes. My initial implementation of LineViewer node may not be very good in performance.

archibate commented 3 years ago

maybe in future static/framed can be a boolean,property of node group, like the 'sverchok' ui you shown in our qq group.

无法顺畅的大口呼吸,是活着的最好证明

---Original--- From: "Derived @.> Date: Thu, Sep 9, 2021 19:38 PM To: @.>; Cc: @.**@.>; Subject: Re: [zenustech/zenoblend] Add LineViewer node (#9)

@hooyuser commented on this pull request.

In zenoblend/node_system.py: > @@ -303,6 +303,15 @@ def draw_buttons(self, context, layout): row.operator("node.zeno_apply", text="Apply") row.operator("node.zeno_stop", text="Stop") +class ZenoNode_LineViewer(def_node_class('LineViewer', [('PrimitiveObject', 'prim', ''), ('bool', 'display:', '1')], [], 'blender')): + '''Zeno specialized LineViewer node''' + + def update(self): # rewrite update function + if bpy.context.scene.zeno.executing: + bpy.ops.node.zeno_apply('EXEC_DEFAULT')
OK, I will check it. In fact, only static nodegroups have been tested so far. I will next test this node for framed/cached nodegroups.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

hooyuser commented 3 years ago

I totally agree. A Sverchok-like UI looks good for me. Btw, have you ever considered adding a TODO project for zenoblend?