isosurface alpha #4202
Replies: 8 comments
-
Try using ColorSchemes
cmap = get(colorschemes[:plasma], LinRange(0,1,100))
cmap1 = [RGBAf0(cmap[i],0.65) for i in 1:100]
ξ = -40:1:40
c = 20
a = 15
torus = [((hypot(X,Y)-c)^2+Z^2-a^2) for X in ξ, Y in ξ, Z in ξ]
contour(torus, levels=[100.0, 500.0], alpha=0.05)
current_figure() |> display |
Beta Was this translation helpful? Give feedback.
-
It's quite murky compared to iso. Is this really a way forward here? I would have thought alpha should apply to the whole scene including between layers in the current surface. Is there a fundamental rendering approach that isn't going to be changed any time soon? |
Beta Was this translation helpful? Give feedback.
-
What do you mean?
Iso doesn't support alpha right now, since it stops at the isosurface. What do you mean by murky? Have you tried tweaking the parameters? |
Beta Was this translation helpful? Give feedback.
-
I don't know how to get the result I want by tweaking. This is as close as I can get. Still feels quite murky, probably just my ignorance about how to tweak. Surface contours visible and I don't know how to turn on an external light source to get some surface shine (which seems to be default in iso?). Also, doesn't seem to respond to changing colormaps: cmap3 = get(colorschemes[:plasma], LinRange(0,1,100))
ξ = -40:1:40
c = 20
a = 15
torus = [((hypot(X,Y)-c)^2+Z^2-a^2) for X in ξ, Y in ξ, Z in ξ]
contour(torus, alpha=0.13,levels=[300],colormap=cmap3,colorrange=[0,800])
current_figure() whereas I am aiming for something like this where the top is clearly the top, and the underside is visibly obscured by the other surfaces, but still visible. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Thanks a lot. I've got it to here, which I'm pretty happy with. Given the fairly non-standard usage, is there somewhere this would like to live in docs? Or an advanced example @lazarusA ? using GLMakie
using Meshing, GeometryBasics
ξ = -40:.5:40
c = 20
a = 15
torus = [((hypot(X,Y)-c)^2+Z^2-a^2) for X in ξ, Y in ξ, Z in ξ]
algo = MarchingCubes(iso=100, insidepositive=false)
mc = GeometryBasics.Mesh(torus, algo)
figt = Figure(resolution=(1200,1200))
Makie.mesh(figt[1,1],normal_mesh(mc),
color=(:red, 0.6),
# Light comes from (0, 0, 15), i.e the sphere
lightposition = Vec3f0(20, 120,100),
# base light of the plot only illuminates red colors
ambient = Vec3f0(0.3),
# light from source (sphere) illuminates yellow colors
diffuse = Vec3f0(0.8),
# reflections illuminate blue colors
specular = Vec3f0(0.8),
# Reflections are sharp
shininess = 40f0)
figt |
Beta Was this translation helpful? Give feedback.
-
to light up the tube better (i.e. the front), I want to put more than one light source. If I try to add a second light source using the same syntax I get the error
|
Beta Was this translation helpful? Give feedback.
-
There is a |
Beta Was this translation helpful? Give feedback.
-
There is an unexpected behavior with respect to alpha of topologically interesting surfaces:
gives
Shouldn't the alpha allow the interior of the torus to be partially visible? At present it means that interesting topology can't be visualised.
For simple distinct surfaces, the result is more intuitive, in that the surfaces are visible through each other:
This was discussed over at discourse
Beta Was this translation helpful? Give feedback.
All reactions