tylermorganwall / rayshader

R Package for 2D and 3D mapping and data visualization
https://www.rayshader.com/
2.05k stars 211 forks source link

sphere_shade and water issues #17

Closed Euconnus closed 5 years ago

Euconnus commented 5 years ago

Hello guys,

First of all big, BIG thanks for this beautiful package ! Awesome work.

Almost everything works perfect in my tests, except for two functions that always throw error messages. As they are useful and major functions, this is quite annoying :

Error in temp[2:(nrow(temp) - 1), 2:(ncol(temp) - 1)] <- heightmap : number of items to replace is not a multiple of replacement length

Error in if (heightmap2[i] < waterheight) { : missing value where TRUE/FALSE needed

Do you have any idea how to avoid these "crashes" ?

tylermorganwall commented 5 years ago

Hi, It looks like there is an issue with your dataset. Does the code work on the montereybay dataset included with rayshader?

Euconnus commented 5 years ago

Hi, Yes it works fine with montereybay. I think the first issue was I was using sphere_shade as the other shading functions though the return value isn't the same, and I'm not quite sure what "a square matrix indicating the spherical texture mapping" exactly is. Now I can get the function working but the result is quite surprising. I already have a texture for the elevation map, and I can't keep it unmodified once sphere_shade is called, while the other shading procedures allow to keep the texture unmodified and add the shading. I still can't understand the second issue with water though... The water still appears despite the error message, but just the surface, no water line and no filling.

gustavo-etal commented 5 years ago

I am trying it out but I am not sure why this background is here and why the zoom is not working image

tylermorganwall commented 5 years ago

Hi, Yes it works fine with montereybay. I think the first issue was I was using sphere_shade as the other shading functions though the return value isn't the same, and I'm not quite sure what "a square matrix indicating the spherical texture mapping" exactly is. Now I can get the function working but the result is quite surprising. I already have a texture for the elevation map, and I can't keep it unmodified once sphere_shade is called, while the other shading procedures allow to keep the texture unmodified and add the shading. I still can't understand the second issue with water though... The water still appears despite the error message, but just the surface, no water line and no filling.

I really need a reproducible example to hunt down any bugs--I'm not exactly sure what's causing your problem, but it would be easier to diagnose if you can provide the dataset and the exact code used to produce the error.

tylermorganwall commented 5 years ago

I'm going to close this--if you are still having an issue and can post a reproducible example, feel free to re-open.