Hi Hans,

I have now run your gyroid test under WSL/Linux, using the separate ConTeXt LMTX installation:

 *

   ConTeXt LMTX: |2026.07.29 11:46|

 *

   LuaMetaTeX: |2.11.09|

 *

   platform: |linux-64| under WSL

 *

   processor: AMD Ryzen 5 5600

 *

   RAM: 32 GB

The output was generated correctly and looks very good.

For the initial calculation, the log reports:

|implicit mesh: 3,691,602 vertices 1,230,534 triangles mesh generation: 5.062 seconds triangle rendering: 0.295 seconds MetaPost total: 5.474 seconds ConTeXt runtime: 6.773 seconds |

The cleanup message reports about 596 MB of temporary data.

On the second run, with the cache being reused, the figures dropped to:

|MetaPost total: 0.014 seconds ConTeXt runtime: 0.249 seconds |

So on this machine the cached run is roughly 27 times faster than the initial run.

The complete |context gyroid-test.tex| command performed both runs automatically and was measured with |/usr/bin/time -v| as:

|wall-clock time: 7.10 seconds maximum resident set size: 432,172 kB CPU usage: 88% |

This means that, on this Ryzen 5 5600 machine, the initial calculation is about twice as fast as the approximately 14 seconds you reported, while the cached run is also somewhat faster than your 0.45 seconds.

The bitmap output remains compact and responsive in the PDF viewer, despite the mesh containing more than 1.2 million triangles.

JP


Le 29/07/2026 à 14:46, Hans Hagen via ntg-context a écrit :
On 7/29/2026 12:57 PM, Jean-Pierre Delange via ntg-context wrote:
Hi Hans,

I installed the new ConTeXt LMTX version in a separate Windows directory, so as not to interfere with my existing installation:

> ...
>
I then copied |luametafun-threed.tex| to a separate test directory and compiled it with:

|context luametafun-threed.tex |

The compilation completed successfully and produced a 15-page PDF. The 3D examples that were rendered — including the Menger sponge and the parametric and postprocessed spheres — look very good.

The final statistics were:

|MetaPost: 3.051 seconds Total ConTeXt runtime: 3.760 seconds 15 processed and shipped pages Lua memory: 169 MB used, 173 MB maximum |

Some individual figures were also quite fast:

a few have cache = true set, so that helps

|Menger sponge: 2,400 triangles rendering time: 0.612 seconds Parametric sphere: 20,000 triangles rendering time: about 0.145–0.149 seconds |

on the average parametrics plot are fast (could be sped up if really needed) but implcits are more expsnsive as there we generate 8 samples per cube around points

The log also reports substantial temporary memory clean-ups, for example about 160 MB for the Menger sponge and about 412 MB for the parametric spheres. The more complex implicit/intersection example reaches roughly 1 GB of temporary data, as described in the manual. Nevertheless, the complete document compiled quickly on this machine.
I noticed three minor issues:

indeed, we operate on a sometimes 2500 x 2500 bit map, with zbuffering that can go deep (esp with transparency enabled) with high res color (doubles), normal vectors etc, and that all comes at a price; if really needed we can compile with floats which saves a bit; the super sampling of (here 2) quadruples it;

however, the mesh is the same;

Here's a test:

\nologbuffering

\startMPpage
lmt_scene_start [
    width        = 10cm,
    resolution   = 150,
    supersample  = 2,
    crop         = true,
    projection   = "perspective",
    eye          = "auto", % (-8,32,0),
    fov          = 80,
    light        = (0,-1,-2),
    intensity    = 1.1,
    cache        = true,
    name         = "example",
] ;

lmt_scene_material [
    name      = "surface",
    diffuse   = (.9,.2,.2),
    specular  = (.5,.5,.5),
    shininess = 25,
    opacity   = 1,
    ambient   = .25,
] ;

lmt_scene_implicit [
    id       = "gyroid",
    material = "surface",
    code     = "sin(x)*cos(y) + sin(y)*cos(z) + sin(z)*cos(x)",
    dfdx     = "cos(x)*cos(y) - sin(z)*sin(x)",
    dfdy     = "cos(y)*cos(z) - sin(x)*sin(y)",
    dfdz     = "cos(z)*cos(x) - sin(y)*sin(z)",
    xmin     = -2pi,
    xmax     =  2pi,
    ymin     = -2pi,
    ymax     =  2pi,
    zmin     = -2pi,
    zmax     =  2pi,
%     xmin     = -pi,
%     xmax     =  pi,
%     ymin     = -pi,
%     ymax     =  pi,
%     zmin     = -pi,
%     zmax     =  pi,
    nx       = 150,
    ny       = 150,
    nz       = 150,
    normal   = "smooth",
] ;


lmt_scene_render ;

lmt_scene_stop ;

\stopMPpage

This takes 14 seconds runtime here but as we cache only .45 seconds after that. It's kind of hard to predict at my end what a modern machine with more cpu cache would need.

 1.

    At the beginning of the run, ConTeXt reports:

|modules > '3d' is not found |

ok, we can remove the module line (we tested with a module first as that was easier before integration)

and the final statistics mention one missing module, |*-3d|. However, the internal 3D LuaMetaFun support is loaded correctly through |mlib- thr.lmt|, and this does not prevent the document from compiling.
2. One internal reference remains unresolved:

|fig:threed:process:3 |

which appears as “Figure ??” in the PDF.

thanks, fixed

 3.

    Near the end of the compilation, the log reports:

|luatex warning > mplib: run script: cannot open : Invalid argument |

you probably miss the stl file

I had copied only |luametafun-threed.tex| to the test directory, so I suspect that the final STL example could not find |luametafun-threed- sphere.stl|. The PDF was still produced, but the last STL figure was not rendered correctly. I will repeat the test after copying the accompanying STL file as well. As a first impression, the rendering performance on this Windows machine is very good, and the visual quality of the generated bytemaps is excellent.

yes, and the alternative, vector based meshing not only bloats a pdf, but us also much more heavy on the viewer (stalls in the worst case) and is also less reliable

I am now preparing the same separate installation and test under WSL and native Ubuntu, so that I can compare the three environments on the same hardware.

Good. Thanks,

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to