Closed zeffii closed 5 years ago
It is almost there isn't it?
Apart of the fact that it does not draw anything if only vertices input is connected,
The bake operator is missing and some other minor options,
Are there any features you would like to discuss?
i'm undecided about how the automatic geometry extending should happen, we could offer several approaches..
if len(verts)< len(edges):
...
extend verts count to match edges, but also make sure there are enough verts in each new set to
create a valid edge net (no invalid indices,
- auto repeat with zero vectors would be optional
- or...
- drop edges that reference invalid vertex indices
if len(verts) <len(faces):
...
same idea
and ..should we merge all incoming geometry and create only 1 massive drawing call, or generate multiple calls to the shader (to match number of incoming objects sets) , i suspect one of those options is fast, and the other is by far the simpler to maintain :)
also.... it would be possible to accept a color input, and handle this like the vertex_colors node
but first perhaps a rewrite of the logic, and then refine the draw functions.
I would drop the references to invalid_vertex indices printing something to the log. And about the calls to the shader I think the "one call" is the cleaner and probably faster method.
the color input could be handy. Another idea would be to have some verts, edges and matrix display types, (cross, cross with circle...,dotted line, axis only...) But first the logic :)
here's a table to help me relate to this problem in future
n | verts in | edges in | faces in | matrix in |
---|---|---|---|---|
show verts | x | |||
show edges | x | (x) | x | |
show faces | x | x | ||
display matrices | x | |||
display flat | x | x | ||
display smooth | x | x | ||
display facet | x | x | ||
display glsl | x | x |
the parenthesis (x) shows that edges can be inferred from faces, where edges is optional, but if edges is not connected the faces is mandatory to be able to infer edge display
plainly
def process_geometry(display_mode, face_mode, sockets):
if sockets['verts'].is_linked:
# requires verts
if display_mode == 'v':
# draw verts only
# reguires verts and (edges or faces), if faces_in infer edges
elif display_mode == 've':
# draw verts and edges
# requires verts and faces
elif display_mode == 'vf':
# draw verts and faces
# requires verts and faces, but edges is inferrable if ommitted
elif display_mode == 'vef':
# draw verts, edges, and faces
# requires verts and (edges or faces, if faces only then infer, if edges_in then use edges)
elif display_mode == 'e':
# draw only edges
# requires verts and faces
elif display_mode == 'f':
# draw only faces
# requires verts and faces, infer edges from faces if no edge_in
elif display_mode == 'ef':
# draw edges and faces
elif sockets['matrices'].is_linked:
# requires only matrices
if display_mode == 'm':
# draw only matrices
only modes that include f
can be used for display flat / facetted / smooth / glsl
good day friends, Im really looking forward to Viewer Draw working on 2.8, any forecast as to when it will be functional? thank you so much :)
in the meantime VD_Experimental
should/might fulfill most of your needs, it's been slightly updated this week by @vicdoval
Thank you Zeffii, on what branch? on b28_prelease_master branch? or in another?
@javismiles .blend files made in b2.79 are not going to work perfectly in b2.8 . Some blends will load ok, some blends will miss a few nodes:
@zeffii I got it yes Zeffii, but I started a brand new 2.8 project, from zero, and its all working great, the only thing missing for me is to join into a smooth mess the points of the point cloud I have, and for that I understand I would need Viewer Draw, in what branch is the very lastest VD_Experimental ? thank you :)
@zeffii so this is a brand new 2.8 project, it all works perfect, I would just need to, if I understand correctly, replace the Viewer bMesh node, with the VD_experimental in order to try to transform the output point cloud (that now uses spherical spheres in each point) into a continuous mesh
would that be possible? and in what branch is the latest VD_experimental? thank you :)
@javismiles :
to join into a smooth mess the points of the point cloud I have
you don't need a viewer draw if all you want is to merge all points into a single "object". there are Mesh Join nodes.
even the Matrix Apply node will merge all incoming geometry, when the Join option is ticked (assuming you pass the same number of matrices as verts/edge/face sets/ .. IIRC )
what branch is the latest VD_experimental
that should be the b28_prelease_master
(the vd changes were merged the other day)
thank you @zeffii, what I need is to literally unite the points to form a smooth continuous shape without gaps in between. I tried the Join option and that didnt work
so what I need is if I have 400 points in a point cloud with gaps in between, I need them to join each other to form a continuous sooth shape that has no holes or gaps in between, that´s the thing
you are trying to automatically topologize a point cloud ? sverchok has no feature/node that will do that. (don't get me wrong, it's an interesting problem... and there are dedicated software packages that implement algorithms that do exactly that)
there are ways to combine several sverchok nodes to get some topology into the point cloud, but it's a bit lenghty to explain.
what might work is transforming the point cloud (normalizing it ) so it becomes a sphere, then applying a convex hull to mesh the outside, then transform the points back to their original state, and if you're lucky you'll have something usable.
@zeffii Now I can show you exactly what I need to do, check this picture please:
That´s exactly what I need to do, on the left is the point cloud I have, on the right is what I need, to make it continuous and smooth, how do I do that with the Sverchok nodes in 2.8? thank you so much :)
oh I see, so this below is not possible? what a pity, this can be done easily with matplotlib in python but I really need to do it inside blender
the code to do that in python matplotlib is this: fig = plt.figure(figsize=(10,10)) ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, losses, cmap=cm.Spectral,linewidth=0, antialiased=True) plt.show()
but I basically need to do that within blender, I already managed following the tutorial to import a set of .csv files that using the great Sverchok allows me to create an animation of the point cloud through time with a different frame of the point cloud on each frame in blender, and it all works perfect in blender 2.8, only thing left is to find out how to do what matplotlib does in python to transform the point cloud into the continuous surface you see above
Most probably the "UV connector" node will do the job in your case. Probably you will need to apply "List split" before.
Do you have a flat list? Is your point cloud regular? If this is the case this will help: If you have a list of 100 points and you know the surface is defined by 10 x 10 point grid you would need to split the list in 10 lists and with the "split list" node and plug the output to "UV Connection" Node to create the polygons you need.
If your list is not well sorted you can use the Vector Sort node before splinting
can you share the pointcloud as a gist ? @javismiles
that particular kind of point cloud would not be hard to topologize, it's a very specific kind of point data.
@zeffii @vicdoval @portnov thank you so much friends, its very simple, the point cloud is just a series of x, y, z rows, csv file, each row has 3 numbers separated by commas, the three points are the x, y and z of the point
Here is an example point cloud file, https://github.com/javismiles/torch/blob/master/point-cloud-final-example.csv
thank you again :)
https://github.com/javismiles/torch/blob/master/point-cloud-final-example.csv,
and then 1 csv file for each frame of the animation, so the point cloud gets animated, thats the whole point, so imagine 200 frames, 200 csv files with the 200 frames of the point cloud, each of them 1 csv file, each with say 20x20 X, Y, Z points, 400 points in total,
the animation of the point cloud already works in 2.8
@zeffii @vicdoval @portnov here is a final example of the csv point cloud that I will use, this is the exact same thing I showed in the pictures above, let me know what u think, this is the point cloud, now imagine 200 csv files with same thing as this but with the shape changing in each one of course https://github.com/javismiles/torch/blob/master/point-cloud-final-example.csv
as you can see, both X and Y go between -1 and 1, creating a regular grid of coordinates, and then the Z is the coordinate that creates the shape going to different heights
https://github.com/javismiles/torch/blob/master/point-cloud-final-example.csv
I think you might only need to generate the topology for that pointcloud once, if the only change to the cloud is the z component.. , actually, you might be able to use the Plane node to output faces..
thank you @zeffii , do you mean that here I could replace the viewer mesh node with plane node? o put it somewhere else mmm (btw this picture is using a different point cloud from the tutorial I used to build the nodes, but eventually I will use the point cloud I showed before instead)
@zeffii WOW that´s it! that´s what I need! :D is that in 2.8? I will try to test it in 2.8 to see if I can add it to these nodes and the animation keeps switching the csv shape in each frame
i hesitate to call the example set of points a 'point cloud'. it's a 'surface of grid vectors without topology' . as soon as you try to 'mesh' some random point cloud that you might obtain from a lidar scanner, this approach will instantly fail.
yes its b2.80 , i don't have 2.79 anymore : ) since .. november 2018 :)
thank you @zeffii that´s great news because all I need is to work with what you call a surface of grid vectors yes, great point you are right this is not a complex proper point cloud yeah, Im trying now to see if I can copy what you created mixing it with my existing nodes
@zeffii for some reason I cannot search the nodes in my 2.8, where is that component-wise node you used? cant find it in the menus, in which section is it? and looking at this image, where would you insert that component-wise node? thank you :)
@javismiles it' s the Vector Math node, set to Component wise multiplication
not sure about the search
thing. something may have changed in recent Blender 2.8 builds... i will have a look later.
@zeffii as you see in this image, the surface cloud is all good, but it´s linking the points in the wrong way, covering the gap in the middle, so yes I wonder how you did it to look so great
@zeffii this is the exact one that you did, and the mystery yes is how did you manage to prevent it from connecting the dots around the hole covering it, tell me please or send me the blend, now Im really curious how did you prevent that from happening :D
@zeffii by the way, I have noticed that your VD Experimental node has the icon of a photo camera instead of an eye, mine has an eye, yours has a photo camera, and I cannot get a photo camera in there at all, so does that mean that you have a different version of VD Experimental than mine? I have the latest one as far as I know,
anyway looking forward to knowing how you managed to avoid what happened to me, thank you :)
correct the Plane
node , would only output the correct topology if it is told to generate the grid for the correct number of X , Y
the gradient there is done using a default glsl shader, kind of beyond the scope of my answers here (tonight) - i suggest you look at the pull request for b28_prelease_master
, i show a few examples of how you could make a custom GLSL shader (just in the form of a text file))
you could also just use BMESH viewer, and give it a cycles material or whatever.
I think you might be off-by-one
, in the number verts xy
, else i suggest just using a gist
to give me a look at one of the frames of that csv..
mess around with the number of verts x y
, you'll probably figure it out.
@zeffii it works, now it works, yes it was the number of vertexes, now it works ;) so next is to make a nicer shader, because the distribution of the colors is odd, I would like the colors to correlate with the Z, different amounts of Z have different colors in a gradient, like bands of smooth colors in different ranges of Z yeah
my Sverchok is a few commits behind, this explains minor cosmetic differences.
regarding the parametric control of the cycles/eevee material, i think it is possible with the execnode
, i don't recall if i've ever done that or not.
@zeffii great news, managed to do it all, I made a shader with the shader nodes and all is cool now, than you so much for your help, my only problem now is that I can render individual frames, but when I try to render the animation blender crashes, must be a memory issue, im using an xps 15 9550 of dell, with 16GB RAM and Nvidia 2GB card but I guess it´s not enough, will upgrade laptop soon and hopefully then I will be able to render the animation, if you know of any tricks to decrease memory when rendering these let me know please ;)
@zeffii , do you think that the crash that happens when I try to render the animation could be because of memory or because of an issue with sverchok and/or blender 2.8, because it´s weird that rendering single frames goes all well , and rendering an animation crashes immediately after frame 1, that´s odd, and in a powerful laptop, maybe there is some issue or bug in one of the parties involved here what do u think
and even when I decrease the resolution, decrease other parameters, take light shadows out, etc, etc, still crashes after the 1st frame, that´s very odd, feels like a bug somewhere
and I have previously rendered in blender 2.8 way more complex models with no issues, therefore maybe this is an issue with the still not finalized Sverchok for 2.8?
The current implementation ( VD_Experimental ) is a first attempt at using the new API/shader stuff. , and has helped debug the porting of nodes. It is quite limited in its current form, but might serve as a reference implementation for other openGL nodes in Sverchok.
I want to talk about implementing a VDMK2 port