Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating images from renderer #162

Open
Jakobabs opened this issue Jan 25, 2024 · 0 comments
Open

Error creating images from renderer #162

Jakobabs opened this issue Jan 25, 2024 · 0 comments

Comments

@Jakobabs
Copy link

Jakobabs commented Jan 25, 2024

I'm trying to save a png from the renderer using the example "offscreen-render.html"
Everything works copying the script, but when I change the camera position/rotation other than what is in the example, skinViewer.canvas.toDataURL() results in a blank image. Here is my code:

export async function get_image(skin, cape, arms) {
  const skinViewer = new SkinViewer({
    width: 200,
    height: 300,
    renderPaused: true
  })
  skinViewer.camera.rotation.x = -0.620
  skinViewer.camera.rotation.y = 0.534
  skinViewer.camera.rotation.z = 0.348
  skinViewer.camera.position.x = 30.5
  skinViewer.camera.position.y = 22.0
  skinViewer.camera.position.z = 42.0

  await skinViewer.loadSkin(skin, { model: arms })
  await skinViewer.loadCape(cape)
    
  skinViewer.render()
  const image = skinViewer.canvas.toDataURL()
  skinViewer.dispose()
  return image
}

Does anyone know why changing camera position x to -30.5 breaks the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant