tylermorganwall / rayvertex

3D Software Rasterizer for R
https://www.rayvertex.com
65 stars 2 forks source link

`obj_mesh()` meshes don't pass `validate_mesh()`? #14

Closed trevorld closed 1 year ago

trevorld commented 1 year ago

I'm observing in v0.7.9 that certain meshes generated by obj_mesh() no longer seem to have shadows when rendered by rasterize_scene() (unlike in earlier versions of {rayvertex}) but my attempted reproducible example won't even run in v0.8.0 since it seems my meshes generated by obj_mesh() don't seem to pass validate_mesh():

# generate Wavefront OBJ file with {piecepackr}
library("piecepackr")
envir <- game_systems()
f <- save_piece_obj(piece_side = "bit_face", x = 3, y = 1, suit = 4, cfg = envir$go)

# import/render Wavefront OBJ file in {rayvertex}
library("rayvertex")
stone <- obj_mesh(f$obj)
table <- sphere_mesh(c(0, 0, -1e3), radius=1e3,
                     material = material_list(diffuse="grey40"))
scene <- add_shape(table, stone)
light_info <- directional_light(c(5, -7, 7), intensity = 2.5)
rayvertex::rasterize_scene(scene,
                           lookat = c(4.5, 4, 0),
                           lookfrom=c(4.5, -16, 20),
                           light_info = light_info)
Error in validate_mesh(scene) : 
  is.numeric(material$toon_outline_color) is not TRUE
validate_mesh(stone)
Error in validate_mesh(stone) : 
  is.numeric(material$toon_outline_color) is not TRUE
tylermorganwall commented 1 year ago

Should be fixed now in 78dde31b65b98ba7c40ea77d635c602cf07d27b0.