nmwsharp / polyscope Goto Github PK
View Code? Open in Web Editor NEWA C++ & Python viewer for 3D data like meshes and point clouds
Home Page: https://polyscope.run
License: MIT License
A C++ & Python viewer for 3D data like meshes and point clouds
Home Page: https://polyscope.run
License: MIT License
E.g., determined by a quantity array.
System: Win 10
polyscope version: latest
I often use "Win + D" to show the desktop, but the polyscope program crashes after I press this shortcut. Is this a bug?
I use the following code to show the GUI:
polyscope::init();
polyscope::show();
Problem: camera view (and probably others at some point) use state::lengthscale
on construction to set up a the view. This is a problem because state::lengthscale
is constantly changing! For instance, right now, adding views before other objects means the lengthscale changes with each view added.
How should we resolve? Perhaps only permit state::lengthscale to get used as in uniforms, where the new values is utilized every draw iteration. Alternately, call a some function in the structure whenever such a global changes to notify for reconstruct.
Without any autoscale
, one needs to set the (0,0,0) point radius to 0.5 to make it "match" with a centred spherical mesh of radius 1
Lighting can make it difficult to interpret scalar quantities visualized via a color map. Would be helpful to be able to toggle lighting and flat shading (that just directly displays the color map value).
Forgive me if I have not read the documentation thoroughly, but is there a canned subroutine for volume rendering?
In the permutation setter functions (e.g. setEdgePermutation
), you set the size of the index space to be the maximum entry of the permutation. But it appears that the indices in the permutation are supposed to be 0-indexed, which means that the maximum entry is actually 1 less than the desired size
Goals:
Write out a .polyscope.ini file on exit, and look for one on startup
Things to put in it:
Possible ideas:
(from https://twitter.com/lawsonfulton/status/1154145142871400450)
Should probably do this by setting default object transforms, and also adjusting camera / ground plane accordingly.
The statistics printed out for the mesh structure got broken when geometry-central was extracted. Resurrect them in some form!
Building polyscope on Ubuntu 18.04.3 with cmake VERSION 3.16.2 according to instructions at http://polyscope.run/building/ produces this error:
[cmake] CMake Error at CMakeLists.txt:13 (add_subdirectory):
[cmake] add_subdirectory not given a binary directory but the given source
[cmake] directory "/home/paul/libraries/polyscope" is not a subdirectory of
[cmake] "/home/paul/st/hello/src". When specifying an out-of-tree source a binary
[cmake] directory must be explicitly specified.
I suggest changing
add_subdirectory("polyscope")
to
add_subdirectory("polyscope" "polyscope")
in instructions at http://polyscope.run/building/
AFAIK, it has the same semantics, but may be more tolerant to out-of-tree location of polyscope files.
Hi, does the polyscope supports animating now? for instance, how could I use polyscope to check the procedure of the points' removing for a given point cloud continually with only one window?
Use of C99 arrays can cause problems with compilation (e.g., when using -pedantic and -Werror in clang).
The only example I've run into so far is
template <typename T>
std::string AffineRemapper<T>::printBounds() {
size_t bSize = 50;
char b[bSize];
snprintf(b, bSize, "[%6.2e, %6.2e]", minVal, maxVal);
return std::string(b);
}
which can be modernized to
template <typename T>
std::string AffineRemapper<T>::printBounds() {
const size_t bSize = 50;
std::array<char,bSize> b;
snprintf(b.data(), bSize, "[%6.2e, %6.2e]", minVal, maxVal);
return std::string(b.data());
}
(Though there may be others.)
For instance, http://polyscope.run/basics/parameters/#scaled-values. This should probably use setPointRadius
in the example.
Noticed via #62
Right now its looking like the logic to manage quantities will be duplicated in every structure. This is bad; can we create a general purpose "quantity manager" to handle all of these?
It looks like the ribbon shader has been disabled.. Checking/unchecking the "ribbon" checkbox in the interface does nothing (vectors are still displayed with the "arrow" geometry).
Hi,
I just tried polyscope within python on Windows using the ipython terminal, jupyter notebook and jupyter lab. In all cases, polyscope works well and is quite impressive. But when I try to close the polyscope window, it always crashes python. Are there any settings I can change to address this? I am assuming it is related to the opengl backend, yes?
Cheers,
Michael
Build a module that integrates with https://github.com/ArashPartow/exprtk so users can define simple functions in the UI and use the in their code.
There are a lot of tricks for rendering transparency; this one is particularly friendly to the rasterization pipeline and could work well in Polyscope (also because it nicely highlights contours):
https://observablehq.com/@rreusser/faking-transparency-for-3d-surfaces
“Cartoon edges” might be replaced with simple edge based silhouettes (i.e., compare the sign of the dot product of the normal with the eye for the 2+ triangles touching an edge), since the former works well only for well-tessellated surfaces.
We want something like std::string polyscope::userPickFilename(std::string types);
. Unfortunately, this is very os-dependent, and neither ImGUI nor GLFW already offer it.
https://github.com/mlabbe/nativefiledialog looks promising.
I'm have a weird issue with Curve Network: the embedding of nodes seems to be wrong.
My test: I create a simple curve network with small segments starting at mesh vertices and going inside the mesh. What we see in the video is just the first nodes.
The issue is that the curve tips should coincide with the mesh vertices (which is not the case).
If you look at the coordinates (selection windows), they are exactly the same. It looks like it's only a draw issue.
(tested on macOs)
Provide some nice way of handling meshes which are far from the origin. Perturbing vertex positions is NOT the right idea, use a view transform instead.
Should this apply for all structures? Perhaps we want "center to bounding box" instead.
More generally, provide a nice facility for highlighting.
Probably want to do this with shader tricks, rather than geometry tricks. Perhaps stencil --> blur --> blend?
Fails with ImGui context problem. Perhaps broken by ImGui update?
Add a unit test, and fix.
polyscope::init();
polyscope::show();
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 4.1 ATI-3.5.5
[1] 5910 segmentation fault ./demo
exception: stack_not_16_byte_aligned_error
stb_image.h: stbi__load_and_postprocess_8bit
stb_image.h: stbi__loadf_main
stb_image.h: stbi_loadf_from_memory
engine.cpp: loadDefaultMaterial
engine.cpp: loadDefaultMaterials
engine.cpp: allocateGlobalBuffersAndPrograms
MacOS Catalina 10.15.3, compiler: apple clang v11
comment out following material load in engine.cpp:
loadDefaultMaterial("mud");
loadDefaultMaterial("ceramic");
loadDefaultMaterial("jade");
loadDefaultMaterial("normal");
Hi, thx for this great lib. Could you also add a port to VCPKG dependency manager for easier usage? Please find attached how the port should look like for your library. You only have to submit a PR to VCPKG with the attached folder inside ports
folder. It is almost working, all you need to do is include an install
build target to CMake scripts.
polyscope.zip
Trying to set an existing quantity with add*Quantity
yields an error message that cannot be resolved by setting the requested option. For instance, running SurfaceMesh::addVertexScalarQuantity
twice yields an error message
[ERROR] Tried to add quantity with name: [quantity], but a quantity with that name already exists on the structure [mesh]. Use the allowReplacement option like addQuantity(..., true) to replace.
but there is no way to pass this option through addVertexScalarQuantity
.
Right now there's a bit of a zoo of count and subset quantities in surface_mesh.h. All of these share the general idea that some subset of mesh elements are selected, possibly with a scalar associated with the selected elements.
What's the right API here? What should these functions be called?
The current version seems to be significantly different, this might be a problem at some point.
Minor updates may be needed, as I think I modified the file slightly for some input related stuff (whoops?)
Polyscope does not build with the default c++ compiler of linux/ubuntu OS.
The Pull-request nmwsharp/geometry-central#7) of geometry-central fixes the issues. Could you please update the submodule version when the GC PR gets merged?
The added line to deps/imgui/CMakeLists.txt
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
breaks builds when the flags contain -Wall -Werror=return-type
, this gets mangled to -Wall=return-type
Suggested fix:
string(REPLACE "-Werror=" "-Wno-error=" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Currently the Polyscope addQuantity
methods can take a GeometryCentral MeshData
object, but the Polyscope updateVertexPositions
method can only take a raw array, rather than a GC VertexData.
They're missing, add them. @rohan-sawhney
Hi @nmwsharp ,
Thank you for this excellent package!
I was not able to get the colors to render in the curve network example.
As written in the example in the documentation, I ran the exact code (with the addition of ps.init())
import numpy as np
import polyscope as ps
# register a curve network
N_node = 100
N_edge = 250
nodes = np.random.rand(N_node, 3)
edges = np.random.randint(0, N_node, size=(N_edge,2))
ps_net = ps.register_curve_network("my network", nodes, edges)
# visualize some random colors per-node
# vals_node = np.random.rand(N_node, 3)
# ps_net.add_color_quantity("rand vals", vals_node)
# visualize some random colors per-edge
vals_edge = np.random.rand(N_edge, 3)
ps_net.add_color_quantity("rand vals2", vals_edge, defined_on='edges')
# view the network with all of these quantities
ps.init()
ps.show()
and the result looks like this:
I am using the Python API (Python 3.6.8), Ubuntu 18.04. I installed the pre-compiled wheels via python -m pip install polyscope
.
Did I miss something?
Thanks!
-Rana
Right now, there are lots of small bugs where changing some setting in the quantity option pane doesn't trigger a redraw when it should (e.g., changing bounds on colormap). This is caused by missing requestRedraw()
calls.
Part 1 is do a quick audit to identify and fix as many of these as possible.
Part 2 is to make these bugs less common in the future. There's probably no magic solution, and this will probably be a recurring issue. But we should do what we can, like abstracting more things behind helpers, to make it less common.
General strategy is to use double types internally everywhere, to avoid subtle situations (like IO) where a loss of precision occurs in user data.
We've been shuffling types internally, so make sure no floats (or glm::vec3
) slipped through.
When using the autoscaleStrucutres
option, there may be an issue with the relativeValue
computations (state::lengthScale
might not be updated properly). For instance, if you attach an ambient vector field to a structure, the length and radius slider limits are super small (when you scale down a huge object to the unit cube thx to the autoscale).
Would it be possible to integrate a platform like QT python? I would like to add some buttons etc.
The snippet on the landing shows these lines of code
// Add a scalar and a vector function to the mesh
polyscope::getSurfaceMesh("my mesh")->addQuantity("my_scalar", scalarQuantity);
polyscope::getSurfaceMesh("my mesh")->addQuantity("my_vector", vectorQuantity);
but should really be something like addVertexScalarQuantity
or addFaceVectorQuantity
, etc. (This can cause confusion when trying out polyscope for the first time.)
Options to delete individual quantities. Mark a property as "locked" so it doesn't get deleted by a clear all?
defaults are lame
I've tried the basic point cloud visualization example from the docs for python:
import numpy as np
import polyscope as ps
ps.init()
points = np.random.rand(100, 3)
ps_cloud = ps.register_point_cloud("my points", points)
ps.show()
However, the window that is created looks like this.
I've also tried to adjust the radius, but this doesn't change anything.
On the console I get the following output:
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 3.3 (Core Profile) Mesa 19.2.8
I've installed via the conda command for python 3.6.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.