dmurdoch/rgl

writeOBJ doesn't save textures/colors

maxkarlsson opened this issue · 1 comments

  • rgl Version: 1.2.4
  • R Version: 4.2.2
  • Platform: Windows version 22H2 (OS Build 22621.2134) (Windows 11)

Hi! when I am saving an .obj from a scene, writeOBJ doesn't keep the colors in the resulting .obj file.

Here is an example:

library(tidyverse)
library(rgl)

points <- 
  tibble(x = rnorm(10),
         y = rnorm(10),
         z = rnorm(10)) %>% 
  mutate(color = colorRampPalette(colors = c("gray", "orangered"))(10))

open3d()
points3d(x = points$x, 
         y = points$y, 
         z = points$z, 
         color = points$color)
writeOBJ("test.obj", withTextures = T, pointRadius = 0.1)
close3d()

This is how the file looks like in the Windows 3D Viewer:
image

Any ideas what the issue might be?

I'm grateful for your help!

This is documented in ?writeOBJ.