Open zeffii opened 5 years ago
Looks like non convex polygons does not supported yet
Were they supported in 2.79?...
There was option on N panel for viewer node.
ah.... if the concave is a Quad, it should be tessellated, instead of my assumption
[[a, b, c], [a, c, d]]
i'll add a property, so
elif num_verts == 4 and not self.convex_quads:
...
let me consider this over night :)
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 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:
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.
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.
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.
This raises cascade of errors. Weirdly.))
we can add a test like
def is_input_vertex_kind(socket_data):
return len(socket_data) and len(socket_data[0][0]) == 3
It would be nice if the node will become red.
OK. that's probably reasonable.
Well it have taken some time for figuring out what is going wrong.
See also data_structure.get_data_nesting_level
, data_structure.ensure_nesting_level
.
See also implicit_conversions
parameter of sv_get()
method.
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):
screenshot of sverchok redux node error handling
i am very tempted to implement this now.
I don't think it's good idea to write the whole stack trace in the viewport; maybe only the error message?
The same thought. Probably it would be better to make a reference to console or log file in Blender for more details.
yeah, a more simplified traceback. it's worth trying
@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
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.
i don't think i'll add https://developer.blender.org/F8403764
but here's a start branch , for exactly that.. https://github.com/nortikin/sverchok/pull/2965
@DolphinDream .. it seems they removed: https://developer.blender.org/F8403764 (above link)m which is what I was basing it off.
I wonder if geometry shaders would be the way to go.. if Blender 2.8x supports them.
i think it does, but turning edges into cylinders is a little expensive :)
experiment. stuff is sometimes easier than it seems, but sometimes far more complicated than it should be conceptually :)
More interesting stuff.. with some webgl demos:
https://mattdesl.svbtle.com/drawing-lines-is-hard https://github.com/mattdesl/webgl-lines
add them here : https://github.com/nortikin/sverchok/issues/2608
https://github.com/nidorx/matcaps maybe : ) https://www.geeks3d.com/dl/show/50100 with matcap pixel and vertex shader.
you need to use recent version of Blender 2.8+
[x] does not show dashed lines + custom fragment shader
[x] handle concave quads using a boolean,
handle_concave_quads = True
[x] does not automatically use polygon offset yet.
[ ] 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.
bmesh_from_pydata
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.