Meshes.jl icon indicating copy to clipboard operation
Meshes.jl copied to clipboard

Smoothing option in viz function

Open stla opened this issue 2 years ago • 9 comments

Hello,

I exposed my problem here.

In the given answer, the author uses the Makie.mesh! function to plot the mesh, with the option interpolate=false. Is it possible to have such an option with MeshViz.jl? I took a look at the code and it seems you use Makie.meshscatter!, which does not have this option.

stla avatar Dec 22 '22 10:12 stla

We provide two coloring options in MeshViz.jl. If you pass a vector of colors that has the same length of the vector of vertices you get interpolation. If on the other hand the vector of colors has a length that is equal to the number of elements you get sharp boundaries. Can you give it a try?

Em qui., 22 de dez. de 2022 07:28, stla @.***> escreveu:

Hello,

I exposed my problem here https://discourse.julialang.org/t/meshviz-makie-is-smoothing-my-colors/91993 .

In the given answer, the author uses the Makie.mesh! function to plot the mesh, with the option interpolate=false. Is it possible to have such an option with MeshViz.jl? I took a look at the code and it seems you use Makie.meshscatter!, which does not have this option.

— Reply to this email directly, view it on GitHub https://github.com/JuliaGeometry/Meshes.jl/issues/535, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3OVX7TT2TT557YXXQDWOQUNZANCNFSM6AAAAAATGR7BAY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

juliohm avatar Dec 22 '22 10:12 juliohm

Yes, it works. Thanks.

stla avatar Dec 22 '22 10:12 stla

Can you also share the update on Discourse so that others learn about the solution?

Em qui., 22 de dez. de 2022 07:49, stla @.***> escreveu:

Closed JuliaGeometry/Meshes.jl#535 https://github.com/JuliaGeometry/Meshes.jl/issues/535 as completed.

— Reply to this email directly, view it on GitHub https://github.com/JuliaGeometry/Meshes.jl/issues/535, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3NBQIH57V2TMKU5ANLWOQW4VANCNFSM6AAAAAATGR7BAY . You are receiving this because you commented.Message ID: @.***>

juliohm avatar Dec 22 '22 11:12 juliohm

Actually I still have the same problem: if I provide a color per face, the mesh is not smoothed. So I can't do something like this for example, with sharp colors but smoothed: https://youtu.be/vLkNQh3Sv8w

stla avatar Dec 26 '22 17:12 stla

What exactly is smoothed? I am trying to understand what exactly is the difference between the current output and the desired output. On Zulip we have a thread where I asked if you could share some screenshots of the same geometry with the same angle to compare the different results.

juliohm avatar Dec 26 '22 18:12 juliohm

On Zulip my two screenshots have the same angle.

By "not smoothed" I mean that we can see the faces of the mesh when we plot it, as if the normals were not taken into account.

Here is an example with rgl. The sphere at right has no normals, it is not smoothed. Capture du 2022-12-26 19-43-07

stla avatar Dec 26 '22 18:12 stla

Got it. Do you have a PR in mind here that could give this additional flexibility? I don't know how these normals play a role in OpenGL, but Makie probably has an option to use them or not. We just need to forward this option to the low-level Makie function in our recipe.

juliohm avatar Dec 26 '22 18:12 juliohm

I don't have a PR in mind. I didn't study MeshViz yet, and I'm not a familiar with Makie. But I believe we can give the normals in Makie and there's an interpolate argument for the colors. Not sure.

stla avatar Dec 26 '22 18:12 stla

@stla appreciate if you can take a look at the option you mentioned.

juliohm avatar Jul 21 '23 15:07 juliohm