3
$\begingroup$

Suppose I have a graphical output like this:

enter image description here

Is it possible to obtain the shading data (generated by lighting simulation) at each point on the surface with respect to the local co-ordinate chart of each surface?

The code for each surface part:

Spherical part:

ParametricPlot3D[{2 Sqrt[1 - u^2 Sin[v]^2 (1 + Cos[v]^2)], u Sin[2 v],
   2 u Sin[v]}, {u, 0, 1}, {v, -\[Pi], \[Pi]}, PlotRange -> Full, 
 Mesh -> None]

Cylindrical part:

ParametricPlot3D[{1 + Cos[u], 
  Sin[u], (1 + Floor[-v/(Abs[-v] + 1)] - 
      Floor[v/(Abs[v] + 1)]) Max[-Sqrt[4 - 2 (1 + Cos[u])], v]/
    2 + (1 + Floor[v/(Abs[v] + 1)] - Floor[-v/(Abs[-v] + 1)]) Min[
     Sqrt[4 - 2 (1 + Cos[u])], v]/2}, {u, -2, 2}, {v, -4 \[Pi], 
  4 \[Pi]}, PlotRange -> Full, PlotPoints -> 100, Exclusions -> None, 
 Mesh -> None]

Note: I am primarily after the shading data of the spherical part, as the cylindrical part is extremely easy to guess (the shading is constant along the vertical)

$\endgroup$
  • $\begingroup$ does pp = ParametricPlot3D[{2 Sqrt[1 - u^2 Sin[v]^2 (1 + Cos[v]^2)], u Sin[2 v], 2 u Sin[v]}, {u, 0, 1}, {v, -\[Pi], \[Pi]}, PlotRange -> Full, Mesh -> None]; verticesAndNormals = Cases[Normal[pp], Polygon[a_, VertexNormals -> b_] :> Transpose[{a, b}], {0, Infinity}] give what you need? $\endgroup$ – kglr Oct 3 '19 at 17:21
  • $\begingroup$ No, I do not want the normal vectors at each point, I want the RGB value associated at each point on the lighting map. $\endgroup$ – Jack Tiger Lam Oct 4 '19 at 1:13
  • $\begingroup$ @JackTigerLam, Actually, you can draw the surface without frame, make the hi-res image from it and analyze it by the image processing tools. $\endgroup$ – Rom38 May 8 at 6:00

Your Answer

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

Browse other questions tagged or ask your own question.