Skip to main content

A Python render engine like threejs

Project description

three-py

A Python render engine like threejs(via wgpu).

Introduction

This is a Python render engine build on top of WGPU.

Current status

Under development, many things can change.

Installation

pip install three-py

Requirements

wgpu-py

Usage

This code creates a scene, a camera, and a geometric cube, and animates the cube within the scene for the camera.

Also see the examples.

import three
from wgpu.gui.auto import WgpuCanvas, run

canvas = WgpuCanvas(size=(640, 480), title="wgpu_renderer")

render = three.WgpuRenderer(canvas, parameters={'antialias': True})
render.init()

camera = three.PerspectiveCamera(70, 640 / 480, 0.01, 100)
camera.position.z = 1

scene = three.Scene()

geometry = three.BoxGeometry(0.2, 0.2, 0.2)
material = three.MeshNormalMaterial()

mesh = three.Mesh(geometry, material)
scene.add(mesh)

def loop():
    mesh.rotation.x += 0.01
    mesh.rotation.y += 0.02
    render.render(scene, camera)

render.setAnimationLoop(loop)

run()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

three-py-0.0.2.tar.gz (136.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

three_py-0.0.2-py3-none-any.whl (211.6 kB view details)

Uploaded Python 3

File details

Details for the file three-py-0.0.2.tar.gz.

File metadata

  • Download URL: three-py-0.0.2.tar.gz
  • Upload date:
  • Size: 136.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.9

File hashes

Hashes for three-py-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9482f2e545e4bf74a6d1c45712c2267dcf9a9589192af22dfa595c4f6a3aaefc
MD5 d942bb91cd9e30eaa23e3f51a671153b
BLAKE2b-256 5d8be92d2133c0eb6d6c00de94424f87ac79925d0a8b65a765ed374a4624d852

See more details on using hashes here.

File details

Details for the file three_py-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: three_py-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 211.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.9

File hashes

Hashes for three_py-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 873d085e99de0a4f2dfb7d2ccd8669475f1919e7604f07b4472a667bc6d7e7c5
MD5 14db390f702af972833840c9ec8b02ca
BLAKE2b-256 a183ae47491be097104bdbf6aa9db490e635bbc571cd1c25cc0ec92374f51f25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page