You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class metal : public material {
public:
metal(const color& a, double f) : albedo(a), fuzz(f < 1 ? f : 1) {}
virtual bool scatter(
const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered) const override {
...
}
public:
color albedo;
double fuzz;
};
Why we can create metal with negative fuzz? I think we need something like that: metal(const color& a, double f) : albedo(a), fuzz(abs(f) < 1 ? abs(f) : 1) {}
The text was updated successfully, but these errors were encountered:
The code already basically does this. If fuzz is negative, it just flips the X and Y axes when creating a random distribution in a circle. Since there's no particular orientation to the random set of points, flipping in any direction doesn't really matter.
That said, I'm not sure why we bother trying to clamp values > 1. Given that we allow negative values, you could specify fuzz=-20 as a way to get the same effective result as fuzz=+20. +20 gets clamped, -20 does not.
I'm inclined to remove all clamping — I'm not sure what purpose it serves. This feels to me similar to whether darkbulbs should be allowed. I'm on the pro-darkbulb team.
The code already basically does this. If fuzz is negative, it just flips the X and Y axes when creating a random distribution in a circle. Since there's no particular orientation to the random set of points, flipping in any direction doesn't really matter.
That said, I'm not sure why we bother trying to clamp values > 1. Given that we allow negative values, you could specify fuzz=-20 as a way to get the same effective result as fuzz=+20. +20 gets clamped, -20 does not.
I'm inclined to remove all clamping — I'm not sure what purpose it serves. This feels to me similar to whether darkbulbs should be allowed. I'm on the pro-darkbulb team.
Hm, bulbs emitting light-consuming darkness into a scene? I have to admit that I do like the concept.
Why we can create metal with negative fuzz? I think we need something like that:
metal(const color& a, double f) : albedo(a), fuzz(abs(f) < 1 ? abs(f) : 1) {}
The text was updated successfully, but these errors were encountered: