Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Book 1, chapter 9.6; metal fuzzy reflection #1070

Closed
VxDxK opened this issue Aug 30, 2022 · 4 comments
Closed

Book 1, chapter 9.6; metal fuzzy reflection #1070

VxDxK opened this issue Aug 30, 2022 · 4 comments
Assignees
Milestone

Comments

@VxDxK
Copy link

VxDxK commented Aug 30, 2022

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) {}

@hollasch
Copy link
Collaborator

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.

@trevordblack
Copy link
Collaborator

I was about to say more or less the exact same thing

@hollasch hollasch added this to the v4.0.0 milestone Aug 30, 2022
@alkanen
Copy link

alkanen commented Oct 28, 2022

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.

@hollasch
Copy link
Collaborator

hollasch commented Apr 4, 2024

Ref #1285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants