Page MenuHome

Sun Position: add Show Surface and Show Analemmas options
ClosedPublic

Authored by Eduardo Schilling (elschilling) on Jan 6 2023, 5:42 PM.
Tags
None
Subscribers
Tokens
"Burninate" token, awarded by slowburn."Like" token, awarded by duarteframos."Like" token, awarded by Alaska.

Details

Summary

Sometimes during the design it's difficult to rapidly visualize the
Sun trajectory for a given location in the viewport.

This patch adds the possibility to visualize the sun path surface and
analemmas for each hour in the viewport.

Currently there is an option to create a collection with objects to
draw analemmas and diurnal ready for render but these new options
options give fast viewport feedback, something like the Show North
option.


Diff Detail

Repository
rBA Blender Add-ons
Branch
sun_surface
Build Status
Buildable 25268
Build 25268: arc lint + arc unit

Event Timeline

Eduardo Schilling (elschilling) requested review of this revision.Jan 6 2023, 5:42 PM
Eduardo Schilling (elschilling) created this revision.

Hi, thanks for the patch. Could you describe what it does, maybe add a few images? A description should be reusable as a commit message as well.
From what I understand, it draws additional visualisations in the viewport. I can guess what the analemma is, but what does the surface represent? Why are there multiple analemmas?
There is already a way to visualise analemmas, how is this one better?

I just skimmed through the code, I’ll try to have a better look at it and test it on the week-end.

sun_position/sun_calc.py
664–670

It looks like this is computed on every update, whether or not the surface is actually shown. Can this be skipped?

684–690

It looks like this is computed on every update, whether or not the analemma is actually shown. Can this be skipped?

sun_position/ui_sun.py
206–207

If p.show_surface is false, this prop is drawn in an other column, maybe the show_north col or the previous one. It needs its own column.

Hi Damien thanks for the fast reply, I was looking to talk about the ideia with you in the chat and forum and people suggested to just submit the patch. This is my first time doing this, just added a description and will work to improve the code after your observations.

  • skip calculation when option is off, buttons layout, file mode fixes

After refactor of the add-on, a few additional changes were made:

  • tweak UI
  • use a single batch for the analemmas
  • use day_of_year for analemmas, so that we can
  • use a step for the analemmas, to skip many points and improve performance
  • simplify surface calculation
Damien Picard (pioverfour) retitled this revision from Sun Position addon Show Surface and Show Analemmas options to Sun Position: add Show Surface and Show Analemmas options.Jan 8 2023, 3:13 AM
Damien Picard (pioverfour) edited the summary of this revision. (Show Details)

Thanks for the description, I can see how useful this can be! There are many small things I’d like to change as to how the code is structured. I took the liberty to update the patch myself, let me know what you think.

Enable surface transparency

Thanks for the description, I can see how useful this can be! There are many small things I’d like to change as to how the code is structured. I took the liberty to update the patch myself, let me know what you think.

I think the new structure reads a lot better! Just learned a new way of doing math with python, really appreciate that. Happy to collaborate with this amazing addon!

Enable surface transparency

Wow very cool! I want to learn more about the gpu module and how to draw things in the viewport with the python API. Something I was thinking is perhaps avoid drawing the flat region of the surface (where z < 0) but was not capable of finding a way to do. Other idea is to add an option to create a mesh to allow easily render the surface if needed.

Maybe for another patch?

This revision was not accepted when it landed; it landed in state Needs Review.Jan 8 2023, 2:40 PM
This revision was automatically updated to reflect the committed changes.

Something I was thinking is perhaps avoid drawing the flat region of the surface (where z < 0) but was not capable of finding a way to do. Other idea is to add an option to create a mesh to allow easily render the surface if needed.

Maybe for another patch?

Sure thing, those could be useful!