dmurdoch/rgl

rgl should use two-sided shading

dmurdoch opened this issue · 1 comments

In R, shading depends on the direction of the normal vector. For example, this code:

cube <- addNormals(cube3d(col = "red"))
open3d()
shade3d(cube)

cube$normals <- -cube$normals
cube$normals[4,] <- 1
open3d()
shade3d(cube)

gives these displays:

Screen Shot 2023-01-29 at 6 36 43 AM

The WebGL displays using rglwidget() are the same in both cases, as they should be. (They are different because of Gouraud shading in R vs Phong shading in WebGL.)

This doesn't look possible in fixed pipeline OpenGL. Maybe #309 will solve it.