rayshader icon indicating copy to clipboard operation
rayshader copied to clipboard

render_highquality will randomly produce colorless results, despite the rgl window 3d object being colored.

Open AlexVMrk opened this issue 1 year ago • 21 comments

Describe the bug When rendering with render_highquality, the render result will be black and white (colorless), despite being colored in the rgl window. Very randomly and rarely it will be colored.

The RGL window looks like this: preview

the render result looks like this: test_plot

Session Info

> sessionInfo()
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] rayvertex_0.10.4 colorspace_2.1-0 MetBrewer_0.2.0  rayshader_0.37.3 stars_0.6-4      abind_1.4-5      lubridate_1.9.3  forcats_1.0.0    stringr_1.5.1    dplyr_1.1.4      purrr_1.0.2     
[12] readr_2.1.5      tidyr_1.3.1      tibble_3.2.1     ggplot2_3.4.4    tidyverse_2.0.0  tigris_2.1       sf_1.0-15       

loaded via a namespace (and not attached):
 [1] gtable_0.3.4       xfun_0.42          htmlwidgets_1.6.4  tzdb_0.4.0         vctrs_0.6.5        tools_4.3.2        generics_0.1.3     curl_5.2.0         parallel_4.3.2     rgl_1.2.8         
[11] proxy_0.4-27       fansi_1.0.6        pkgconfig_2.0.3    KernSmooth_2.23-22 uuid_1.2-0         lifecycle_1.0.4    farver_2.1.1       compiler_4.3.2     progress_1.2.3     munsell_0.5.0     
[21] codetools_0.2-19   htmltools_0.5.7    class_7.3-22       rayimage_0.10.0    pillar_1.9.0       crayon_1.5.2       classInt_0.4-10    iterators_1.0.14   foreach_1.5.2      tidyselect_1.2.0  
[31] digest_0.6.34      stringi_1.8.3      fastmap_1.1.1      grid_4.3.2         cli_3.6.2          magrittr_2.0.3     base64enc_0.1-3    utf8_1.2.4         e1071_1.7-14       withr_3.0.0       
[41] prettyunits_1.2.0  scales_1.3.0       rappdirs_0.3.3     timechange_0.3.0   rayrender_0.32.2   httr_1.4.7         png_0.1-8          hms_1.1.3          knitr_1.45         doParallel_1.0.17 
[51] rlang_1.1.3        Rcpp_1.0.12        glue_1.7.0         DBI_1.2.1          rstudioapi_0.15.0  jsonlite_1.8.8     R6_2.5.1           units_0.8-5       






here is what my code looks like:

# load libraries ----------------------------------------------------------
install.packages("")
library(sf)
library(tigris)
library(tidyverse)
library(stars)
library(rayshader)
library(MetBrewer)
library(colorspace)
library(rayvertex)

# read in data ------------------------------------------------------------

data <- st_read("data/kontur_population_US_20231101.gpkg")


# load states -------------------------------------------------------------

st <- states()

florida <- st |> 
  filter(NAME == "Florida") |> 
  st_transform(crs = st_crs(data))

# check with map ----------------------------------------------------------

florida |> 
  ggplot()+
  geom_sf()

# filter USA data for only Florida via INTERSECTION  -----------------------

st_florida <- st_intersection(data, florida)

# define aspect ratio of bounding box -------------------------------------

bb <- st_bbox(st_florida)

bottom_left <- st_point(c(bb[["xmin"]], bb[["ymin"]])) |> 
  st_sfc(crs = st_crs(data))

bottom_right <- st_point(c(bb[["xmax"]], bb[["ymin"]])) |> 
  st_sfc(crs = st_crs(data))

top_left <- st_point(c(bb[["xmin"]], bb[["ymax"]])) |> 
  st_sfc(crs = st_crs(data))

# check bounding points by plotting ---------------------------------------


florida |> 
  ggplot()+
  geom_sf()+
  geom_sf(data = bottom_left, color = "blue")+
  geom_sf(data = bottom_right, color = "red")+
  geom_sf(data = top_left, color = "green")


width <- st_distance(bottom_left, bottom_right)
height <- st_distance(bottom_left, top_left)


# handle conditions of width or height being the longer side --------------


if(width > height){
  w_ratio <- 1
  h_ratio <- height / width
} else{
  h_ratio <- 1
  w_ratio <- width / height
}

# convert to raster so we can convert to matrix ---------------------------

size <- 1000
florida_rast <- st_rasterize(st_florida, 
                             nx = floor(size * w_ratio),
                             ny = floor(size * h_ratio))

mat <- matrix(florida_rast$population,
              nrow = floor(size * w_ratio),
              ncol = floor(size * h_ratio))

# create color palette ----------------------------------------------------

c1 <- met.brewer("OKeeffe2")
swatchplot(c1)

texture <- grDevices::colorRampPalette(c1, bias = 2)(256)
swatchplot(texture)
# plot that 3D thing! -----------------------------------------------------

rgl::close3d()

mat |> 
  height_shade(texture = texture) |> 
  plot_3d(heightmap = mat,
          zscale = 100,
          solid = FALSE,
          shadowdepth = 0)

render_camera(theta = -20, phi = 45, zoom = .8)



# test render -------------------------------------------------------------

render_highquality(
  filename = "images/test_plot",
  lightaltitude = c(20, 80),
  lightcolor = c(c1[1], "white"),
  lightintensity = c(500, 50),
  lightdirection = 280,
  interactive = FALSE
)


# FINAL RENDER ------------------------------------------------------------

outfile <- "images/final_plot_3.png"


{
  start_time <- Sys.time()
  cat(crayon::cyan(start_time), "\n")
  if(!file.exists(outfile)){
    png::writePNG(matrix(1), target = outfile)
  }
  render_highquality(
    filename = outfile,
    lightaltitude = c(20, 80),
    lightcolor = c(c1[1], "white"),
    lightintensity = c(600, 100),
    lightdirection = 280,
    interactive = FALSE,
    samples = 350, 
    width = 7000,
    height = 7000
  )
  
  end_time <- Sys.time()
  diff <- end_time - start_time
  cat(crayon::cyan(diff), "\n")
}


AlexVMrk avatar Feb 24 '24 20:02 AlexVMrk

Here is a video of the issue: https://www.youtube.com/watch?v=CW3hX_3JOVI&embeds_referring_euri=https%3A%2F%2Fmail.google.com%2F&embeds_referring_origin=https%3A%2F%2Fmail.google.com&source_ve_path=MjM4NTE&feature=emb_title

AlexVMrk avatar Feb 24 '24 21:02 AlexVMrk

I am experiencing the same issue. I run the sample code from this github page https://github.com/milos-agathon/3d-forest-type-map/blob/main/R/main.r

And I got the right output and rendered image (just like the tutorial).

But when I tried my own data, I get this in the rgl device: image

but this is my rendered image: test-refugia-3d

I am not sure why.

I have only tweaked the code in ways that allow me to improve speed. but my final rendering code is:

rayshader::render_highquality( samples = 128, #def 128 filename = "plots/test-refugia-3d.png", preview = FALSE, light = FALSE, environment_light = "air_museum_playground_4k.hdr", intensity_env = 2, rotate_env = 1, interactive = FALSE, parallel = TRUE, #if false uses all available cores to render width = w, height = h )

Even when removing the environment_light and using the default, my whole map is green.

francisvolh avatar Feb 29 '24 00:02 francisvolh

Do you have an example that does not require a special dataset that reproduces this issue?

tylermorganwall avatar Mar 01 '24 00:03 tylermorganwall

Hello Tyler,

I have just done a test to try to replicate the issue. Funnily enough, the first render came out good. But I did it with the lowest parameters. I run it s second time, and 3 more times, even with the same lowest settings, and it never came up again. Examples here. and code and files to reproduce below.

Lowest setting first render test-git-3d

More detailed settings test-git-3d2

Fourth run of same initial lower settings test-git-3d4

img <- png::readPNG("test_3d_01.png")

elevation <- terra::rast("elevation_cropped.tif")

elmat <- rayshader::raster_to_matrix(
  elevation
)



h <- nrow(elevation)
w <- ncol(elevation)
{

  begin_time <- Sys.time()
  elmat |>
    rayshader::height_shade(
      texture = colorRampPalette(
        "white"
      )(512) #any number of values you actually want
    ) |>
    rayshader::add_overlay(
      img,
      alphalayer = .9, # how transparent the raster image is
      alphacolor = "white" # should correspond to height_shade above
    ) |>
    rayshader::add_shadow(
      rayshader::lamb_shade(
        elmat,
        zscale = 50,
        sunaltitude = 90,
        sunangle = 315,
      ), max_darken = .25
    ) |>
    rayshader::add_shadow(
      rayshader::texture_shade(
        elmat,
        detail = .2, ### MOVED to 0.5 , then back to 0.2 may reduce this closer to 0 and it may reduce computation time!!!!!
        brightness = 90, 
        contrast = 80,
      ), max_darken = .1
    ) |>
    rayshader::plot_3d(
      elmat,
      zscale = 40, 
      solid = FALSE,
      shadow = TRUE,
      shadow_darkness = 1,
      background = "white",
      windowsize = c(
        w / 5, h / 5
      ),
      zoom = .5,
      phi = 85,
      theta = 0 
    )
  end_time <- Sys.time()
  print(paste0("Rayshader process 1 time ", round(difftime(end_time, begin_time, units = "mins"),2), " minutes"))
}



#tweaking to try to fix
{
  begin.time <- Sys.time()
  
  rayshader::render_highquality(
    samples =32, # MOVED TO 16 to speed up
    filename = "test-git-3d4.png",
    preview = FALSE,
    lightcolor = "white",
    light = TRUE,
    #environment_light = "air_museum_playground_4k.hdr",
    intensity_env = 2,
    rotate_env = 1,
    interactive = FALSE,
    parallel = TRUE, #if false uses all available cores to render
    width = w/5, height = h/5 ### CHANGED to higher setting : dont divide to increase size of image!!!!!!!!!!
  )
  end_time <- Sys.time()
  
  print(paste0("Rendering process time ", round(difftime(end_time, begin.time, units = "mins"),2), " minutes" ))
}

#test-git-3d.png 0.2 32 w/5 h/5

#test-git-3d2.png 0.2 32 w h

#test-git-3d3.png 0.2 32 w/10 h/10

I have tried commenting what I changed or moved to change the settings.

Edit: I restarted my computer (today, next day of previous images in this comments) thinking it may be some residual memory issue, but it did not solve it. So, I tried again a 1st rendering with good quality settings, and it came out all "grayish" when the rgl window is coloured correctly (as shown initially). But either way... it does look like some sort of bug.

next day image 1st render: test-git-3d4

I rendered a second time, without "closing" the rgl window (still showing the good colour pattern) and reduced the rendering parameters (samples to 16 , from 64, and h and w divided by 5) and still came out gray-ish with pixels.

next day image second render, lower settings: test-git-3d4 Unlike last night that I did get at least 1 low quality render with the right colour pattenrs ("Lowest setting first render", above), today nothing comes out right. The Original issue post title says "randomly", so it seems to me to be like now. Honestly, no clue. (end of Edit)

I have linked the files here, as I didn't know how to attach them. This would be the only two you need to reproduce my output or issue. I hope this helps to figure out what is going on. Thanks!

Elevation raster https://drive.google.com/file/d/12yezqqNutfD19eyxJmbL9WqvwTdcjT3e/view?usp=sharing

img (png file to overlay)

https://drive.google.com/file/d/1Ivb0uyZYgZZ3Z2e162WsEutSqgYDz2kL/view?usp=drivesdk

francisvolh avatar Mar 01 '24 03:03 francisvolh

@francisvolh The second file is the TIF again: can you provide the PNG overlay?

tylermorganwall avatar Mar 02 '24 02:03 tylermorganwall

Apologies for that. I just updated the link. Please let me know if it works now! Thanks a lot again!

francisvolh avatar Mar 02 '24 03:03 francisvolh

most commonly the very first render (ususally low quality) will come out colored, any following attempts to render at high or low quality will be either:

  1. completely colorless (black and white) or 2) only lighting is rendered, and not the density spectrum

AlexVMrk avatar Mar 03 '24 18:03 AlexVMrk

Can you output the result of:

str(convert_rgl_to_raymesh())

when you have a render that isn't being colored in? And can you see if the file(s) at the location specified in the diffuse_texname entries in materials exist?

tylermorganwall avatar Mar 05 '24 02:03 tylermorganwall

Hello @tylermorganwall

Done. The rgl file, was fine, then the rendered file was all dark grey (no colors).

I looked for the files in the folder specified by diffuse_texname and they do exist. The specific file listed, is a blank png. There is another, which looks like the rgl image, with a larger size, and its basically the image from which the render should come but with no shades or the right light (although the original dimensions of the rgl device, as my rendered image should have been a bit smaller, but high quality, 128 samples) .

I tried it in 2 different laptops, just in case it was a laptop specific issue. And same result.

Also, I updated both laptops with the latest github versions of the pacakges today.

Attached is a screenshot of the files in the folder from diffuse_texname and the str() results image

Surely there is something going on, not sure why this is happening in my system (or the OP's system as well). Thanks

Francis

francisvolh avatar Mar 05 '24 18:03 francisvolh

grey render;

result of the requested command:

str(convert_rgl_to_raymesh())
List of 6
 $ shapes         :List of 2
  ..$ :List of 6
  .. ..$ indices           : num [1:4318030, 1:3] 2173 2174 5242 5243 5243 ...
  .. ..$ norm_indices      : num [1:4318030, 1:3] 2173 2174 5242 5243 5243 ...
  .. ..$ tex_indices       : num [1:4318030, 1:3] 2173 2174 5242 5243 5243 ...
  .. ..$ material_ids      : num [1:4318030] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ has_vertex_tex    : logi [1:4318030] TRUE TRUE TRUE TRUE TRUE TRUE ...
  .. ..$ has_vertex_normals: logi [1:4318030] TRUE TRUE TRUE TRUE TRUE TRUE ...
  ..$ :List of 6
  .. ..$ indices           : num [1:2, 1:3] 0 3 1 4 2 5
  .. ..$ norm_indices      : num [1:2, 1:3] 0 3 1 4 2 5
  .. ..$ tex_indices       : num [1:2, 1:3] 0 3 1 4 2 5
  .. ..$ material_ids      : num [1:2] 0 0
  .. ..$ has_vertex_tex    : logi [1:2] TRUE TRUE
  .. ..$ has_vertex_normals: logi [1:2] TRUE TRUE
 $ vertices       :List of 2
  ..$ : num [1:21490000, 1:3] -1534 -1534 -1532 -1532 -1530 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:3] "x" "y" "z"
  ..$ : num [1:6, 1:3] 1842 1842 -1841 -1841 1842 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:3] "x" "y" "z"
 $ texcoords      :List of 2
  ..$ : num [1:21490000, 1:2] 0 0.000326 0.000652 0.000978 0.001303 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "s" "t"
  ..$ : num [1:6, 1:2] 1 1 0 0 1 0 1 0 0 1 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "s" "t"
 $ normals        :List of 2
  ..$ : num [1:21490000, 1:3] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:3] "x" "y" "z"
  ..$ : num [1:6, 1:3] 0 0 0 0 0 0 1 1 1 1 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:3] "x" "y" "z"
 $ materials      :List of 2
  ..$ :List of 1
  .. ..$ :List of 29
  .. .. ..$ diffuse             : num [1:3] 1 1 1
  .. .. ..$ ambient             : num [1:3] 0 0 0
  .. .. ..$ specular            : num [1:3] 1 1 1
  .. .. ..$ transmittance       : num [1:3] 1 1 1
  .. .. ..$ emission            : num [1:3] 0 0 0
  .. .. ..$ shininess           : num 50
  .. .. ..$ ior                 : num 1
  .. .. ..$ dissolve            : num 1
  .. .. ..$ illum               : num 1
  .. .. ..$ ambient_texname     : chr ""
  .. .. ..$ diffuse_texname     : chr "C:\\Users\\myName\\AppData\\Local\\Temp\\RtmpGin94K\\file3c5c19cf58cb.png"
  .. .. ..$ bump_texname        : chr ""
  .. .. ..$ emissive_texname    : chr ""
  .. .. ..$ specular_texname    : chr ""
  .. .. ..$ normal_texname      : chr ""
  .. .. ..$ diffuse_intensity   : num 1
  .. .. ..$ bump_intensity      : num 1
  .. .. ..$ specular_intensity  : num 1
  .. .. ..$ emission_intensity  : num 1
  .. .. ..$ ambient_intensity   : num 1
  .. .. ..$ culling             : num 1
  .. .. ..$ type                : chr "color"
  .. .. ..$ translucent         : logi TRUE
  .. .. ..$ toon_levels         : num 5
  .. .. ..$ toon_outline_width  : num 0.05
  .. .. ..$ toon_outline_color  : num [1:3] 0 0 0
  .. .. ..$ reflection_intensity: num 0
  .. .. ..$ reflection_sharpness: num 0
  .. .. ..$ two_sided           : logi FALSE
  ..$ :List of 1
  .. ..$ :List of 29
  .. .. ..$ diffuse             : num [1:3] 1 1 1
  .. .. ..$ ambient             : num [1:3] 0 0 0
  .. .. ..$ specular            : num [1:3] 1 1 1
  .. .. ..$ transmittance       : num [1:3] 1 1 1
  .. .. ..$ emission            : num [1:3] 0 0 0
  .. .. ..$ shininess           : num 50
  .. .. ..$ ior                 : num 1
  .. .. ..$ dissolve            : num 1
  .. .. ..$ illum               : num 1
  .. .. ..$ ambient_texname     : chr ""
  .. .. ..$ diffuse_texname     : chr "C:\\Users\\myName\\AppData\\Local\\Temp\\RtmpGin94K\\file3c5c787a3906.png"
  .. .. ..$ bump_texname        : chr ""
  .. .. ..$ emissive_texname    : chr ""
  .. .. ..$ specular_texname    : chr ""
  .. .. ..$ normal_texname      : chr ""
  .. .. ..$ diffuse_intensity   : num 1
  .. .. ..$ bump_intensity      : num 1
  .. .. ..$ specular_intensity  : num 1
  .. .. ..$ emission_intensity  : num 1
  .. .. ..$ ambient_intensity   : num 1
  .. .. ..$ culling             : num 1
  .. .. ..$ type                : chr "color"
  .. .. ..$ translucent         : logi TRUE
  .. .. ..$ toon_levels         : num 5
  .. .. ..$ toon_outline_width  : num 0.05
  .. .. ..$ toon_outline_color  : num [1:3] 0 0 0
  .. .. ..$ reflection_intensity: num 0
  .. .. ..$ reflection_sharpness: num 0
  .. .. ..$ two_sided           : logi FALSE
 $ material_hashes: chr [1:2] "eb865e641849bdf1e2b067b3e24f265e" "9b38a44fc264b5838dc0d15e55142503"
 - attr(*, "class")= chr [1:2] "ray_mesh" "list"

The file in the abovementioned filepath exists, yes, here it is:

file3c5c787a3906

Here is the grey render:

test_plot

AlexVMrk avatar Mar 15 '24 13:03 AlexVMrk

any news:(

AlexVMrk avatar Apr 05 '24 14:04 AlexVMrk

Any updates on this?

Edit: see below for possible workaround.

das-mechaniker avatar May 04 '24 22:05 das-mechaniker

Edit: After further investigation, this was not the only variable causing this issue, therefore the fix may not 100% work.

@TearsRfuel @francisvolh I might have found a temporary fix. I believe this issue may have to do with the sample_method. Try forcing the sample_method to sobol.

sample_method = "sobol"

@tylermorganwall I have run into this issue on Windows as well (tested on mac, no issues) but I have noticed that regardless of sample size, if you specify the sample_method to sobol, it will correctly render colors. Specifying method as sobol-blue or not specifying will cause colorless renderings.

Colors Rendered - sample_method = sobol

render_highquality(
    outfile, 
    sample_method = "sobol",
    samples = 300,
    preview = TRUE,
    parallel = TRUE,
    light = TRUE,
    width = 500, height = 500
  )

No Color Rendered - sample_method = sobol-blue

render_highquality(
    outfile, 
    sample_method = "sobol-blue",
    samples = 300,
    preview = TRUE,
    parallel = TRUE,
    light = TRUE,
    width = 500, height = 500
  )

No Color Rendered - sample_method not specified

render_highquality(
    outfile, 
    samples = 300,
    preview = TRUE,
    parallel = TRUE,
    light = TRUE,
    width = 500, height = 500
  )

sessionInfo()

R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] NatParksPalettes_0.2.0 stars_0.6-5            abind_1.4-5            tigris_2.1            
 [5] colorspace_2.1-0       glue_1.7.0             rayshader_0.38.0       elevatr_0.99.0        
 [9] lubridate_1.9.3        forcats_1.0.0          stringr_1.5.1          dplyr_1.1.4           
[13] purrr_1.0.2            readr_2.1.5            tidyr_1.3.1            tibble_3.2.1          
[17] ggplot2_3.5.1          tidyverse_2.0.0        sf_1.0-16             

loaded via a namespace (and not attached):
 [1] gtable_0.3.5       xfun_0.43          htmlwidgets_1.6.4  tzdb_0.4.0         vctrs_0.6.5       
 [6] tools_4.4.0        generics_0.1.3     curl_5.2.1         parallel_4.4.0     rgl_1.3.1         
[11] proxy_0.4-27       fansi_1.0.6        pkgconfig_2.0.3    KernSmooth_2.23-22 uuid_1.2-0        
[16] lifecycle_1.0.4    farver_2.1.1       compiler_4.4.0     progress_1.2.3     munsell_0.5.1     
[21] codetools_0.2-20   htmltools_0.5.8.1  class_7.3-22       rayimage_0.10.0    Rttf2pt1_1.3.12   
[26] pillar_1.9.0       crayon_1.5.2       extrafontdb_1.0    classInt_0.4-10    magick_2.8.3      
[31] iterators_1.0.14   foreach_1.5.2      tidyselect_1.2.1   digest_0.6.35      stringi_1.8.3     
[36] extrafont_0.19     fastmap_1.1.1      grid_4.4.0         cli_3.6.2          magrittr_2.0.3    
[41] base64enc_0.1-3    utf8_1.2.4         e1071_1.7-14       withr_3.0.0        rappdirs_0.3.3    
[46] prettyunits_1.2.0  scales_1.3.0       timechange_0.3.0   rayrender_0.34.0   httr_1.4.7        
[51] progressr_0.14.0   png_0.1-8          hms_1.1.3          knitr_1.46         rayvertex_0.10.6  
[56] doParallel_1.0.17  rlang_1.1.3        Rcpp_1.0.12        DBI_1.2.2          rstudioapi_0.16.0 
[61] jsonlite_1.8.8     R6_2.5.1           units_0.8-5 

das-mechaniker avatar May 05 '24 22:05 das-mechaniker

Unfortunately this didn't work, although I have tried changing the sample method and sample size before I made my original post, and it would randomly and rarely produce colored results, but nothing fixed it definitively.

AlexVMrk avatar May 06 '24 13:05 AlexVMrk

Can you update to the latest version of rayrender, rayvertex, and rayshader on github and see if this issue is still occurring?

tylermorganwall avatar May 12 '24 01:05 tylermorganwall

Hello @tylermorganwall

I just did, and I got my same old colorless friend. I have reinstalled all packages because I updated to the new R 4.4 anyway. So all brand new install for rayshader and friends.

image

Image on the left is the current open RGL device. Mid is newly produced png after rendering. Leftmost image is an older version (just to compare, it looks slightly different but at this point I can not confirm there might be a couple of tweaks in the parameters).

I went ahead and check the str(convert_rgl_to_raymesh()) for the diffuse_textname file, and it is there, and not blank anymore (unlike before!). file206c758b4e9d

I think this is the file I want now and with good resolution, but no being saved in the working directory! So I guess this is progress!

> sessionInfo()
R version 4.4.0 Patched (2024-05-12 r86534 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] utf8_1.2.4        rayrender_0.34.0  stringi_1.8.3     rgl_1.3.1         hms_1.1.3         digest_0.6.35     magrittr_2.0.3   
 [8] iterators_1.0.14  pkgload_1.3.4     fastmap_1.1.1     jsonlite_1.8.8    foreach_1.5.2     doParallel_1.0.17 processx_3.8.4   
[15] progress_1.2.3    pkgbuild_1.4.4    sessioninfo_1.2.2 urlchecker_1.0.1  ps_1.7.6          promises_1.3.0    fansi_1.0.6      
[22] purrr_1.0.2       scales_1.3.0      codetools_0.2-20  cli_3.6.2         shiny_1.8.1.1     elevatr_0.99.0    rlang_1.1.3      
[29] crayon_1.5.2      munsell_0.5.1     ellipsis_0.3.2    base64enc_0.1-3   remotes_2.5.0     cachem_1.0.8      devtools_2.4.5   
[36] tools_4.4.0       parallel_4.4.0    rayimage_0.10.0   rayvertex_0.10.6  memoise_2.0.1     rayshader_0.38.1  colorspace_2.1-0 
[43] httpuv_1.6.15     curl_5.2.1        vctrs_0.6.5       R6_2.5.1          mime_0.12         png_0.1-8         magick_2.8.3     
[50] lifecycle_1.0.4   stringr_1.5.1     fs_1.6.4          htmlwidgets_1.6.4 usethis_2.2.3     miniUI_0.1.1.1    pkgconfig_2.0.3  
[57] desc_1.4.3        callr_3.7.6       pillar_1.9.0      progressr_0.14.0  terra_1.7-71      later_1.3.2       glue_1.7.0       
[64] profvis_0.3.8     Rcpp_1.0.12       xfun_0.43         knitr_1.46        rstudioapi_0.16.0 xtable_1.8-4      htmltools_0.5.8.1
[71] compiler_4.4.0    prettyunits_1.2.0

francisvolh avatar May 13 '24 15:05 francisvolh

I resolved this issue just deleting all the files inside C:\Users\Username\AppData\Local\Temp\

It's not necessary delete all files but you won't waste your time looking for the exact file(s). This also resolve the majority of the package errors for R windows users.

ArturLourenco avatar May 26 '24 00:05 ArturLourenco

Hello ArturLourenco,

I have done that before, and nothing changed. Not sure why that keeping the Temp files would cause the issue anyway. Any thoughts?

I resolved this issue just deleting all the files inside C:\Users\Username\AppData\Local\Temp\

It's not necessary delete all files but you won't waste your time looking for the exact file(s). This also resolve the majority of the package errors for R windows users.

francisvolh avatar Jun 07 '24 17:06 francisvolh

The only solution that I've found (in RStudio) is to "clear objects from the workspace" and "Free unused R memory" and then re-run the code between each run of render_highquality. Obviously this doesn't help if you're calling render_highquality multiple times but at least it's something.

Lrrrence avatar Jun 07 '24 18:06 Lrrrence

neither clearing the temp folder nor clearing objects/unused memory fixed the issue for me.

AlexVMrk avatar Jun 11 '24 14:06 AlexVMrk

Any advances on this issue?

AlexVMrk avatar Aug 08 '24 14:08 AlexVMrk