3

Bug introduced in 9.0 and persists through 11.1.1
Reported to WRI under [CASE:3678032]
It crashes the FrontEnd of Mathematica 10.4.1 on Windows


UPDATE #2 27.04.17 Redacted due to outdated GPU driver on my machine


UPDATE 27.04.17
WRI followed up; the issue is not resolved in 11.1.0, but they "see much improved behavior in 11.1.1". Can anybody check this one?
UPDATE 25.04.17
I received an e-mail from WRI, they believe the issue has been resolved in 11.1. Can anybody verify this?


Consider this simple code:

i3d = 1/4 RandomReal[1, {5, 5, 5}] // Image3D

Now Show me this:

Show[{i3d, Graphics3D[{FaceForm[Opacity[.6]], Cuboid[{3, 3, 3}]}]}]

It takes a lot of time to render and repeatedly freezes and unfreezes MMA.

Note that simply i3d returns a very responsive object, renders fast, etc.

I could live with the above. However I need to generate a high-resolution image, like so:

Show[{i3d, Graphics3D[{FaceForm[Opacity[.6]], Cuboid[{3, 3, 3}]}]}, ImageSize -> {2400, 1600}]

But when I run this line of code, MMA returns an empty box with a tiny little square of the color of i3d in the top left corner of the output cell.

I am using version 10.2 on Win7x64 professional. I have 8GB of RAM (I noticed, that MMA consumes several GB when running the first Show statement).

Is this a bug? Has it been fixed in a later version?

My eventual desire is to get a hi-res of the following figure:

enter image description here

The blue cloud is made up of an array of voxels. The yellow triangles in the top half of the image have a setting like Specularity[White, 10], Opacity[.6]. When I try to create this figure with Show[{...}, ImageSize->{900,600}], it takes quite a while, but eventually returns a result. When I crank up the ImageSize I get a problem similar to the MWE above. When I exclude either the cloud or the yellow triangles, everything works fine again.

EDIT - adding info from the comments:

The problems appear to have become worse through progressive versions of Mathematica.

V10.0 (Linux): My colleague managed to generate hi-res images with desired results on our institute's high-performance cluster, although rendering took an abnormally long time.

V10.1 and V10.2, (Win7x64 professional): Rendering fails for combinations of Raster3D, Opacity, and a Polygon or Cuboid at high resolution, but takes a long time, yet gives a correct result for lower resolutions (ImageSizes). For a higher resolution on 10.2 the output cell is generated immediately, but is incorrect:

bug

Note the few pixels in the top-left of the output cell, which are of the color of the Raster3D.

V10.4: According to AlexeyPopkov (link), combining Raster3D and Point without any mention of Opacity now crashes the front-end. This is a different, but seemingly related problem. It does not occur in 10.1 and 10.2. Attempting to render my image in 10.4 on the institute's cluster quickly consumed 0.1 TB of memory without results and froze the front end. At this point we killed the process, but, presumably, it would have led to a crash of the front end.

LLlAMnYP
  • 11,486
  • 26
  • 65
  • Doesn't Raster3D[] work? – J. M.'s missing motivation Jul 29 '16 at 12:52
  • 1
    @J.M. For my bigger problem I have used various combinations of Image3D and/or Show/Graphics3D@*Raster3D etc, etc. In the end Show always gives a Graphics3D[{Raster3D[...], Opacity[.6], Cuboid[...]}] or similar. If you have a concrete working example, please do share. A colleague managed to generate the image on our institute's grid with MMA 10.1. Contrary to this, MMA 10.4 consumed 0.1 TB of memory on the MWE, before we killed the process. – LLlAMnYP Jul 29 '16 at 13:25
  • 1
    I also had a problem rendering Raster3D intersecting with Point using Mathematica 10.4.1 for this answer (the bottom image): it simply crashed the FrontEnd and I was forced to use version 10.0.1 which works fine. Your example also crashes my FrontEnd. Since you can't render also with versions 10.2 and 10.4, I assume the bug was introduced in version 10.2 and become even worse in the latest release. I have added the appropriate tags and the header. – Alexey Popkov Aug 01 '16 at 05:39
  • @AlexeyPopkov I can render a Point inside a Raster3D just fine on MMA 10.2. As I can also render a cuboid. The problem arises when I introduce Opacity[.6], and it also happens in 10.1. I think your edit is somewhat inaccurate. – LLlAMnYP Aug 01 '16 at 09:14
  • @LLlAMnYP Feel free to rollback my edit. It looks like the problem you describe may be separate from the crashes I experience with version 10.4.1 (but may be not - we can't be sure). In the previous comment you wrote that MMA 10.4.0 takes a lot of memory, so it doesn't crash? So you have a wrong rendering with versions 10.1 and 10.2 and the memory issue with version 10.4.0? Please include this information in the question and also a screenshot(s) the FrontEnd with "an empty box with a tiny little square" instead of the expected output in order to make the question more precise. – Alexey Popkov Aug 01 '16 at 09:26
  • @AlexeyPopkov your edit is not completely wrong just not fully accurate, I reckon these problems are related and were in part certainly introduced earlier than 10.1. The memory problem does not mean, that in the end I got a desirable result, as I said, we killed the process. I'll add details a bit later. – LLlAMnYP Aug 01 '16 at 09:34
  • With version 11.1.0 on Windows 7 x64 the code Show[{i3d, Graphics3D[{FaceForm[Opacity[.6]], Cuboid[{3, 3, 3}]}]}] still crashes the FrontEnd. – Alexey Popkov Apr 25 '17 at 15:13
  • @AlexeyPopkov thanks for the feedback. I've asked WRI for clarification. – LLlAMnYP Apr 26 '17 at 08:38
  • @AlexeyPopkov please see update – LLlAMnYP Apr 27 '17 at 06:03
  • With version 11.1.1 on the same machine I still get the crash. I don't understand what they mean by "improved" behavior. And this bug is also still here. – Alexey Popkov Apr 27 '17 at 06:10
  • @Alexey well, it seems we have 11.1.1 now available at the institute, so I'll give it a spin today. – LLlAMnYP Apr 27 '17 at 06:19

1 Answers1

4

With Mathematica 10.4.1 on Windows 7 x64 I get FrontEnd crash with your code by default but switching to "Graphics3DRenderingEngine" -> "BSPTree" produces the expected output which is relatively responsible (comparing to the Image3D):

SeedRandom[10]
i3d = 1/4 RandomReal[1, {5, 5, 5}] // Image3D

image3d

Style[Show[{i3d, Graphics3D[{FaceForm[Opacity[.6]], Cuboid[{3, 3, 3}]}]}], 
 RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}]

graphics3d

The option RenderingOptions -> {"Graphics3DRenderingEngine" -> "Software"} produces the same but seems to be even slower.

An attempt to Export this as PNG with ImageSize -> {2400, 1600} crashed my video driver and I got not responding FrontEnd taking 100% CPU time of one of my cores. So at least my graphical card doesn't allow to render such a large image.

As a workaround you can try to apply an incremental rendering technique. This post of mine (see the "EDIT 4" section) shows Inset-based approach, another method is suggested by Vitaliy Kaurov (search for "3dImagePartitionExport.nb" in this Wolfram Community thread).

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
  • Woah. I just added the details. Did you pass the ImageSize option to Export? What happens if you pass it to Show? +1 for the option, I'll toy with that. – LLlAMnYP Aug 01 '16 at 09:58
  • I passed the option via Show as in the question. I have just added possible workarounds at the bottom of my answer. – Alexey Popkov Aug 01 '16 at 10:00
  • 1
    Your workaround (I mean the non-default rendering engine) with hi-res rendering on 10.2 works for me. – LLlAMnYP Aug 01 '16 at 10:05
  • For the record, the cluster managed fine for a {4800,3200} resolution in 10.0. I don't know the details of their GPU though. – LLlAMnYP Aug 01 '16 at 10:07
  • And I have just verified, that the non-default engine also works ok for my larger problem, not just the MWE, though it did freeze the notebook for about a minute. I think, this is grounds to accept the answer, pending a future answer that reports a bugfix. – LLlAMnYP Aug 01 '16 at 10:12
  • @LLlAMnYP Please report this issue to the tech support with a link to this thread (they may not be informed otherwise). – Alexey Popkov Aug 01 '16 at 10:15
  • Done, updated OP. – LLlAMnYP Aug 01 '16 at 10:24
  • I don't remember if I ever mentioned this explicitly, but my machine does not experience this 'An attempt to Export this as PNG with ImageSize -> {2400, 1600} crashed my video driver...' issue. Export at high-res with non-default engine works fine. – LLlAMnYP Apr 26 '17 at 08:42
  • @LLlAMnYP The critical ImageSize strongly depends on hardware (and may be also on drivers). You could try higher value, for example, ImageSize -> 6000 and check whether it will lead to the crash or not. I'm experiencing this crash for a long time. – Alexey Popkov Apr 26 '17 at 08:48
  • Even Export["Z:\\temp\\test.png", Style[Show[{i3d, Graphics3D[{FaceForm[Opacity[.6]], Cuboid[{3, 3, 3}]}]}, ImageSize -> {6000, 4000}], RenderingOptions -> {"Graphics3DRenderingEngine" -> "BSPTree"}]] couldn't cause a crash, though the front end froze for a few tense seconds. – LLlAMnYP Apr 26 '17 at 09:22