diff --git a/samples/basic/viewer/main.cc b/samples/basic/viewer/main.cc index ee96f448edbcbc50b3ac205743bd4d9de0658e09..00f25cbe58992a2343e48c5b967e0a07c7ad12fa 100644 --- a/samples/basic/viewer/main.cc +++ b/samples/basic/viewer/main.cc @@ -625,6 +625,47 @@ void subtle_cases(pm::vertex_attribute<tg::pos3> const& pos) gv::view(pos, tg::scaling(2.0, 2.0, 2.0), "double transform"); } +void known_issues(pm::vertex_attribute<tg::pos3> const& pos) +{ + pm::Mesh mLine; + const auto v0 = mLine.vertices().add(); + const auto v1 = mLine.vertices().add(); + const auto _ = mLine.edges().add_or_get(v0, v1); + const auto line = mLine.vertices().make_attribute_from_data<tg::pos3>({{0, 0, 0}, {1, 0, 0}}); + const auto lineColors = mLine.vertices().make_attribute_from_data<glow::colors::color>({{0.7f, 0.2f, 0.2f}, {0.2f, 0.7f, 0.2f}}); + + // Intersection of screen space camera facing lines and viewer grid creates artifacts + // Also the round caps of large screen space camera facing lines are not smoothly connecting to the straight line part + { + auto v = glow::viewer::view(); + gv::view(gv::lines(line).camera_facing().line_width_px(500.0f), tg::color3::red, "ground shadow intersects red screen space camera facing line"); + // It is fine for the green world space because the bounding box of world space moves the object up + gv::view(gv::lines(line).camera_facing().line_width_world(0.25f), tg::color3::green, tg::translation(0.0f, 0.0f, 1.0f)); + } + + // When setting a custom camera target view, the camera jumps the first time it is dragged with the left or right mouse button + { + gv::view(pos, gv::camera_transform(tg::pos3(1, 1, 1), tg::pos3(0, 0, 0)), "explicit start position and target creates jumping camera upon first drag"); + // gv::camera_orientation works fine + gv::view(pos, gv::camera_orientation(125_deg, -15_deg, 1.7f), "explicit camera azimuth/altitude/distance works fine"); + } + + // Artifacts on grazing angles + // When the camera is outside of the capsule but close to the line spanned by its axis, all sorts of artifacts occur + { + gv::view(gv::lines(line).line_width_px(250.0f), lineColors, "artifacts on grazing angles (screen space)"); + gv::view(gv::lines(line).line_width_world(1.5f), lineColors, tg::translation(0.f, 0.f, 5.f), "artifacts on grazing angles (screen space)"); + // Screen space camera facing lines seem fine + // gv::view(gv::lines(line).line_width_px(250.0f).camera_facing(), lineColors, tg::translation(0.0f, 0.0f, -25.f)); + } + + // Camera facing points are always black + { + gv::view(gv::points(pos).square(), tg::color3::cyan, "camera facing points are black even though color configured"); + // gv::no_shading makes no difference + } +} + int main() { // create a rendering context @@ -671,5 +712,8 @@ int main() headless_screenshot(pos); } + // known issues + known_issues(pos); + return EXIT_SUCCESS; }