
Aspose.3D for Python via .NET
Python API를 사용하여 3D 모델을 생성, 편집 및 변환
FBX, STL, Discreet3DS, Universal3D, Collada 등으로 변환을 포함한 3D 파일 형식 및 3D 장면 생성, 편집, 처리를 위한 유용한 Python 라이브러리
Aspose.3D for Python via .NET이란 무엇인가요?
Aspose.3D for Python via .NET 는 포괄적이고 안정적인 라이브러리로, 3D 모델링 및 렌더링 소프트웨어를 설치하지 않고도 Python 애플리케이션 내에서 3D 파일 및 모델을 작업할 수 있게 해줍니다. 이 라이브러리는 개발자가 FBX, 3DS, U3D, DAE, glTF, OBJ, STL, DRC, PDF, AMF, PLY 등 다양한 파일 형식의 3D 모델을 쉽게 생성, 읽기, 렌더링, 조작 및 변환할 수 있는 애플리케이션을 만들도록 지원합니다. 또한 이 라이브러리는 대형 및 복잡한 3D 모델에서도 3D 작업이 효율적이고 빠르게 수행되도록 다양한 기술을 사용합니다.
Aspose.3D for Python via .NET은 3D 애니메이션 작업을 위한 여러 중요한 기능을 포함하고 있습니다. 여기에는 키프레임 애니메이션, 스켈레톤 애니메이션, 모프 애니메이션과 같은 3D 애니메이션 생성 및 조작이 포함됩니다. 이를 통해 매력적이고 인터랙티브한 3D 애플리케이션 및 게임을 쉽게 만들 수 있습니다. 이 라이브러리는 3D 모델을 조작하기 위한 다양한 도구와 기능도 제공합니다. 여기에는 3D 모델을 가져오고 내보내는 기능, 3D 모델을 생성 및 편집하는 기능, 그리고 스케일링, 회전, 변환과 같은 다양한 작업을 수행하는 기능이 포함됩니다.
Aspose.3D for Python via .NET은 .NET 프레임워크 위에 구축되었으며, Python을 .NET 구현인 IronPython을 사용하여 사용할 수 있습니다. 다양한 3D 파일 형식을 지원하고 3D 모델을 조작 및 애니메이션화하기 위한 풍부한 기능을 제공하므로, 애플리케이션에서 3D 콘텐츠를 다루어야 하는 개발자에게 탁월한 선택입니다.
Aspose.3D for Python via .NET 시작하기
Aspose.3D for Python via .NET 안정 버전을 설치하는 가장 쉬운 방법은 pip를 사용하는 것입니다. 원활한 설치를 위해 다음 명령을 사용하십시오.
Python API를 사용하여 3D 씬 생성 및 로드
Aspose.3D for Python via .NET는 Python 명령을 사용하여 처음부터 새로운 3D 씬을 생성하고 지원되는 모든 파일 형식으로 저장하는 완전한 지원을 포함하고 있습니다. 또한 이 라이브러리는 기존 3D 씬을 읽고, 기존 3D를 수정하며, 3D 씬을 PDF로 저장하고, 비밀번호로 보호된 PDF에서 기존 씬을 열고, 파일 형식을 감지하고, PDF 파일에서 3D 콘텐츠를 추출하며, 3D Obj 파일을 로드하기 전에 로드 옵션을 설정하는 등 다양한 기능을 제공합니다.
Python API를 사용하여 3D 씬 문서를 만드는 방법?
import aspose.threed as a3d
# For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET
# The path to the documents directory.
# Create an object of the Scene class
scene = a3d.Scene()
# Save 3D scene document
scene.Save("document.fbx", a3d.FileFormat.FBX7500ASCII)
Python API를 사용한 3D 씬 렌더링
Aspose.3D for Python via .NET은 소프트웨어 개발자가 자체 Python 애플리케이션 내에서 3D 씬을 로드하고 렌더링할 수 있도록 합니다. 이 라이브러리는 안티앨리어싱, 깊이 효과, 모션 블러 등 고품질 3D 씬 렌더링을 지원합니다. 또한 FBX, OBJ, STL, 3DS 등 다양한 3D 파일 형식의 가져오기 및 내보내기를 지원합니다. 이를 통해 기존 3D 모델을 쉽게 씬에 가져오거나 3D 씬을 호환 가능한 형식으로 내보낼 수 있습니다. 3D 기하학에 대한 그림자 투사 및 수신, 하드웨어 기반 3D 기하학 렌더링, 카메라에서 이미지 형식으로 3D 뷰 렌더링, 3D 씬의 파노라마 뷰 렌더링 등을 지원합니다. 다음 코드 예제는 소프트웨어 개발자가 3D 씬의 파노라마 뷰를 렌더링하고 이미지 형식으로 저장하는 방법을 보여줍니다.
Python을 사용하여 3D 씬의 파노라마 뷰를 렌더링하고 이미지 형식으로 저장하는 방법?
from aspose.pydrawing.imaging import ImageFormat
from aspose.pydrawing import Color
import aspose.threed as a3d
# load the scene
scene = Scene.from_file("vc.glb")
# create a camera for capturing the cube map
cam = a3d.entities.Camera(a3d.entities.ProjectionType.PERSPECTIVE)
cam.near_plane = 0.1
cam.far_plane = 200
cam.rotation_mode = a3d.entities.RotationMode.FIXED_DIRECTION
scene.root_node.create_child_node(cam).transform.set_translation(5, 6, 0);
# create two lights to illuminate the scene
scene.root_node.create_child_node(a3d.entities.Light("", a3d.entities.LightType.POINT).transform.set_translation(-10, 7, -10)
light = a3d.entities.Light()
light.color = Color.cadet_blue
scene.root_node.create_child_node(light).transform.set_translation(49, 0, 49)
# create a renderer
# Create a cube map render target with depth texture, depth is required when rendering a scene.
rt = renderer.render_factory.create_cube_render_texture(a3d.render.RenderParameters(False), 512, 512)
# create a 2D texture render target with no depth texture used for image processing
final = renderer.render_factory.CreateRenderTexture(a3d.render.RenderParameters(False, 32, 0, 0), 1024 * 3 , 1024)
# a viewport is required on the render target
rt.create_viewport(cam, a3d.utilities.RelativeRectangle.from_scale(0, 0, 1, 1))
renderer.render(rt)
# execute the equirectangular projection post-processing with the previous rendered cube map as input
equirectangular = renderer.get_post_processing("equirectangular")
# Specify the cube map rendered from the scene as this post processing's input
equirectangular.input = rt.targets[0]
# Execute the post processing effect and save the result to render target final
renderer.execute(equirectangular, final)
# save the texture into disk
final.targets[0].save("panorama.png", ImageFormat.PNG)
3D 문서에서 애니메이션 작업하기
Aspose.3D for Python via .NET은 소프트웨어 개발자가 Python 라이브러리를 사용하여 3D 문서 내에서 애니메이션을 생성하고 작업할 수 있도록 합니다. 이 라이브러리에는 애니메이션 작업을 위한 다양한 기능이 포함되어 있으며, 예를 들어 애니메이션 씬 렌더링, 3D 파일에서 대상 카메라 설정, 스켈레톤 애니메이션 생성, 모프 타깃 작업 및 여러 애니메이션 블렌딩 등이 있습니다. 다음 예제는 Python 명령을 사용하여 간단한 애니메이션을 만드는 방법을 보여줍니다.
Python API를 사용하여 간단한 애니메이션을 만드는 방법?
import clr
clr.AddReference("Aspose.3D")
from Aspose.ThreeD import *
# create a new scene
scene = Scene()
# create a new camera
camera = Camera()
camera.Name = "Camera"
scene.RootNode.CreateChildNode(camera)
# create a new mesh
mesh = Mesh()
mesh.Name = "Mesh"
vertices = Vector3[]
vertices.append(Vector3(0, 0, 0))
vertices.append(Vector3(0, 1, 0))
vertices.append(Vector3(1, 1, 0))
vertices.append(Vector3(1, 0, 0))
mesh.Vertices = vertices
mesh.Triangles = [0, 1, 2, 0, 2, 3]
# create a new node for the mesh
meshNode = Node()
meshNode.Name = "MeshNode"
meshNode.Translation = Vector3(0, 0, 0)
meshNode.CreateChildNode(mesh)
# add the mesh node to the scene
scene.RootNode.CreateChildNode(meshNode)
# create a new animation track for the mesh node
track = AnimationTrack(meshNode, AnimationTargetType.Translation)
# create a new keyframe at time 0
keyframe1 = Keyframe()
keyframe1.Time = 0
keyframe1.Value = Vector3(0, 0, 0)
track.Keyframes.Add(keyframe1)
# create a new keyframe at time 1
keyframe2 = Keyframe()
keyframe2.Time = 1
keyframe2.Value = Vector3(0, 0, 5)
track.Keyframes.Add(keyframe2)
# create a new animation clip
clip = AnimationClip("Clip")
clip.Duration = 1
clip.Tracks.Add(track)
# add the animation clip to the scene
scene.Animations.Add(clip)
# save the scene to a file
scene.Save("animation.fbx", FileFormat.FBX7400ASCII)
Python API를 사용한 폴리곤 작업
Aspose.3D for Python via .NET은 소프트웨어 개발자가 Python 애플리케이션 내에서 3D 모델에 폴리곤 메쉬를 추가하고 관리할 수 있도록 합니다. 이 라이브러리에는 폴리곤 메쉬 관리와 관련된 다양한 기능에 대한 지원이 포함되어 있으며, 파일에서 폴리곤 메쉬를 로드하고, 폴리곤 메쉬를 생성하며, 3D 모델의 모든 폴리곤을 삼각형으로 변환하고, 폴리곤 메쉬를 파일로 내보내는 등 여러 기능을 제공합니다. 다음 예제는 사용자가 Mesh 객체를 생성하고 정점과 면을 추가하여 폴리곤 메쉬를 만드는 방법을 보여줍니다.
Python API를 사용하여 폴리곤 메쉬를 만드는 방법?
# Create a mesh
mesh = Mesh()
# Add vertices
mesh.Vertices.Add(Vector3(0, 0, 0))
mesh.Vertices.Add(Vector3(0, 0, 1))
mesh.Vertices.Add(Vector3(0, 1, 0))
mesh.Vertices.Add(Vector3(1, 0, 0))
# Add faces
mesh.Faces.AddPolygonFace(0, 1, 2)
mesh.Faces.AddPolygonFace(0, 1, 3)
mesh.Faces.AddPolygonFace(0, 2, 3)
mesh.Faces.AddPolygonFace(1, 2, 3)
# Export the polygon mesh to a file
# Create a scene and add the mesh to it
scene = Scene()
scene.RootNode.CreateChildNode(mesh)
# Save the scene to a file
scene.Save("mesh.obj", FileFormat.WavefrontOBJ)
