Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ListSurfacePlot3D[Import["inputImage.obj", "VertexData"],
- PlotStyle -> Texture[texture], Mesh -> None, MaxPlotPoints -> 80,
- TextureCoordinateFunction -> ({#1, -#2, #3} &)]
- Graphics3D[
- {EdgeForm[],
- Texture[texture],
- GraphicsComplex[mesh,
- Polygon[polygon, VertexTextureCoordinates -> mesh]]}]
- Import["inputImage.ply", "UserExtensions"][[2]]
- Import["inputImage.ply", "UserExtensions"][[3]]
- "texture_u" -> {..}
- "texture_v" -> {..}
- texturecoord = {Import["inputImage.ply", "UserExtensions"][[2]][[2]],
- Import["inputImage.ply", "UserExtensions"][[3]][[2]]} // Transpose
- Graphics3D[
- {EdgeForm[],
- Texture[texture],
- GraphicsComplex[mesh,
- Polygon[polygon, VertexTextureCoordinates -> mesh]]}]
- ListSurfacePlot3D[
- Import["inputImage.obj", "VertexData"],
- PlotStyle -> Texture[texture], Mesh -> None, MaxPlotPoints -> 80,
- TextureCoordinateFunction -> (If[#3 > 0.3, {0.7 #1 + 0.15, -#2 - 0.06}, {0.5, 0.9}] &),
- Lighting -> "Neutral"]
- importOBJ[objfile_String, texturefile_String,
- opts : OptionsPattern[]] :=
- Module[{image, raw, verts, tverts, pgons, vertcoords},
- image = Import[texturefile];
- raw = Import[objfile, "Table"];
- If[
- Head /@ {image, raw} =!= {Image, List},
- Missing["NotAvailable"],
- verts = Rest /@ Cases[raw, {"v", __}];
- tverts = Rest /@ Cases[raw, {"vt", __}];
- {pgons, vertcoords} =
- Cases[raw, {"f",
- b__} :> (ToExpression@StringSplit[#, "/"] & /@ {b})] //
- Transpose[#, {2, 3, 1}] &;
- Graphics3D[
- GraphicsComplex[verts,
- {EdgeForm[], Texture[image],
- Polygon[#1,
- VertexTextureCoordinates -> tverts[[#2]]] & @@@
- Thread[{pgons, vertcoords}]}],
- opts]
- ]
- ];
- objfile="https://git.io/viJXD";
- texturefile="http://i.stack.imgur.com/LmTQl.jpg";
- importOBJ[objfile, texturefile, Boxed -> False, Lighting -> "Neutral"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement