5
$\begingroup$

I'm getting a white solid instead of a solid with texture, I'm not sure what is wrong:

RegionPlot3D[M, {a, -3, 3}, {c, -3, 3}, {d, -3, 3}, PlotPoints -> 100,
  PlotStyle -> Directive[Texture[ExampleData[{"Texture", "Bricks2"}]]]

Here M is the solid defined by:

M:= (a < 0 && ((c < 0 && (d < 0 || d > -2 a - c)) || (c > 
        0 && (d < -c || d > -2 a)))) || (a > 
    0 && ((c < 0 && (d < -2 a || d > -c)) || (c > 
        0 && (d < -2 a - c || d > 0))))
$\endgroup$
1
  • 1
    $\begingroup$ Adding TextureCoordinateFunction -> ({#1, #2, #3} &), Lighting -> "Neutral", Mesh -> False works pretty well. I'm holding off on writing an answer though, hoping that someone can explain how texture coordinates work. The rule of thumb seems to be that {x,y,z} i.e. cartesian coordinates work. $\endgroup$
    – C. E.
    Jun 13, 2014 at 19:45

1 Answer 1

5
$\begingroup$
M := (a <  0 && ((c < 0 && (d < 0 || d > -2 a - c)) || (c >  0 && (d < -c || d > -2 a)))) || (a > 0 && ((c < 0 && (d < -2 a || d > -c)) || (c >  0 && (d < -2 a - c || d > 0))))

RegionPlot3D[M, {a, -3, 3}, {c, -3, 3}, {d, -3, 3}, 
 Lighting -> "Neutral", Mesh -> False, PlotPoints -> 10, 
 PlotStyle :> Texture[ExampleData[{"ColorTexture", "WhiteMarble"}]], 
 TextureCoordinateScaling -> True]

enter image description here

RegionPlot3D[M, {a, -3, 3}, {c, -3, 3}, {d, -3, 3}, 
 Lighting -> "Neutral", Mesh -> False, PlotPoints -> 10, 
 PlotStyle :> Texture[ExampleData[{"Texture", "Bricks2"}]], 
 TextureCoordinateFunction -> ({#1, #2} &)]

enter image description here

EDIT

Sergio's ansatz didn't work because one has to add:

Lighting -> "Neutral"
Mesh -> False

Also, it is necessary to remove Directive.

$\endgroup$
2
  • $\begingroup$ Thanks again! In the second example, why the bricks are in black and white? Is it because Texture instead of ColorTexture does not add any color or is some other option? $\endgroup$ Jun 14, 2014 at 1:24
  • 1
    $\begingroup$ @SergioParreiras - it's because the bricks are supplied only in b&w. In this case you have to use "Texture". With marble it's just the other way around. One has to experiment a little bit here. $\endgroup$
    – eldo
    Jun 14, 2014 at 13:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.