Hot answers tagged

1

Everything in this code functions as intended, until I try to translate the entire grid (grid lines) to the center of the screen by adding v_Resolution.x / 2 to uv.x. Not sure what your intention is here since the Shadertoy example you referenced generates an infinite grid. So maybe you can clarify that. However, I think I can help you with this problem: .....


1

This code below can cause an 8bit overflow. auto traceRay = [&](const point_t O, const vec3d D, const int min, const int max) -> color_t { ... return color_t{uint8_t(closest_sphere.color.r * total_light), uint8_t(closest_sphere.color.g * total_light), uint8_t(closest_sphere.color.b * total_light), 255}; Here ...


1

It looks like the parameters to your camera class are not correct const int img_ratio = 2; ... Camera<float> cam1(20.0f, img_ratio, Point3<float>(0.0f, 0.0f, 0.0f), Point3<float>(0.0f, 0.0f, -1.0f), Vec3<float>(0.0f, 1.0f, 0.0f)); In your code you set img_ratio to 2, I would expect it should be something like img_width/img_height (...


Only top voted, non community-wiki answers of a minimum length are eligible