简体   繁体   中英

How I can configure "metalness" parameter for the globe render on echarts4r?

Hi and thanks for reading me I'm currently working on a globe made with echarts (inside echarts4r) and would like to set a parameter that I saw in their official documentation, which is: "realisticMaterial.metalness", but so far I couldn't get it to work. In the official documentation displays the parameter as follows: 在此处输入图像描述

I wanted to adapt the code inside echats4r in the following way:

library(echarts4r.assets)
library(echarts4r)

airports <- read.csv(
  paste0("https://raw.githubusercontent.com/plotly/datasets/",
         "master/2011_february_us_airport_traffic.csv")
)

airports |> 
  e_charts(long) |> 
  e_globe(
    viewControl = list(rotateSensitivity = 5),
    realisticMaterial = list(metalness = 1),
    globeOuterRadius = 100
  ) |> 
  e_scatter_3d(lat, cnt, coord_system = "globe", blendMode = 'lighter') |> 
  e_visual_map(inRange = list(symbolSize = c(1, 10))) |> 
  e_color(background = "transparent")

But I haven't been able to get it to work, does anyone know what I could be doing wrong?

Thanks for the help

I'm not sure what you're expecting. (And you asked this quite a while back!)

In order to specify metalness , you have to define what to do with it by specifying the base_texture . (Whether you want to "blend" or "overlay" ...apparently, no default is set.)

Check out the code and corresponding perspectives shown here.

In this first plot, I stopped rotation (just to make images easier), changed the amount of metalness to lighten the image, added roughness so that the metal-like appearance would be more evident, added height_texture , and set the base_texture .

airports |> 
  e_charts(long) |> 
  e_globe(
    viewControl = list(rotateSensitivity = 5,
                       autoRotateSpeed = 0),
    shading = 'realistic',
    height_texture = ea_asset('world topo'),
    realisticMaterial = list(metalness = .4, roughness = .1),
    base_texture = 'blend',
    globeOuterRadius = 100
  ) |> 
  e_scatter_3d(lat, cnt, coord_system = "globe", blendMode = 'lighter') |> 
  e_visual_map(inRange = list(symbolSize = c(1, 10))) |> 
  e_color(background = "transparent")

在此处输入图像描述

在此处输入图像描述

The only difference here is more metalness . The second image (in which I rotated the globe) reflects a bit more of the 'metalness' of it.

airports |> 
  e_charts(long) |> 
  e_globe(
    viewControl = list(rotateSensitivity = 5,
                       autoRotateSpeed = 0),
    shading = 'realistic',
    height_texture = ea_asset('world topo'),
    realisticMaterial = list(metalness = .6, roughness = .1),
    base_texture = 'blend',
    globeOuterRadius = 100
  ) |> 
  e_scatter_3d(lat, cnt, coord_system = "globe", blendMode = 'lighter') |> 
  e_visual_map(inRange = list(symbolSize = c(1, 10))) |> 
  e_color(background = "transparent")

在此处输入图像描述

在此处输入图像描述

Here I've maximized the metalness and the roughness .

airports |> e_charts(long) |> e_globe( viewControl = list(rotateSensitivity = 5, autoRotateSpeed = 0), shading = 'realistic', height_texture = ea_asset('world topo'), realisticMaterial = list(metalness = 1, roughness = 1), base_texture = 'blend', globeOuterRadius = 100 ) |> e_scatter_3d(lat, cnt, coord_system = "globe", blendMode = 'lighter') |> e_visual_map(inRange = list(symbolSize = c(1, 10))) |> e_color(background = "transparent")

在此处输入图像描述

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM