2
$\begingroup$

I'm trying to answer this question where I want to add text covered by a certain opacity region in 3-D to realize the whitened effect.

But to do this, I need to position Text in certain places and avoid them to be rendered first, so I used the techniques given here.

While in normal cases this technique works fine: fine

when there's a Raster3D on scene, all Insets get covered completely while they should be visible but normal Graphics3D primitives are all correctly rendered.

wrong

How can I fix this problem? Thanks!

Note that I want an implementation using Text, not FilledCurves as they would rotate with the reference frame and using Dynamic with FilledCurve is much too resource consuming (If this could be done efficiently, then fine still, just worried about efficiency).

Test code:

Graphics3D[{Opacity@1, Specularity@0, 
  Raster3D[ConstantArray[{1, 1, 1, .1}, {20, 20, 
     20}], {{-1.1, -1.1, -1.1}, {1.1, 1.1, 1.1}}], Opacity@1, 
  Table[Inset[
    Graphics[
     Text[Style["test", 
       Blend[{Green, Orange}, {(1 - x)/2, (1 + x)/2}]]], 
     ImageSize -> Small], {x, 0, 0}], {x, -1, 1, .2}], 
  Table[{Blend[{Red, Blue}, {(1 - x)/2, (1 + x)/2}], 
    Ball[{0, 0, x}, .04]}, {x, -1, 1, .2}]}, 
 Lighting -> {{"Ambient", White}}, Boxed -> False]

Edit 1

A possibly more significant bug found by @happy fish:

Add Opacity@0,Ball[],Opacity@1 to the code, then the opacity of Insets works fine, however, mma gets extremely sluggish when evaluating this or dragging the graphics, sometimes return a totally black image.

WARNING: SAVE EVERYTHING IN MMA BEFORE EXECUTING THIS CODE!!!

$\endgroup$
1
  • 1
    $\begingroup$ Observation: add any graphics primitive with non 1 opacity (should be 0 to produce the desired result) will make the text appear (e.g. add Opacity[0], Ball[]), however, the resulting graphics can freeze Mathematica. Save all your work before trying this. $\endgroup$
    – vapor
    Mar 26, 2017 at 9:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.