Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4835 > unrolled thread

applying a real texture in Mathematica

Started byRoger Bagula <roger.bagula@gmail.com>
First post2011-09-08 09:31 +0000
Last post2011-09-16 09:52 +0000
Articles 5 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  applying a real texture in Mathematica Roger Bagula <roger.bagula@gmail.com> - 2011-09-08 09:31 +0000
    Re: applying a real texture in Mathematica Roger Bagula <roger.bagula@gmail.com> - 2011-09-09 08:07 +0000
    Re: applying a real texture in Mathematica Yves Klett <yves.klett@googlemail.com> - 2011-09-09 09:53 +0000
      Re: applying a real texture in Mathematica Roger Bagula <roger.bagula@gmail.com> - 2011-09-12 08:34 +0000
        Re: applying a real texture in Mathematica Roger Bagula <roger.bagula@gmail.com> - 2011-09-16 09:52 +0000

#4835 — applying a real texture in Mathematica

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-09-08 09:31 +0000
Subjectapplying a real texture in Mathematica
Message-ID<j4a21t$441$1@smc.vnet.net>
The idea is to use vertex data in ListSurfacePlot3D[]
to give the surface a rough ( or hairy) look.
I call this the Hairy Asteriod.
The cusp lines on the surface  are where ListSurfacePlot3D[]
"flames" out the worst.

Clear[x1, y1, z1, g1, g, ga, gb, t, p, d, a]
(* surface with cusps : asteroid of rotation*)
x1 = Cos[t]^3*Sin[p];
y1 = Sin[t]^3*Sin[p];
z1 = Cos[p];
w1 = {x1, z1, y1};
g = Flatten[Table[w1, {t, 0, Pi, Pi/50}, {p, -Pi, Pi, 2*Pi/50}], 1];
Length[g]
(* texture generating array*)
d = 0.01;
a[0] = {d, d, d}
a[2] = {d, d, -d}
a[3] = {d, -d, d}
a[4] = {-d, d, d}
a[5] = {-d, d, -d}
a[6] = {-d, -d, d}
a[7] = {-d, d, -d}
a[8] = {-d, -d, -d}
(* applying the texture to the surface*)
g1 = Table[g[[n]] + a[Mod[n, 8]], {n, 1, Length[g]}];
ga = ListSurfacePlot3D[g1, MaxPlotPoints -> 200, Axes -> False,
  Boxed -> False, Mesh -> None,
  PlotStyle -> {Black, Specularity[White, 20]}]
gb = ParametricPlot3D[w1, {t, 0, Pi}, {p, -Pi, Pi}, PlotPoints -> 50,
  PlotRange -> All, PlotStyle -> {LightBlue, Specularity[White, 30]},
  Axes -> False, Boxed -> False, Mesh -> False]
gw = Show[{ga, gb}, PlotRange -> All]
Export["HairyAsteriod.3ds", gw]
Export["HairyAsteriod.obj", gw]
Export["HairyAsteriod.stl", gw]

[toc] | [next] | [standalone]


#4838

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-09-09 08:07 +0000
Message-ID<j4chf8$gml$1@smc.vnet.net>
In reply to#4835
Cusps cause the worst flaming in ListSurfacePlot3D[].
A relatively smooth surface like that of a ring with flattened inside
shows the most texture flaming on the highest curvature
and the best texture on the flattest parts.
A Sinoid ring with a texture:
Clear[x1, y1, z1, g1, g, ga, gb, t, p, d, a]
x1 = Sin[t]*(2 + Exp[1 - Sin[p]]/Exp[2])*(6.75/5)
y1 = Cos[t]*(2 + Exp[1 - Sin[p]]/Exp[2])*(6.75/5)
z1 = Cos[p]
w1 = {x1, z1, y1};
g = Flatten[Table[w1, {t, -Pi, Pi, 2*Pi/50}, {p, -Pi, Pi, 2*Pi/50}],
   1];
Length[g]
d = 0.05;
a[0] = {d, d, d}
a[2] = {d, d, -d}
a[3] = {d, -d, d}
a[4] = {-d, d, d}
a[5] = {-d, d, -d}
a[6] = {-d, -d, d}
a[7] = {-d, d, -d}
a[8] = {-d, -d, -d}
g1 = Table[g[[n]] + a[Mod[n, 8]], {n, 1, Length[g]}];
ga = ListSurfacePlot3D[g1, MaxPlotPoints -> 250, Axes -> False,
  Boxed -> False, Mesh -> None,
  PlotStyle -> {Black, Specularity[White, 20]}]
gb = ParametricPlot3D[w1, {t, -Pi, Pi}, {p, -Pi, Pi},
  PlotPoints -> 65, PlotRange -> All,
  PlotStyle -> {Orange, Specularity[White, 10]}, Axes -> False,
  Boxed -> False, Mesh -> False]
Export["Sinoidring.3ds", gb]
Export["Sinoidring.obj", gb]
Export["Sinoidring.stl", gb]
gw = Show[{ga, gb}, PlotRange -> All]
Export["HairySinoidring250.3ds", gw]
Export["HairySinoidring250.obj", gw]
Export["HairySinoidring250.stl", gw]

[toc] | [prev] | [next] | [standalone]


#4844

FromYves Klett <yves.klett@googlemail.com>
Date2011-09-09 09:53 +0000
Message-ID<j4cnmd$hk9$1@smc.vnet.net>
In reply to#4835
Just a suggestion,

but I am not particularly fond of mathgroup code that Export(s) or
modifies files without really good reason. This might mess up someone's
files or leave undesired (large) files in whatever directory you happen
to work in.

So I'd recommend commenting out the Export statements unless you really
work with the exported stuff later on in the same post.

Regards,
Yves



Am 08.09.2011 11:31, schrieb Roger Bagula:
> The idea is to use vertex data in ListSurfacePlot3D[]
> to give the surface a rough ( or hairy) look.
> I call this the Hairy Asteriod.
> The cusp lines on the surface  are where ListSurfacePlot3D[]
> "flames" out the worst.
> 
> Clear[x1, y1, z1, g1, g, ga, gb, t, p, d, a]
> (* surface with cusps : asteroid of rotation*)
> x1 = Cos[t]^3*Sin[p];
> y1 = Sin[t]^3*Sin[p];
> z1 = Cos[p];
> w1 = {x1, z1, y1};
> g = Flatten[Table[w1, {t, 0, Pi, Pi/50}, {p, -Pi, Pi, 2*Pi/50}], 1];
> Length[g]
> (* texture generating array*)
> d = 0.01;
> a[0] = {d, d, d}
> a[2] = {d, d, -d}
> a[3] = {d, -d, d}
> a[4] = {-d, d, d}
> a[5] = {-d, d, -d}
> a[6] = {-d, -d, d}
> a[7] = {-d, d, -d}
> a[8] = {-d, -d, -d}
> (* applying the texture to the surface*)
> g1 = Table[g[[n]] + a[Mod[n, 8]], {n, 1, Length[g]}];
> ga = ListSurfacePlot3D[g1, MaxPlotPoints -> 200, Axes -> False,
>   Boxed -> False, Mesh -> None,
>   PlotStyle -> {Black, Specularity[White, 20]}]
> gb = ParametricPlot3D[w1, {t, 0, Pi}, {p, -Pi, Pi}, PlotPoints -> 50,
>   PlotRange -> All, PlotStyle -> {LightBlue, Specularity[White, 30]},
>   Axes -> False, Boxed -> False, Mesh -> False]
> gw = Show[{ga, gb}, PlotRange -> All]
> Export["HairyAsteriod.3ds", gw]
> Export["HairyAsteriod.obj", gw]
> Export["HairyAsteriod.stl", gw]
> 

[toc] | [prev] | [next] | [standalone]


#4901

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-09-12 08:34 +0000
Message-ID<j4kg78$kkf$1@smc.vnet.net>
In reply to#4844
On Sep 9, 2:53 am, Yves Klett <yves.kl...@googlemail.com> wrote:
> Just a suggestion,
>
> but I am not particularly fond of mathgroup code that Export(s) or
> modifies files without really good reason. This might mess up someone's
> files or leave undesired (large) files in whatever directory you happen
> to work in.
>
> So I'd recommend commenting out the Export statements unless you really
> work with the exported stuff later on in the same post.
>
> Regards,
> Yves
Thanks for your comments...

[toc] | [prev] | [next] | [standalone]


#4993

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-09-16 09:52 +0000
Message-ID<j4v69b$c7k$1@smc.vnet.net>
In reply to#4901
Working color texture:

x = (Exp[1 + Cos[t]] - 1)/(Exp[2])^3;
y = Sin[t]^3;
ParametricPlot3D[{y*Sin[p], y*Cos[p], 600*x}, {t, -Pi, Pi}, {p, -Pi,
  Pi}, PlotPoints -> 200,    Boxed -> False, Axes -> False,
 PlotStyle -> {LightBlue, Specularity[White, 20]}, Mesh -> False]
g1 = ParametricPlot3D[{y*Sin[p], y*Cos[p], 600*x}, {t, -Pi,
   Pi}, {p, -Pi, Pi}, PlotPoints -> 200,    Boxed -> False,
  Axes -> False, PlotStyle -> {LightBlue, Specularity[White, 20]},
  ColorFunction -> (Hue[2 #4*#5] &)]
(* gives a textured model as obj and mtl files*)
(*Export["SinoidAsteriod.obj", g1]*)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web