Hello all !

I am struggling with a rather simple patch: I am trying to model the reflection of a ray of sun on a mirror ( I guess a 3d planar symmetry on the Normal of the mirror ? ).

I haven t used transforms for years and my brain seem to just snap on this, any help would be greatly appreciated !

Mirror_ray.v4p (40.6 KB)

1 Like

hey Joanie,

the formula for reflecting a vector on a surface with normal vector **n** is:

`reflection = vec - (2 * dot(vec, n) * n)`

where **n** is normalized.

here is a patch implementing it:

Mirror_ray_formula.v4p (34.7 KB)

2 Likes

Thank you sooooo muuuuuccccchhhh <3 !!

I was starting to look into the formula and patching, but your implementation saved me a lot of headache :) Thanks !! Will keep you posted on the outcome, trying to make a solar projector !

2 Likes

The solar projector prototype is slowly taking shape, even if itâ€™s a lot more challenging than I expectedâ€¦

Iâ€™m now trying to reverse @tonfilm calculation and solve the mirror angle from the reflection and sun vectors, and my brain still canâ€™t figure out the right function (my projections are drifting slowly with the sunâ€™s position) :/ Any help would be amazing :)

Mirror_ray_formula_mirror_angle.v4p (68.7 KB)

CLEARER PATCH REUPLOADED

1 Like

Bonjour Joanie

Je sais pas si jâ€™ai bien compris ton problĂ¨me de rotation, mais je pense quâ€™ avec rotate et inverse, tu peux trouver facilement la rotation de ton quad.

2 Likes

Thanks a lot for looking @lecloneur !

Itâ€™s not quite there unfortunately, the orientation should match the reference mirror (top left in the patch; in blue).

I re-uploaded a clearer patch that better explains the challenge.

Mirror_ray_formula_mirror_angle.v4p (68.7 KB)

1 Like

Isnâ€™t this a simple Cross product?

Ah reflection from two vectors, this would need more data since there would be quite a lot of solutions

So you have sun point, you have reflected point and mirror position, and you want to align plane

1 Like

I have sun and reflection vectors, and Iâ€™m trying to figure out the mirror orientation.

Hereâ€™s a better patch that explains what Iâ€™m after, with the solution (C) to double check.

Mirror_ray_formula_mirror_angle.v4p (68.7 KB)

Hereâ€™s a tip from mirror / sun master @elliotwoods !!

Not sure how to implement it yet, but the best lead I guess.

mirror normal = norm(norm(direction towards sun) + norm(target - mirror position))

it becomes much simpler if you think in directions instead of rotations.

then you have the direction from the mirror to the sun and to the destination. the normal vector of the mirror is then simply the average, or center, between them:

Mirror_ray_formula_mirror_angle2.v4p (71.2 KB)

EDIT: you can omit the multiplication by 0.5 because the vector gets normalized anyway. So it becomes simply a + operation.

3 Likes

yes, exactly, this is what the patch above does. :)

1 Like