3D Software Rasterizer for R

Overview

rayvertex

R-CMD-check

Rayvertex is a 3D software renderer that allows you to generate 3D visualizations without worrying about hardware requirements or dependencies. It uses rasterization: a method that transforms meshes of triangles into an image. These meshes are specified entirely in R, and can be built either by importing external files, building scenes out of the included objects, or by constructing the mesh yourself. Rayvertex also allows the user to add any number of point lights and directional lights to a scene, and support anti-aliased lines, shadow mapping, transparent (and translucent) objects.

Rayvertex features the following:

  • Multicore tiled rendering
  • User-specified render resolution
  • Multiple material shader types:
    • Diffuse
    • Phong
    • Vertex
    • Toon (cel) shading
    • Flat shading
  • Built in shapes:
    • Sphere, cube, cylinder, segment, cone, arrow, torus, and plane
    • OBJ file support
    • mesh3d support
  • Built-in mesh transformations:
    • Rotation, translation, and scale
  • Support for normal maps, emission maps, ambient maps, and textures
  • Support for multiple point lights and directional lights with shadow mapping
  • Support for multicolor 3D line rasterization (both basic and anti-aliased)
  • Hashed material IDs for efficient memory use
  • Order-independent transparency rendering
  • Orthographic and projective cameras
  • Screen-space ambient occlusion
  • Translucent (tinted) shadows
  • Reflection Maps
  • Refractive Materials
  • Bloom
  • Tone mapping
  • Environment Maps

Meshes and scenes are specified via list structure that contains the following:

  • A list of shapes that each include:
    • An integer matrix of indices
    • (optional) An integer matrix of indices for normal values
    • (optional) An integer matrix of indices for texture coordinates
    • A vector of material IDs, indexing into the following material property list
    • A logical vector, indicating whether each vertex has normals
    • A logical vector, indicating whether each vertex has texture coordinates
  • A list of material properties. Rayvertex looks for the following:
    • Diffuse color
    • Ambient color
    • Specular color
    • Transmittance color
    • Emission color
    • Shininess (specular exponent)
    • Index of refraction (ior)
    • Dissolve (transparency)
    • Illumination model
    • Diffuse Texture Image Filename
    • Ambient Texture Image Filename
    • Emissive Texture Image Filename
    • Ambient Texture Image Filename
    • Normal Texture Image Filename
    • Diffuse Intensity
    • Ambient Intensity
    • Emissive Intensity
    • Ambient Intensity
    • Culling type
    • Shader type
    • Translucency
    • Number of Toon levels
    • Reflection Intensity
  • A 3xN matrix of vertex positions
  • A 2xN matrix of texture coordinates for each vertex
  • A 3xN matrix of normals for each vertex
  • A vector of material hashes. This can save memory by only adding a new material when it does not already exist in the object.

Rayvertex includes a series of helper functions that allow you to generate, translate, and scale meshes.

You can install rayvertex from GitHub with:

# install.packages("devtools")
devtools::install_github("tylermorganwall/rayvertex")

Example

Here, we will render a basic scene. We’ll use the built-in Cornell Box mesh to begin.

library(rayvertex)

generate_cornell_mesh() %>% 
  rasterize_scene()
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .

Let’s add a purple sphere to the center:

mat = material_list(diffuse="purple", type = "phong", ambient="purple", ambient_intensity = 0.2)

generate_cornell_mesh() %>% 
  add_shape(sphere_mesh(position=c(555,555,555)/2, radius=80, material=mat)) %>% 
  rasterize_scene()
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .

Now, the ceiling of the Cornell Box is blocking the directional light. Let’s remove it.

generate_cornell_mesh(ceiling=FALSE) %>% 
  add_shape(sphere_mesh(position=c(555,555,555)/2, radius=80, material=mat)) %>% 
  rasterize_scene()
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .

Let’s add a cylinder and a platform to the bottom of our sphere.

mat2 = material_list(diffuse="grey80", ambient="grey80", ambient_intensity = 0.2)

generate_cornell_mesh(ceiling=FALSE) %>% 
  add_shape(sphere_mesh(position=c(555,555,555)/2, radius=80, material=mat)) %>% 
  add_shape(segment_mesh(start=c(555/2,0,555/2),end=c(555/2,196,555/2), 
                         radius=30, material=mat2)) %>% 
  add_shape(cube_mesh(position=c(555/2,555/2-90,555/2), 
                      scale=c(160,20,160),material=mat2)) %>% 
  rasterize_scene()
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .

Now let’s change the angle of the directional light so it’s angled from the front :

generate_cornell_mesh(ceiling=FALSE) %>% 
  add_shape(sphere_mesh(position=c(555,555,555)/2, radius=80, material=mat)) %>% 
  add_shape(segment_mesh(start=c(555/2,0,555/2),end=c(555/2,196,555/2), 
                         radius=30, material=mat2)) %>% 
  add_shape(cube_mesh(position=c(555/2,555/2-90,555/2), 
                      scale=c(160,20,160),material=mat2)) %>% 
  rasterize_scene(light_info = directional_light(c(0.4,0.2,-1)))
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .

And let’s add all the other basic mesh shapes included in the package (including the included OBJ file and the humface mesh3d object from the Rvcg package):

library(Rvcg)
#> Warning: package 'Rvcg' was built under R version 3.6.2
data(humface)

cols = hsv(seq(0,1,length.out=6))

mats = list()
for(i in 1:5) {
  mats[[i]] = material_list(diffuse=cols[i], ambient=cols[i], type="phong",
                            ambient_intensity = 0.2)
}

generate_cornell_mesh(ceiling=FALSE) %>%
  add_shape(sphere_mesh(position=c(555,555,555)/2, radius=80, material=mat)) %>%
  add_shape(segment_mesh(start=c(555/2,0,555/2),end=c(555/2,196,555/2),
                         radius=30, material=mat2)) %>%
  add_shape(cube_mesh(position=c(555/2,555/2-90,555/2),
                      scale=c(160,20,160),material=mat2)) %>%
  add_shape(torus_mesh(position=c(100,100,100), radius = 50, ring_radius = 20,
                       angle=c(45,0,45),material=mats[[1]])) %>%
  add_shape(cone_mesh(start=c(555-100,0,100), end=c(555-100,150,100), radius = 50,
                      material=mats[[2]])) %>%
  add_shape(arrow_mesh(start=c(555-100,455,555-100), end=c(100,455,555-100),
                       radius_top = 50, radius_tail=10, tail_proportion = 0.8,
                       material=mats[[3]])) %>%
  add_shape(obj_mesh(r_obj(), position=c(100,200,555/2), angle=c(-10,200,0),
                     scale=80,material=mats[[4]])) %>%
  add_shape(mesh3d_mesh(humface, position = c(555-80,220,555/2),scale = 1,
                        material=mats[[5]],angle=c(0,180,-30))) %>% 
  rasterize_scene(light_info = directional_light(c(0.4,0.2,-1)))
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .

We can also draw shapes with toon shading:

set.seed(1)
col = hsv(runif(1))
scene = sphere_mesh(position=runif(3),
                    material=material_list(diffuse=col, type="toon",toon_levels = 3, 
                                           toon_outline_width = 0.025,
                                           ambient=col,ambient_intensity=0.2),radius=0.1)

for(i in 1:30) {
  col = hsv(runif(1))
  scene = add_shape(scene, sphere_mesh(position=runif(3),
                                       material=material_list(diffuse=col, type="toon",toon_levels = 3,
                                                              toon_outline_width = 0.025,
                                                              ambient=col, ambient_intensity=0.2),
                                       radius=0.1))
}

rasterize_scene(scene, light_info=directional_light(direction=c(0.5,0.8,1)),
                background = "white",fov=10)
#> Setting `lookat` to: c(0.53, 0.49, 0.50)

You can also include a environment map to use for reflective, semi-reflective, and refractive surfaces. The roughness of the reflection can be controlled on a per-material basis with the reflection_sharpness argument.

tempfilehdr = tempfile(fileext = ".hdr")
download.file("https://www.tylermw.com/data/venice_sunset_2k.hdr",tempfilehdr)

scene = torus_mesh(position=c(0.4,0,0),angle=c(-30,20,-30),
                   material=material_list(diffuse=c(1,1,1), type="color", 
                                           reflection_intensity = 1.0, reflection_sharpness = 0.2),
                   ring_radius=0.05,radius=0.2) %>% 
  add_shape(torus_mesh(position=c(0.4,0.5,0),angle=c(-30,20,-130),
                   material=material_list(diffuse="green", ambient="green", type="phong", 
                                          ambient_intensity = 0.2, diffuse_intensity=0.8,
                                          reflection_intensity = 0.5, reflection_sharpness = 0.05),
                   ring_radius=0.05,radius=0.2)) %>% 
  add_shape(sphere_mesh(position=c(-0.4,0,0),
                   material=material_list(diffuse="white", type="color",ior=1.6),radius=0.2)) %>% 
  add_shape(obj_mesh(r_obj(),position=c(-0.4,0.35,0),scale=0.2, angle=c(0,-30,0),
                   material=material_list(diffuse="purple", type="color",ior=1.6))) %>% 
  add_shape(sphere_mesh(position=c(0,0.25,0),
                   material=material_list(diffuse="white", type="color",reflection_intensity = 1.0),
                   radius=0.2)) 

rasterize_scene(scene, lookat=c(0,0.25,0),
                light_info=directional_light(direction=c(0.5,1,1)),
                lookfrom=c(0,0.5,2.5), 
                fov=30, environment_map = tempfilehdr)

You can also blur the background but keep the reflections sharp by setting the background_sharpness argument to draw focus to your 3D scene.

rasterize_scene(scene, lookat=c(0,0.25,0),
                light_info=directional_light(direction=c(0.5,1,1)),
                lookfrom=c(0,0.5,2.5), 
                fov=30, environment_map = tempfilehdr, background_sharpness = 0.5)

Now let’s draw another example scene: we’ll add the R OBJ to a flat surface.

base_model = cube_mesh() %>%
  scale_mesh(scale=c(5,0.2,5)) %>%
  translate_mesh(c(0,-0.1,0)) %>%
  set_material(diffuse="white")

r_model = obj_mesh(r_obj()) %>%
  scale_mesh(scale=0.5) %>%
  set_material(diffuse="red") %>%
  add_shape(base_model)

rasterize_scene(r_model, lookfrom=c(2,4,10),fov=20,
               light_info = directional_light(direction=c(0.8,1,0.7)))
#> Setting `lookat` to: c(0.00, 0.34, 0.00)

We can reduce the shadow intensity so the shadows aren’t black. Alternatively, you can add an ambient term to the material.

#Zoom in and reduce the shadow mapping intensity
rasterize_scene(r_model, lookfrom=c(2,4,10), fov=10,shadow_map = TRUE, shadow_map_intensity=0.3,
               light_info = directional_light(direction=c(0.8,1,0.7)))
#> Setting `lookat` to: c(0.00, 0.34, 0.00)

We can increase the resolution of the shadow map to increase the fidelity of the shadows. This can reduce the amount of “pixelation” around the edges.

rasterize_scene(r_model, lookfrom=c(2,4,10), fov=10,
                shadow_map_dims=2, light_info = directional_light(direction=c(0.8,1,0.7)))
#> Setting `lookat` to: c(0.00, 0.34, 0.00)

We can add multiple directional lights and change their color and intensity:

lights = directional_light(c(0.7,1.1,-0.9),color = "orange",intensity = 0.7) %>%
            add_light(directional_light(c(0.7,1,1),color = "dodgerblue",intensity = 0.7)) %>%
            add_light(directional_light(c(2,4,10),color = "white",intensity = 0.3))
rasterize_scene(r_model, lookfrom=c(2,4,10), fov=10,
               light_info = lights)
#> Setting `lookat` to: c(0.00, 0.34, 0.00)

We can change the transparency of the material, which allows for colored shadows.

r_model_t = obj_mesh(r_obj()) %>%
  scale_mesh(scale=0.5) %>%
  set_material(diffuse="red", dissolve=0.5, translucent = T) %>%
  add_shape(base_model)

r_model_t = obj_mesh(r_obj(),c(-2,0,0.3)) %>%
  scale_mesh(scale=0.5) %>%
  set_material(diffuse="dodgerblue", dissolve=0.5, translucent = T) %>%
  add_shape(r_model_t)

rasterize_scene(r_model_t, lookfrom=c(2,4,10),fov=15,lookat=c(-0.5,0,0),
                light_info = directional_light(direction=c(0.8,1,0.7), intensity = 0.5) %>% 
                   add_light(directional_light(direction=c(-0.8,1,0.7),intensity = 0.5)))

We can also add some point lights:

#Add some point lights
lights_p = lights %>%
  add_light(point_light(position=c(-1,1,0),color="red", intensity=2)) %>%
  add_light(point_light(position=c(1,1,0),color="purple", intensity=2))

rasterize_scene(r_model, lookfrom=c(2,4,10), fov=10,
               light_info = lights_p)
#> Setting `lookat` to: c(0.00, 0.34, 0.00)

We can change the camera position by adjusting the lookfrom argument:

#change the camera position
rasterize_scene(r_model, lookfrom=c(-2,2,-10), fov=10,
               light_info = lights_p)
#> Setting `lookat` to: c(0.00, 0.34, 0.00)

Finally, we can also add 3D lines to the scene. We’ll add a spiral of lines around the R.

t = seq(0,8*pi,length.out=361)
line_mat = matrix(nrow=0,ncol=9)

for(i in 1:360) {
  line_mat = add_lines(line_mat,
                      generate_line(start = c(0.5*sin(t[i]), t[i]/(8*pi), 0.5*cos(t[i])),
                                    end  = c(0.5*sin(t[i+1]), t[i+1]/(8*pi), 0.5*cos(t[i+1]))))
}

rasterize_scene(r_model, lookfrom=c(2,4,10), fov=10, line_info = line_mat,
               light_info = lights)
#> Setting `lookat` to: c(0.00, 0.34, 0.00)

Comments
  • Installation failing (R4.1.0, macOS Big Sur 11.4)

    Installation failing (R4.1.0, macOS Big Sur 11.4)

    Installation via devtools failing on my macOS11.4

    Installation output attached below.

    R version 4.1.0 (2021-05-18)
    Platform: x86_64-apple-darwin17.0 (64-bit)
    Running under: macOS Big Sur 11.4
    
    > devtools::install_github("tylermorganwall/rayvertex")
    Downloading GitHub repo tylermorganwall/[email protected]
    ✓  checking for file ‘/private/var/folders/5p/78cv9fvn4xn_rbgxpx51q5n80000gn/T/RtmpxF6cQM/remotes38e74e11f542/tylermorganwall-rayvertex-6bcb46a/DESCRIPTION’ ...
    ─  preparing ‘rayvertex’: (341ms)
    ✓  checking DESCRIPTION meta-information
    ─  cleaning src
    ─  checking for LF line-endings in source and make files and shell scripts
    ─  checking for empty or unneeded directories
    ─  building ‘rayvertex_0.1.tar.gz’
       
    * installing *source* package ‘rayvertex’ ...
    ** using staged installation
    ** libs
    clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/spacefillr/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include' -I/usr/local/include  -I../src/glm -I../src/glm/gtc -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
    In file included from RcppExports.cpp:4:
    In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp.h:57:
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data' [-Wunused-variable]
                SEXP data = Parent::get__();
                     ^
    1 warning generated.
    clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/spacefillr/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include' -I/usr/local/include  -I../src/glm -I../src/glm/gtc -fPIC  -Wall -g -O2  -c filltri.cpp -o filltri.o
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:5:
    In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp.h:57:
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data' [-Wunused-variable]
                SEXP data = Parent::get__();
                     ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread.h:9:
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/RMonitor.hpp:44:33: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        RMonitor(RMonitor const&) = delete;
                                    ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/RMonitor.hpp:46:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        RMonitor(RMonitor&&) = delete;
                         ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/RMonitor.hpp:46:28: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        RMonitor(RMonitor&&) = delete;
                               ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/RMonitor.hpp:48:44: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        RMonitor& operator=(RMonitor const&) = delete;
                                               ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/RMonitor.hpp:50:34: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        RMonitor& operator=(RMonitor &&) = delete;
                                     ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/RMonitor.hpp:50:40: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        RMonitor& operator=(RMonitor &&) = delete;
                                           ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread.h:11:
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:29:16: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
        Thread() = default;
                   ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:30:23: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Thread(Thread&) = delete;
                          ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:31:29: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Thread(const Thread&) = delete;
                                ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:32:18: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        Thread(Thread&& other)
                     ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:37:35: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
        template<class Function, class... Args> explicit
                                      ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:38:20: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        Thread(Function&& f, Args&&... args)
                       ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:38:30: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        Thread(Function&& f, Args&&... args)
                                 ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:49:14: error: expected ';' at end of declaration list
        ~Thread() noexcept
                 ^
                 ;
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:58:29: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        Thread& operator=(Thread&& other)
                                ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:66:29: error: expected ';' at end of declaration list
        void swap(Thread& other) noexcept
                                ^
                                ;
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:40:9: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            auto f0 = [=] () {
            ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:40:19: error: expected expression
            auto f0 = [=] () {
                      ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:44:9: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            auto task = std::packaged_task<void()>(f0);
            ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:46:9: error: use of undeclared identifier 'thread_'
            thread_ = std::thread(std::move(task));
            ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Thread.hpp:60:13: error: use of undeclared identifier 'thread_'
            if (thread_.joinable())
                ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread.h:12:
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Batch.hpp:33:22: error: expected '(' for function-style cast or type construction
            return {Batch{0, 0}};
                    ~~~~~^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/Batch.hpp:45:27: error: expected '(' for function-style cast or type construction
            batches[k] = Batch{bBegin, bBegin + bSize};
                         ~~~~~^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread.h:13:
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:29:26: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        ThreadPool(ThreadPool&&) = delete;
                             ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:29:32: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        ThreadPool(ThreadPool&&) = delete;
                                   ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:30:37: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        ThreadPool(const ThreadPool&) = delete;
                                        ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:34:18: error: expected ';' at end of declaration list
        ~ThreadPool() noexcept;
                     ^
                     ;
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:36:48: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        ThreadPool& operator=(const ThreadPool&) = delete;
                                                   ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:37:37: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        ThreadPool& operator=(ThreadPool&& other) = delete;
                                        ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:37:49: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        ThreadPool& operator=(ThreadPool&& other) = delete;
                                                    ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:39:28: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
        template<class F, class... Args>
                               ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:40:16: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void push(F&& f, Args&&... args);
                   ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:40:26: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void push(F&& f, Args&&... args);
                             ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:42:28: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
        template<class F, class... Args>
                               ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:43:5: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
        auto pushReturn(F&& f, Args&&... args)
        ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:43:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        auto pushReturn(F&& f, Args&&... args)
                         ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:43:32: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        auto pushReturn(F&& f, Args&&... args)
                                   ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:43:5: error: 'auto' not allowed in function return type
        auto pushReturn(F&& f, Args&&... args)
        ^~~~
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:43:43: error: expected ';' at end of declaration list
        auto pushReturn(F&& f, Args&&... args)
                                              ^
                                              ;
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:47:15: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void map(F&& f, I &&items);
                  ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:47:23: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void map(F&& f, I &&items);
                          ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:52:30: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
                                F&& f,
                                 ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:56:44: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        inline void parallelForEach(I& items, F&& f, size_t nBatches = 0);
                                               ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:64:37: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void doJob(std::function<void()>&& job);
                                        ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:64:21: warning: 'function<void ()>' is deprecated: Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a different type [-Wdeprecated-declarations]
        void doJob(std::function<void()>&& job);
                        ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:1444:27: note: 'function<void ()>' has been explicitly marked deprecated here
    template<class _Fp> class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function; // undefined
                              ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:1439:24: note: expanded from macro '_LIBCPP_DEPRECATED_CXX03_FUNCTION'
            __attribute__((deprecated("Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a different type")))
                           ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread.h:13:
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:76:36: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++11 [-Wc++11-compat]
        std::queue<std::function<void()>> jobs_;  // the task que
                                       ^
                                 (             )
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:76:39: error: use of undeclared identifier 'jobs_'
        std::queue<std::function<void()>> jobs_;  // the task que
                                          ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:76:44: error: expected '>'
        std::queue<std::function<void()>> jobs_;  // the task que
                                               ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:76:29: note: to match this '<'
        std::queue<std::function<void()>> jobs_;  // the task que
                                ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:76:44: error: expected a type
        std::queue<std::function<void()>> jobs_;  // the task que
                                               ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:76:44: error: expected '>'
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:76:15: note: to match this '<'
        std::queue<std::function<void()>> jobs_;  // the task que
                  ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:82:12: error: function definition does not declare parameters
        size_t numBusy_{0};
               ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:83:10: error: function definition does not declare parameters
        bool stopped_{false};
             ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:89:5: error: delegating constructors are permitted only in C++11
        ThreadPool(std::thread::hardware_concurrency())
        ^~~~~~~~~~
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/ThreadPool.hpp:103:34: error: expected function body after function declarator
    inline ThreadPool::~ThreadPool() noexcept
                                     ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread.h:14:
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/parallelFor.hpp:43:59: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    inline void parallelFor(ptrdiff_t begin, ptrdiff_t size, F&& f,
                                                              ^
    /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppThread/include/RcppThread/parallelFor.hpp:81:40: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    inline void parallelForEach(I& items, F&& f,
                                           ^
    filltri.cpp:36:7: warning: unused variable 'nx' [-Wunused-variable]
      int nx = image.width();
          ^
    40 warnings and 18 errors generated.
    make: *** [filltri.o] Error 1
    ERROR: compilation failed for package ‘rayvertex’
    * removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/rayvertex’
    Warning message:
    In i.p(...) :
      installation of package ‘/var/folders/5p/78cv9fvn4xn_rbgxpx51q5n80000gn/T//RtmpxF6cQM/file38e77cfce818/rayvertex_0.1.tar.gz’ had non-zero exit status
    
    opened by coolbutuseless 6
  • Dark spots in raster

    Dark spots in raster

    Hi!

    Thanks for the great package.

    I am trying to replicate my brain rendering workflow, porting from rayrender to rayvertex, and something weird happened: some dark spots appear in some parts of the image.

    See video:

    https://user-images.githubusercontent.com/21171362/121120034-580ab380-c84f-11eb-801c-4cb14758ee90.mp4

    The code I use for this is pretty simple, as every shape is loaded as a mesh3d_mesh in the scene and the scene frames are rendered in parallel (takes 2 minutes to render 90 frames)

    vb.center = c(254, 160, -220)
    dist.from = 1350
    
    steps = 180
    steps.x = dist.from * 2 * cos(seq(0, 360, length.out = steps) * pi/180)
    steps.z = dist.from * 2 * sin(seq(0, 360, length.out = steps) * pi/180)
     
    scene = mesh3d_mesh(meshlist[[1]])
    
    for(i in names(meshlist)) {
        mesh.material = paste0("#", structures.available$color_hex_triplet[structures.available$id == i])
        scene <- add_shape(scene, 
                           shape = mesh3d_mesh(meshlist[[i]], 
                           material = material_list(diffuse = mesh.material)))
        }
    
    plan(multiprocess, workers = 13) 
    
    future.apply::future_lapply(1:90, function(j) {
      options(cores = 4)
      rasterize_scene(scene = scene,
                   lookat = vb.center,
                   lookfrom = c(steps.x[j*2], 50, steps.z[j*2]),
                   width = 1080,
                   height = 1080,
                   light_info = directional_light(c(steps.x[j*2], 50, steps.z[j*2]), 
                                                                    color = "white", 
                                                                    intensity = 0.8),
                   background = "white",
                   parallel = TRUE, 
                   filename=glue::glue("./raster/brainmov_rast_{j}"))
                },
        future.seed = TRUE)
    

    A similar workflow in rayrender has no such issue.

    Any idea if I'm doing something wrong/need to change arguments?

    opened by gdagstn 5
  • Linux install fails

    Linux install fails

    Hi there, I am unable to install the package in Linux (R3.6):

    install.packages("rayvertex") Installing package into ‘/home/apascual/R/x86_64-pc-linux-gnu-library/3.6’ (as ‘lib’ is unspecified) probando la URL 'http://stat.ethz.ch/CRAN/src/contrib/rayvertex_0.4.11.tar.gz' Content type 'application/x-gzip' length 468801 bytes (457 KB) ================================================== downloaded 457 KB

    *** Successfully loaded .Rprofile ***

    • installing source package ‘rayvertex’ ... ** package ‘rayvertex’ successfully unpacked and MD5 sums checked ** using staged installation ** libs g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c filltri.cpp -o filltri.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c light.cpp -o light.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c line.cpp -o line.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c load_obj.cpp -o load_obj.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c load_ply.cpp -o load_ply.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c miniply.cpp -o miniply.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c rasterize_lines_rcpp.cpp -o rasterize_lines_rcpp.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c rayimage.cpp -o rayimage.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c rayraster.cpp -o rayraster.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c shaders.cpp -o shaders.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c tonemap.cpp -o tonemap.o g++ -std=gnu++17 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/spacefillr/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/RcppThread/include" -I"/home/apascual/R/x86_64-pc-linux-gnu-library/3.6/rayimage/include" -I/usr/local/include -I../src/glm -I../src/glm/gtc -fpic -g -O2 -c wireframe.cpp -o wireframe.o g++ -std=gnu++17 -shared -L/opt/R/3.6.3/lib/R/lib -L/usr/local/lib -o rayvertex.so RcppExports.o filltri.o light.o line.o load_obj.o load_ply.o miniply.o rasterize_lines_rcpp.o rayimage.o rayraster.o shaders.o tonemap.o wireframe.o -L/opt/R/3.6.3/lib/R/lib -lR installing to /home/apascual/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-rayvertex/00new/rayvertex/libs ** R Error in parse(outFile) : /tmp/Rtmpb2IhYf/R.INSTALL18d55fa23fa0/rayvertex/R/add_shape.R:795:30: unexpected '>' 794: scaleval = (bbox_size + material$toon_outline_width)/bbox_size 795: single_obj = single_obj |> ^ ERROR: unable to collate and parse R files for package ‘rayvertex’

    I've seen a similar problem here that seems to be related with an encoding problem.

    Thanks in advance

    opened by apascualgarcia 4
  • Regression in rendering textured meshes (imported via Wavefront OBJ files)

    Regression in rendering textured meshes (imported via Wavefront OBJ files)

    In {rayvertex} v0.4.11 I'm observing a regression in rendering a textured mesh imported via Wavefront OBJ file:

    # generate Wavefront OBJ file with {piecepackr}
    library("piecepackr")
    envir <- game_systems("sans3d", round=TRUE)
    f <- save_piece_obj(piece_side = "tile_back", x = 1.5, y = 1.5, suit = 1, rank = 1,
                        cfg = envir$piecepack)
    
    # import/render Wavefront OBJ file in {rayvertex}
    library("rayvertex")
    tile <- obj_mesh(f$obj)
    table <- sphere_mesh(c(0, 0, -1e3), radius=1e3, material = material_list(diffuse="grey40"))
    scene <- add_shape(table, tile)
    rasterize_scene(scene, filename = "rayvertex_bug.png",
                    lookat = c(4.5, 4, 0), lookfrom=c(4.5, -16, 20),
                    light_info = directional_light(c(5, -7, 7), intensity = 2.5))
    

    rayvertex_bug

    In contrast things look fine with the latest version of {rayrender} (also look fine with {rgl} via {readobj} or an earlier version of {rayvertex} like v0.3.3)

    # contrast with {rayrender}
    library("rayrender")
    tile <- obj_model(f$obj, load_textures = TRUE, load_material = TRUE)
    table <- sphere(z=-1e3, radius=1e3, material=diffuse(color="grey40")) |>
             add_object(sphere(x=5,y=-4, z=30, material=light(intensity=420)))
    scene <- add_object(table, tile)
    render_scene(scene, filename = "rayrender.png",
                 lookat = c(5, 5, 0), lookfrom = c(5, -7, 25),
                 width = 500, height = 500, samples=200, clamp_value=8)
    

    rayrender

    opened by trevorld 4
  • add_shape(NULL, NULL) now throws ERROR

    add_shape(NULL, NULL) now throws ERROR

    Unlike earlier versions of {rayvertex} where add_shape(NULL, NULL) returned a NULL I now observe that it throws an ERROR:

    library("rayvertex")
    scene <- add_shape(NULL, NULL)
    
    Error in class(scene) <- c("ray_mesh", "list") : 
      attempt to set an attribute on NULL
    

    In contrast scene_from_list() does seem to handle this case:

    scene_from_list(list(NULL, NULL))
    
    $shapes
    list()
    
    $materials
    list()
    
    $vertices
    $vertices[[1]]
    NULL
    
    
    $texcoords
    $texcoords[[1]]
    NULL
    
    
    $normals
    $normals[[1]]
    NULL
    
    
    $material_hashes
    character(0)
    
    attr(,"class")
    [1] "ray_mesh" "list"    
    

    Is there something else I should be using for a "null" mesh other than NULL (i.e. a mesh too small or transparent that we know won't be visible and shouldn't be drawn as sometimes happens in animation transitions when things are appearing or disappearing)?

    opened by trevorld 3
  • 'scene_from_list()' bug

    'scene_from_list()' bug

    I've found a case with {rayvertex} v0.4.11 where scene_from_list() throws an ERROR when building a scene from a list of "ray_mesh" objects:

    library("piecepackr")
    library("ppgames") # remotes::install_github("piecepackr/ppgames")
    library("rayvertex", warn.conflicts = FALSE) # masks `rayrender::r_obj`
    df <- ppgames::df_international_chess()
    envir <- game_systems("dejavu3d", round=TRUE, pawn="joystick")
    l <- pmap_piece(df, piece_mesh, trans=op_transform, envir = envir, scale = 0.98, res = 150, as_top="pawn_face")
    scene <- scene_from_list(l)
    
    Error in scene_list[[i]]$material_hashes[[j]] : subscript out of bounds
    

    Note though one can still build a scene from this list of "ray_mesh" objects by using add_shape() perhaps via Reduce():

    scene <- Reduce(add_shape, l)
    

    Note every element of the list is a "ray_mesh"

    > vapply(l, function(x) inherits(x, "ray_mesh"), logical(1))
    piece.16 piece.15 piece.14 piece.13 piece.12 piece.11 piece.10  piece.9 
        TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE 
     piece.8  piece.7  piece.6  piece.5  piece.4  piece.3  piece.2  piece.1 
        TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE 
    piece.38 piece.47 piece.45 piece.37 piece.24 piece.23 piece.22 piece.21 
        TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE 
    piece.20 piece.19 piece.18 piece.17 piece.32 piece.31 piece.30 piece.29 
        TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE 
    piece.28 piece.27 piece.26 piece.25 piece.39 piece.48 piece.46 piece.40 
        TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE 
    piece.34 piece.33 piece.35 piece.36 piece.42 piece.41 piece.43 piece.44 
        TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE 
    
    opened by trevorld 2
  • Bump {rayimage} version requirement in DESCRIPTION?

    Bump {rayimage} version requirement in DESCRIPTION?

    1. I tried updating my version of {rayvertex} to 0.3.3 and I initially got the following error:
    g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG  -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/spacefillr/include' -I'/usr/local/lib/R/site-library/RcppThread/include' -I'/usr/local/lib/R/site-library/rayimage/include'   -I../src/glm -I../src/glm/gtc -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c rayraster.cpp -o rayraster.o
    rayraster.cpp:20:10: fatal error: stb_image_resize.h: No such file or directory
       20 | #include "stb_image_resize.h"
          |          ^~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    
    1. I then installed the system package libstb-dev then tried updating {rayvertex} again and still observed the same error.
    2. I then updated {rayimage} and then tried updating {rayvertex} again and it worked.

    So maybe the newer version of {rayvertex} requires a newer version of {rayimage}?

    opened by trevorld 2
  • Could you please do a CRAN (bug fix) release?

    Could you please do a CRAN (bug fix) release?

    • Thanks for the awesome rayvertex package!
    • Could you please do a CRAN (bug fix) release?
    • In particular your initial CRAN v0.2.3 release has a Wavefront OBJ import bug that is blocking me from merging in a PR supporting {rayvertex} in my package (and eventually releasing to CRAN) since such a feature isn't CRAN-ready (since it doesn't work with the CRAN release of your package). However you fixed that bug in the development version back in June (v0.2.4?).
    opened by trevorld 2
  • fix: Filter NULLs in 'scene_from_list()'

    fix: Filter NULLs in 'scene_from_list()'

    • scene_from_list() now filters out any NULLs in the scene_list
    • scene_from_list(list(NULL)) no longer throws an ERROR. It did not throw an ERROR in the previous CRAN release and would allow NULLs to serve as a de facto "null" mesh.

    closes #11

    opened by trevorld 1
  • Mac install fails

    Mac install fails

    Installation using install_github on Mac (Big Sur 11.5.2) fails with this error:

    clang++ -I"/usr/local/Cellar/r/4.0.4/lib/R/include" -DNDEBUG  -I'/usr/local/lib/R/4.0/site-library/Rcpp/include' -I'/usr/local/lib/R/4.0/site-library/spacefillr/include' -I'/usr/local/lib/R/4.0/site-library/RcppThread/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include  -I../src/glm -I../src/glm/gtc -fPIC  -g -O2  -c filltri.cpp -o filltri.o
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread.h:9:
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/RMonitor.hpp:44:33: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        RMonitor(RMonitor const&) = delete;
                                    ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/RMonitor.hpp:46:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        RMonitor(RMonitor&&) = delete;
                         ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/RMonitor.hpp:46:28: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        RMonitor(RMonitor&&) = delete;
                               ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/RMonitor.hpp:48:44: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        RMonitor& operator=(RMonitor const&) = delete;
                                               ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/RMonitor.hpp:50:34: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        RMonitor& operator=(RMonitor &&) = delete;
                                     ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/RMonitor.hpp:50:40: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        RMonitor& operator=(RMonitor &&) = delete;
                                           ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread.h:11:
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:29:16: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
        Thread() = default;
                   ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:30:23: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Thread(Thread&) = delete;
                          ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:31:29: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Thread(const Thread&) = delete;
                                ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:32:18: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        Thread(Thread&& other)
                     ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:37:35: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
        template<class Function, class... Args> explicit
                                      ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:38:20: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        Thread(Function&& f, Args&&... args)
                       ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:38:30: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        Thread(Function&& f, Args&&... args)
                                 ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:49:14: error: expected ';' at end of declaration list
        ~Thread() noexcept
                 ^
                 ;
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:58:29: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        Thread& operator=(Thread&& other)
                                ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:66:29: error: expected ';' at end of declaration list
        void swap(Thread& other) noexcept
                                ^
                                ;
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:40:9: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            auto f0 = [=] () {
            ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:40:19: error: expected expression
            auto f0 = [=] () {
                      ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:44:9: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            auto task = std::packaged_task<void()>(f0);
            ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:46:9: error: use of undeclared identifier 'thread_'
            thread_ = std::thread(std::move(task));
            ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Thread.hpp:60:13: error: use of undeclared identifier 'thread_'
            if (thread_.joinable())
                ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread.h:12:
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Batch.hpp:33:22: error: expected '(' for function-style cast or type construction
            return {Batch{0, 0}};
                    ~~~~~^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/Batch.hpp:45:27: error: expected '(' for function-style cast or type construction
            batches[k] = Batch{bBegin, bBegin + bSize};
                         ~~~~~^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread.h:13:
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:29:26: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        ThreadPool(ThreadPool&&) = delete;
                             ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:29:32: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        ThreadPool(ThreadPool&&) = delete;
                                   ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:30:37: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        ThreadPool(const ThreadPool&) = delete;
                                        ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:34:18: error: expected ';' at end of declaration list
        ~ThreadPool() noexcept;
                     ^
                     ;
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:36:48: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        ThreadPool& operator=(const ThreadPool&) = delete;
                                                   ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:37:37: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        ThreadPool& operator=(ThreadPool&& other) = delete;
                                        ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:37:49: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        ThreadPool& operator=(ThreadPool&& other) = delete;
                                                    ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:39:28: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
        template<class F, class... Args>
                               ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:40:16: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void push(F&& f, Args&&... args);
                   ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:40:26: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void push(F&& f, Args&&... args);
                             ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:42:28: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
        template<class F, class... Args>
                               ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:43:5: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
        auto pushReturn(F&& f, Args&&... args)
        ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:43:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        auto pushReturn(F&& f, Args&&... args)
                         ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:43:32: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        auto pushReturn(F&& f, Args&&... args)
                                   ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:43:5: error: 'auto' not allowed in function return type
        auto pushReturn(F&& f, Args&&... args)
        ^~~~
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:43:43: error: expected ';' at end of declaration list
        auto pushReturn(F&& f, Args&&... args)
                                              ^
                                              ;
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:47:15: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void map(F&& f, I &&items);
                  ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:47:23: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void map(F&& f, I &&items);
                          ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:52:30: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
                                F&& f,
                                 ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:56:44: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        inline void parallelForEach(I& items, F&& f, size_t nBatches = 0);
                                               ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:64:37: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        void doJob(std::function<void()>&& job);
                                        ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:64:21: warning: 'function<void ()>' is deprecated: Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a different type [-Wdeprecated-declarations]
        void doJob(std::function<void()>&& job);
                        ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:1444:27: note: 'function<void ()>' has been explicitly marked deprecated here
    template<class _Fp> class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function; // undefined
                              ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:1439:24: note: expanded from macro '_LIBCPP_DEPRECATED_CXX03_FUNCTION'
            __attribute__((deprecated("Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a different type")))
                           ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread.h:13:
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:76:36: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++11 [-Wc++11-compat]
        std::queue<std::function<void()>> jobs_;  // the task que
                                       ^
                                 (             )
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:76:39: error: use of undeclared identifier 'jobs_'
        std::queue<std::function<void()>> jobs_;  // the task que
                                          ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:76:44: error: expected '>'
        std::queue<std::function<void()>> jobs_;  // the task que
                                               ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:76:29: note: to match this '<'
        std::queue<std::function<void()>> jobs_;  // the task que
                                ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:76:44: error: expected a type
        std::queue<std::function<void()>> jobs_;  // the task que
                                               ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:76:44: error: expected '>'
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:76:15: note: to match this '<'
        std::queue<std::function<void()>> jobs_;  // the task que
                  ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:82:12: error: function definition does not declare parameters
        size_t numBusy_{0};
               ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:83:10: error: function definition does not declare parameters
        bool stopped_{false};
             ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:89:5: error: delegating constructors are permitted only in C++11
        ThreadPool(std::thread::hardware_concurrency())
        ^~~~~~~~~~
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/ThreadPool.hpp:103:34: error: expected function body after function declarator
    inline ThreadPool::~ThreadPool() noexcept
                                     ^
    In file included from filltri.cpp:1:
    In file included from ./filltri.h:7:
    In file included from /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread.h:14:
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/parallelFor.hpp:43:59: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    inline void parallelFor(ptrdiff_t begin, ptrdiff_t size, F&& f,
                                                              ^
    /usr/local/lib/R/4.0/site-library/RcppThread/include/RcppThread/parallelFor.hpp:81:40: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    inline void parallelForEach(I& items, F&& f,
                                           ^
    38 warnings and 18 errors generated.
    make: *** [filltri.o] Error 1
    ERROR: compilation failed for package ‘rayvertex’
    
    opened by x1o 1
  • Can't seem to install rayvertex, I get the following:

    Can't seem to install rayvertex, I get the following:

    install.packages("rayvertex") Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘rayvertex’ These will not be installed

    opened by NeilKaye 1
  • toon_outline_width of 0 should result in no outline

    toon_outline_width of 0 should result in no outline

    When using the material_list function with type = "toon", I think having toon_outline_width = 0 should result in no outline. Instead, it makes all the objects red. I didn't see another option to remove the outline, but I might have missed it.

    remotes::install_github("tylermorganwall/rayvertex")
    #> Skipping install of 'rayvertex' from a github remote, the SHA1 (f1c3289f) has not changed since last install.
    #>   Use `force = TRUE` to force installation
    library(rayvertex)
    
    # Example works like the documentation
    set.seed(1)
    col = hsv(runif(1))
    scene = sphere_mesh(position=runif(3),
                        material=material_list(diffuse=col, type="toon",toon_levels = 3, 
                                               toon_outline_width = 0.025,
                                               ambient=col,ambient_intensity=0.2),radius=0.1)
    
    for(i in 1:30) {
      col = hsv(runif(1))
      scene = add_shape(scene, sphere_mesh(position=runif(3),
                                           material=material_list(diffuse=col, type="toon",toon_levels = 3,
                                                                  toon_outline_width = 0.025,
                                                                  ambient=col, ambient_intensity=0.2),
                                           radius=0.1))
    }
    
    rasterize_scene(scene,
                    light_info=directional_light(direction=c(0.5,0.8,1)),
                    background = "white",fov=10)
    #> Setting `lookat` to: c(0.53, 0.49, 0.50)
    

    # set toon_outline_width = 0
    # I'd expect this to be the previous image with no black outlines on the spheres
    # but it makes all of them red instead?
    set.seed(1)
    col = hsv(runif(1))
    scene = sphere_mesh(position=runif(3),
                        material=material_list(diffuse=col, type="toon",toon_levels = 3, 
                                               toon_outline_width = 0,
                                               ambient=col,ambient_intensity=0.2),radius=0.1)
    
    for(i in 1:30) {
      col = hsv(runif(1))
      scene = add_shape(scene, sphere_mesh(position=runif(3),
                                           material=material_list(diffuse=col, type="toon",toon_levels = 3,
                                                                  toon_outline_width = 0,
                                                                  ambient=col, ambient_intensity=0.2),
                                           radius=0.1))
    }
    
    rasterize_scene(scene,
                    light_info=directional_light(direction=c(0.5,0.8,1)),
                    background = "white",fov=10)
    #> Setting `lookat` to: c(0.53, 0.49, 0.50)
    

    # set toon_outline_width = -0.025
    # This gets the desired result, but feels hacky
    set.seed(1)
    col = hsv(runif(1))
    scene = sphere_mesh(position=runif(3),
                        material=material_list(diffuse=col, type="toon",toon_levels = 3, 
                                               toon_outline_width = -0.025,
                                               ambient=col,ambient_intensity=0.2),radius=0.1)
    
    for(i in 1:30) {
      col = hsv(runif(1))
      scene = add_shape(scene, sphere_mesh(position=runif(3),
                                           material=material_list(diffuse=col, type="toon",toon_levels = 3,
                                                                  toon_outline_width = -0.025,
                                                                  ambient=col, ambient_intensity=0.2),
                                           radius=0.1))
    }
    
    rasterize_scene(scene,
                    light_info=directional_light(direction=c(0.5,0.8,1)),
                    background = "white",fov=10)
    #> Setting `lookat` to: c(0.53, 0.49, 0.50)
    

    Sys.info()
    #>                                                                                                 sysname 
    #>                                                                                                "Darwin" 
    #>                                                                                                 release 
    #>                                                                                                "21.5.0" 
    #>                                                                                                 version 
    #> "Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101" 
    #>                                                                                                nodename 
    #>                                                                                            "Tylers-MBP" 
    #>                                                                                                 machine 
    #>                                                                                                "x86_64" 
    #>                                                                                                   login 
    #>                                                                                                  "root" 
    #>                                                                                                    user 
    #>                                                                                          "tylerbradley" 
    #>                                                                                          effective_user 
    #>                                                                                          "tylerbradley"
    

    Created on 2022-06-08 by the reprex package (v2.0.1)

    opened by WilliamTylerBradley 0
Tiny C++ Software Renderer/Rasterizer

SoftGLRender Tiny C++ Software Renderer/Rasterizer, it implements the main GPU rendering pipeline, 3D models (GLTF) are loaded by assimp, and using GL

Keith 488 Dec 30, 2022
A tiny but (will be) featured rasterizer

Introduction This is my own rasterizer implementation. Developed in C++17. Usage compile ./rasterizer [model], model names plz refer to this README Ro

Hyiker 8 Aug 22, 2022
This is a tool for software engineers to view,record and analyse data(sensor data and module data) In the process of software development.

![Contributors][Huang Jianyu] Statement 由于工具源码在网上公开,除使用部分开源项目代码外,其余代码均来自我个人,工具本身不包含公司的知识产权,所有与公司有关的内容均从软件包中移除,软件发布遵循Apache协议,任何人均可下载进行修改使用,如使用过程中出现任何问

HuangJianyu 36 Dec 25, 2022
Add virtual monitors to your windows 10 device! Works with Oculus software, obs, and any desktop sharing software

License MIT and CC0 or Public Domain, whichever is least restrictive -- Use it AS IS - NO IMPLICIT OR EXPLICIT warranty This may break your computer,

Rashi Abramson 230 Jan 6, 2023
MasterPlan is a project management software / visual idea board software. It attempts to be easy to use, lightweight, and fun.

MasterPlan is a customizeable graphical project management software for independent users or small teams. If you need to share plans across a whole co

SolarLune 444 Dec 23, 2022
Tools for interacting with music data in GBA games that use the Engine Software replayer.

A suite of tools for interacting with the XM-like music data found in certain Game Boy Advance games - specifically those that use the Engine Software replayer middleware.

Luna 16 Oct 22, 2022
CQC (Charmed Quark Controller) a commercial grade, full featured, software based automation system. CQC is built on our CIDLib C++ development system, which is also available here on GitHub.

The CQC Automation System What It Is CQC is a commercial quality, software based automation system, suitable for residential or commercial application

Dean Roddey 61 Dec 13, 2022
ESP32 software USB host through general IO pins. We can connect up to 4 USB-LS HID (keyboard mouse joystick) devices simultaneously.

esp32_usb_soft_host esp32 USB-LS pure software host thru general IO pins. Up to 4 HID devices simultaneously. board ~$3 :https://www.aliexpress.com/pr

Samsonov Dima 313 Jan 1, 2023
Servo library with stm developed by the Liek Software Team. We are working on new versions.

Liek-Servo-Library Liek Servo Library is a library that makes it easy for you to drive servo motors with STM32F10x series cards. The library is still

null 14 Nov 4, 2022
Threat Emulation and Red Teaming Framework, The Hacking Software for normal people.

The Remote Hacker Probe is a Threat Emulation and Red Teaming Framework built to be easy to use. The Remote Hacker Probe is Feature Rich! Including, K

QuantumCored 179 Jan 5, 2023
This repo contains example software for the Kernelcon 2021 Hack Live! badge - the Hacker HotKey.

Hacker HotKey This repo contains example software for the Kernelcon 2021 Hack Live! badge - the Hacker HotKey. Default Hotkey Mapping Hacker Hotkey is

Kernelcon 14 Jan 24, 2022
Not related to software bugs and exploits; this repo contains snippets of code that demonstrate some interesting functionality or a handy trick.

Proof-of-Concept Not related to software bugs and exploits; this repo contains snippets of code that demonstrate some interesting functionality or a h

Alisa Esage 32 Nov 19, 2022
Optical Design Software

Geopter Overview Geopter is optical design software based on geometrical ray tracing. As the first noteworthy feature, Geopter provides intuitive grap

Hiiragi 22 Nov 16, 2022
Xournal++ is a handwriting notetaking software with PDF annotation support

Xournal++ is a handwriting notetaking software with PDF annotation support. Written in C++ with GTK3, supporting Linux (e.g. Ubuntu, Debian, Arch, SUSE), macOS and Windows 10. Supports pen input from devices such as Wacom Tablets.

Xournalpp 7.9k Jan 4, 2023
The purpose of these streams is to be educational and entertaining for viewers to learn about systems architecture, reverse engineering, software security, etc., and NOT to encourage nor endorse malicious game hacking.

Memestream This repository holds the code that I develop during my live game "modding" ?? sessions. When I stream, I like to speedrun making a success

Stephen Tong 28 Jul 6, 2022
This software brings you the possibility to Read and Write the internal Flash of the Nordic nRF52 series with an ESP32

ESP32 nRF52 SWD flasher This software brings you the possibility to Read and Write the internal Flash of the Nordic nRF52 series with an ESP32 using t

null 140 Dec 31, 2022
ESP8266 software USB host through general IO pins. We can connect up to 2 USB-LS HID (keyboard mouse joystick) devices simultaneously.

esp8266_usb_soft_host Test for esp8266 usb host . Works with ESP-IDF v3.4 80MHz and 160MHz. WorkInProgress Test run with mouse & combined mouse & keyb

Samsonov Dima 28 Sep 1, 2022
SynthLab is a synth plugin framework for developing software synthesizers.

SynthLab SynthLab is a synth plugin framework for developing software synthesizers.

willpirkleaudio 77 Dec 7, 2022
Björn Kalkbrenner 37 Dec 18, 2022