7
$\begingroup$

Let us say that we have the following example from the Texture[] help page, modified with FaceForm[] to get different textures for the inner and outer faces:

ParametricPlot3D[{1.16^v Cos[v] (1 + Cos[u]), -1.16^v Sin[
    v] (1 + Cos[u]), -2 1.16^v (1 + Sin[u])}, {u, 0, 2 Pi}, {v, -15, 
  6}, PlotStyle -> 
  Directive[Specularity[White, 30], 
   FaceForm[Texture[ExampleData[{"ColorTexture", "WhiteMarble"}]], 
    Texture[ExampleData[{"ColorTexture", "Roof"}]]]], 
 TextureCoordinateFunction -> ({#4, 2 #5} &), Lighting -> "Neutral", 
 Mesh -> None, PlotRange -> All]

but we want to have diferent TextureCoordinateFunction for the inside and outside faces, how can this be done?

enter image description here

$\endgroup$
7
$\begingroup$
ClearAll[f]
f[u_, v_] := {1.16^v Cos[v] (1 + Cos[u]), 
   -1.16^v Sin[v] (1 + Cos[u]), -2 1.16^v (1 + Sin[u])}

t1 = ExampleData[{"ColorTexture", "WhiteMarble"}];
t2 = ExampleData[{"ColorTexture", "Roof"}];

plotstyle1 =  Directive[Specularity[White, 30], FaceForm[Texture[t1], None]];
plotstyle2 =  Directive[Specularity[White, 30], FaceForm[None, Texture[t2]]];

tcf1 = {#4, 2 #5} &;
tcf2 = {#5, #4} &;

One possible way: Make two copies of the surface f (first with the options PlotStyle -> plotstyle1 and TextureCoordinateFunction -> tcf1, the second with PlotStyle -> plotstyle2 and TextureCoordinateFunction -> tcf2) and combine with Show:

{p1, p2} = ParametricPlot3D[f[u, v], {u, 0, 2 Pi}, {v, -15, 6}, 
     PlotStyle -> #, TextureCoordinateFunction -> #2, 
     Lighting -> "Neutral", Mesh -> None, PlotRange -> All]& @@@
 {{plotstyle1, tcf1}, {plotstyle2, tcf2}};


Show[p1, p2] 

enter image description here

$Version
"11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"
$\endgroup$
3
  • $\begingroup$ I don't know why Show[] does not work in 12.3.1. I have test in Windows, Linux and Wolfram Cloud. $\endgroup$
    – cvgmt
    Oct 2 '21 at 0:30
  • $\begingroup$ @cvgmt, I added version information. It looks like some things changed in version 12.+; PlotStyle ->FaceForm[ Texture[img], None] works as expected but PlotStyle ->FaceForm[ None, Texture[img]] does not (Wolfam Cloud). $\endgroup$
    – kglr
    Oct 2 '21 at 2:49
  • $\begingroup$ Another question is that the Lighting -> "Neutral" seems doesn't take effect in Show[]. $\endgroup$
    – cvgmt
    Oct 2 '21 at 2:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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