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

Export function to GLTF [FEATURE] #290

Open
SbastianGarzon opened this issue Aug 21, 2023 · 2 comments
Open

Export function to GLTF [FEATURE] #290

SbastianGarzon opened this issue Aug 21, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@SbastianGarzon
Copy link

Export function to GLTF

Hello, I'm working on a solution to integrate rayshader models into virtual reality environments (e.g., A-frame). I'm wondering if it is possible to have a save_gltf() function. You mentioned in an old issue that you have developed a function for this task.

writeWebGL currently is fairly limited in its utility--It only supports 65536 vertices per object, so it's not ideal given map dimensions will be limited to a maximum of 256x256. I've got a glTF 2.0 output function written that will eventually be included that has no such limitations, so that's going to form the basis of a rglwidget() replacement that could be used on RStudio server.

Originally posted by @tylermorganwall in #27 (comment)

@SbastianGarzon SbastianGarzon added the enhancement New feature or request label Aug 21, 2023
@dmurdoch
Copy link

dmurdoch commented Dec 2, 2023

Have you tried rgl2gltf::writeGLB?

@SbastianGarzon
Copy link
Author

Hi @dmurdoch,

I'm trying this approach, following your example here

volcano %>%
  sphere_shade(texture = "desert") %>%
  plot_3d(volcano, zscale = 10, fov = 0, theta = 135, phi = 45, zoom = 0.75, windowsize = c(1000, 800))

# Capture the rgl scene
scene <- rgl::rglwidget()

# Convert rgl scene to GLTF 
gltf <- rgl2gltf::as.gltf(scene)

I'm getting this error:

Error in xyz.coords(x, y, z, recycle = TRUE) :
'x' is a list, but does not have components 'x', 'y' and 'z'

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

No branches or pull requests

2 participants