sverchok icon indicating copy to clipboard operation
sverchok copied to clipboard

VD Experimental - current known issues

Open zeffii opened this issue 5 years ago • 34 comments

you need to use recent version of Blender 2.8+

  • [x] does not show dashed lines + custom fragment shader
    • disable dashed line if you need the custom fragment shader.. for now )
  • [x] handle concave quads using a boolean, handle_concave_quads = True
  • [x] does not automatically use polygon offset yet.
    • until we can ensure that we restore opengl state when sverchok is finished drawing
  • [ ] mac openGL implementation does not support glLineWidth > 1.0
  • [ ] smooth shading mode will choke if you pass it a mesh with a polygon using multiple identical vertices.
    • this is unfortunately an error that originates in bmesh_from_pydata
  File "C:\Users\zeffi\Desktop\scripts\addons_contrib\sverchok\utils\sv_bmesh_utils.py", line 39, in bmesh_from_pydata
    add_face(tuple(bm.verts[i] for i in face))
ValueError: faces.new(...): found the same (BMVert) used multiple times

circumnavigation might be costly on big meshes. I think it's safer to assume all meshes are devoid of this problem and offer a doubles removal if errors are encountered.

  • [ ] (maybe) handling attrs fucntion (at top of process function) should handle the 'self.activate' parameter first, and only if this parameter is not passed .. or is set to self.activate=True, then proceed to set the other params.

zeffii avatar Oct 13 '19 08:10 zeffii

Looks like non convex polygons does not supported yet

2019-10-19_23-00-16

Durman avatar Oct 19 '19 19:10 Durman

Were they supported in 2.79?...

portnov avatar Oct 19 '19 19:10 portnov

There was option on N panel for viewer node.

Durman avatar Oct 19 '19 19:10 Durman

ah.... if the concave is a Quad, it should be tessellated, instead of my assumption [[a, b, c], [a, c, d]]

zeffii avatar Oct 19 '19 19:10 zeffii

see..

https://github.com/nortikin/sverchok/blob/5cdd2a8fd35127c8066f038181dd56ff71c07121/nodes/viz/vd_draw_experimental.py#L67-L86

zeffii avatar Oct 19 '19 19:10 zeffii

i'll add a property, so


   elif num_verts == 4 and not self.convex_quads:
         ...

let me consider this over night :)

zeffii avatar Oct 19 '19 19:10 zeffii

For convex polygons it is possible to use such triangulation: https://en.wikipedia.org/wiki/Fan_triangulation

if is_convex([coords[idx] for idx in idxset]):
    new_faces = []
    for i in range(2, len(idxset)):
        new_faces.append((idxset[0], idxset[i - 1], idxset[i]))

Also there is another interesting type of polygons: https://en.wikipedia.org/wiki/Star-shaped_polygon

Durman avatar Oct 20 '19 05:10 Durman

@Durman in b28 openGL using "Core Profile", we must turn everything into Triangles. The reason i "hand" tessellate the Quad is to keep the processing time of the Quad down to a minimum. Most quads we encounter are convex, and can be done this way a b c d -> a b c, a c d . It therefore doesn't make sense to always call a dedicated tessellate function on each Quad, this would penalize most polygons most of the time.

The concave quad is a special case, and testing for it first would also slow us down, so the solution will be like in VDMK2 to have a flag to say " OK, we must call the tessellate_polygon function on all non Tri faces, because we are expecting mixed input:

  1. Concave Quads, and
  2. Irregular Ngons

that's why a test like

 elif num_verts == 4 and not self.convex_quads:
         ...

will result in the least speed damage to the "ensure triangles" function.

zeffii avatar Oct 20 '19 07:10 zeffii

As i know is_convex takes O(n) time. So it should not slow down process too much. And there is benefit of using such test as triangulation of convex polygons for O(n) time. I actually don't know how implemented the mathutils function. Perhaps it makes such test inside itself. I think only speed tests can lit light on this issue.

Durman avatar Oct 20 '19 08:10 Durman

i've committed the fix needed, for sake of speed vd_experimental will assume quads can be "serialized the dumb way", unless users switches on handle_concave_quads in the properties panel.

zeffii avatar Oct 20 '19 09:10 zeffii

This raises cascade of errors. Weirdly.))

2019-10-30_12-50-16

Durman avatar Oct 30 '19 08:10 Durman

we can add a test like


def is_input_vertex_kind(socket_data):
    return len(socket_data) and len(socket_data[0][0]) == 3

zeffii avatar Oct 30 '19 10:10 zeffii

It would be nice if the node will become red.

Durman avatar Oct 30 '19 10:10 Durman

OK. that's probably reasonable.

zeffii avatar Oct 30 '19 10:10 zeffii

Well it have taken some time for figuring out what is going wrong.

Durman avatar Oct 30 '19 10:10 Durman

See also data_structure.get_data_nesting_level, data_structure.ensure_nesting_level.

portnov avatar Oct 30 '19 10:10 portnov

See also implicit_conversions parameter of sv_get() method.

portnov avatar Oct 30 '19 11:10 portnov

there's a potential to add debugprint using bgl/blf directly beside the node that fails. Like sverchok redux did (i can't find a screenshot of it):

zeffii avatar Oct 30 '19 11:10 zeffii

screenshot of sverchok redux node error handling

i am very tempted to implement this now.

zeffii avatar Oct 30 '19 14:10 zeffii

I don't think it's good idea to write the whole stack trace in the viewport; maybe only the error message?

portnov avatar Oct 30 '19 14:10 portnov

The same thought. Probably it would be better to make a reference to console or log file in Blender for more details.

Durman avatar Oct 30 '19 14:10 Durman

yeah, a more simplified traceback. it's worth trying

zeffii avatar Oct 30 '19 15:10 zeffii

@zeffii Here’s an idea for fixing the linewidth > 1px issue on mac. A fix for the annotations (on mac) is presumably coming up in 2.82 (hopefully). I don’t know if this annotation issue is related to viewer draw line/edge width issue in SV, but it’s worth checking it out.

https://developer.blender.org/T57570 https://developer.blender.org/rB014eb69cf858036816d12a4b92ffe6681978b683

DolphinDream avatar Dec 15 '19 17:12 DolphinDream

yes, the solution would need to be a vertex_shader / fragment_shader combo. (that's what the pull-request is ), i can experiment with it, it looks a little like the code I was experimenting with a while back.

we can make it the default behaviour for sverchok on osx, and optional for the other OS's (it might even look better because of the AA ).

No ETA on that.

zeffii avatar Dec 15 '19 17:12 zeffii

i don't think i'll add https://developer.blender.org/F8403764

zeffii avatar Mar 13 '20 15:03 zeffii

but here's a start branch , for exactly that.. https://github.com/nortikin/sverchok/pull/2965

zeffii avatar Mar 13 '20 16:03 zeffii

@DolphinDream .. it seems they removed: https://developer.blender.org/F8403764 (above link)m which is what I was basing it off.

zeffii avatar Apr 01 '20 20:04 zeffii

this beast: https://developer.blender.org/rB014eb69cf858036816d12a4b92ffe6681978b683

zeffii avatar Apr 01 '20 20:04 zeffii

I wonder if geometry shaders would be the way to go.. if Blender 2.8x supports them.

https://blog.tammearu.eu/posts/gllines/

DolphinDream avatar Apr 01 '20 20:04 DolphinDream

i think it does, but turning edges into cylinders is a little expensive :)

zeffii avatar Apr 01 '20 21:04 zeffii