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

Extended Beam tool with divergence options #102

Merged
merged 2 commits into from
Jun 3, 2023

Conversation

dorrington
Copy link
Contributor

Added an option on the Beam "parallel" tool to have a divergence angle, to add Lambertian weighting to diverging emissions and to use random emission position and angles. Useful addition for my application where I want to simulate an extended source, setting divergence to 180° and enabling Lambertian weightings.

@ricktu288
Copy link
Owner

There are two minor issues on this implementation:

  1. It seems that the beam is not dense enough in the angular direction to solve Pencil bending illusion and equidistant 360 degrees point sources #56
  2. When using "All images" or "Seen by Observer", the case of emission angle = 0 is interpreted as a light source at infinity but the case of emission angle > 0 is interpreted as a bunch of light source at that line segment instead. It seems that there are two different situations that corresponding to two image detection schemes.

Since I do not have a good solution either, I will still merge this next Friday if no solution is provided.

@dorrington
Copy link
Contributor Author

  1. It seems that the beam is not dense enough in the angular direction to solve Pencil bending illusion and equidistant 360 degrees point sources #56

By cracking the beam brightness all the way up to 2 and using a large lens to collect as much light as possible I've been able to persuade the illusion to appear.
Screen Shot 2023-05-21 at 10 35 22 AM
pencil beam.json.zip

  1. When using "All images" or "Seen by Observer", the case of emission angle = 0 is interpreted as a light source at infinity but the case of emission angle > 0 is interpreted as a bunch of light source at that line segment instead. It seems that there are two different situations that corresponding to two image detection schemes.

Sorry, I don't grasp the issue. What's the desired behaviour in this case? Could you please elaborate?

Cheers!

@dorrington
Copy link
Contributor Author

I've also made some enhancements to the text tool. I really wanted to be able to change the font size, rotation, and update the drag behaviour so when snap to grid is selected, the text keeps its relative position to the grid. I did that, and then just got carried away, really. Can also change type face, style (bolt italic etc), alignment, small caps, and have multiple lines of text.

image

To do this, I had to add a drop-down and text area functionality to the parameter box tools. Perhaps someone who's much better a CSS than I am could make them look nice.

Sorry, it wasn't my intention for this to be automatically included in the same pull request, but perhaps that's a good thing after all? Or should I have created a new branch for these changes? This is my first time contributing to a Github project, so please bear with me as I figure things out! Advise gratefully accepted.

@ricktu288
Copy link
Owner

Sorry for late reply (I only maintain this repo on Friday nights)

  1. Solving Pencil bending illusion and equidistant 360 degrees point sources #56
    I think the point is not whether it can be solved with some hacking, but is that whether a naïve user can build the desired behavior based on usual intuition. Also, I think your solution only works if the angle between the source and the surface is not too large. For larger angle, the image is not shown even if lights do intersect there:
    圖片
    圖片
    Currently, I do not have enough time to check for the underlying reason, but I guess that solving this issue may lower the performance of the ray tracing. If this is the case, I think we may just keep it as it is, since this is a minor issue anyway.

  2. The source interpretation problem
    For example, if you shine a beam to an ideal lens, and use the "All images" mode. When "emission angle" is zero, the image is shown in the position as if the source is at Infinity:
    圖片
    However, once "emission angle" is nonzero, the image is instead shown in the position as if the source is the line itself:
    圖片
    While this behavior is technically correct, I think it might be a bit unnatural, as the discontinuity does not have a physical meaning, but simply because of a reinterpretation of the source by design. Even if the emission angle is not zero, it is still physically meaningful to interpret that as a series of beams from infinity (although this interpretation is less useful). However, I cannot think of a better behavior (so I have no “desired behavior” in mind). One way is to add a checkbox or dropdown for the interpretation of the source, but this will make the tool quite awkward, and therefore not a good solution. I think unless someone come up with a good solution, this behavior is good enough and does not need to be changed.

However, there are two serious issues that should be solved before I can merge this PR:

  1. The beam and text tools are not backward compatible. Create the following scene in the old version:
    圖片
    Open with the new version, and adjust the emission angle of the second beam:
    圖片
    The brightness of the first beam is wrong after reflection, and the text is not shown in the original font.

  2. The multiline feature of the text tool does not support Firefox, and it makes the text non-selectable:
    圖片

@ricktu288 ricktu288 merged commit 175f651 into ricktu288:master Jun 3, 2023
ricktu288 added a commit that referenced this pull request Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants