akej74 / hdri-sun-aligner

Blender addon for aligning an object (e.g. a sun) to match the brightest part in a HDRI environment
GNU General Public License v3.0
118 stars 14 forks source link

Problem processing large HDRIs (16k) #1

Closed mindflvx closed 5 years ago

mindflvx commented 5 years ago

Blender 2.8 crashes after clicking on "Calculate sun position".

After clicking the button, the application processes for a while and then just closes. Tested with various HDRI images but always the same occurs, even when using an 1k image. Blender 2.8 version from 2019-04-07 so newest at the time, HDRI Sun Aligner version 1.2.

akej74 commented 5 years ago

Thanks for the report, but I'm unable to reproduce the problem. Downloaded the latest daily build from the buildbot (blender-2.80-d2d84132ddf9-win64.zip), everything works fine (tested with a 1k HDRI from HDRI Haven). Could you try "Load Factory Settings", enable the addon again and see if it works?

mindflvx commented 5 years ago

Thanks for taking the time, I will test with a clean install and report back. I too was testing with a HDRI Haven image so that I assume that rules out any odd image issues. My Blender installation is pretty much stock but I presume it might be another add-on that's causing a conflict.

mindflvx commented 5 years ago

My bad, it seems like the issue only occurs with 16k images and not 1k ones, they work fine. I assume earlier on when I was testing I had accidentally loaded a 16k image instead of a 1k, hence the incorrect report. In any case, I tested again with a clean installation and empty scene but the issue persists with 16k images. Might be system specific, who knows.

It's not really a deal-breaker because you can always use 1k for setting everything up and then switch to a larger resolution. Thanks for this great tool, setting up the sun is always somewhat pain and this makes it completely effortless.

akej74 commented 5 years ago

Thanks for the update! There is indeed a problem with large HDRI's, I suspect it's the "gaussian blur" function that runs out of memory (probably already with 8k HDRI's).

My idea to fix this is to scale down the HDRI if it's larger that 1k and then do the calculation (as using a scaled down version will not affect the accuracy of the sun position). Stay tuned for an update.

Side note: I have some new stuff in the "Develop" branch, a new function that adds a driver to an object (most applicable for a sun lamp) to keep the rotation in sync even if you rotate the HDRI with a mapping node (see the thread on blender artist for more details). Just in case you would like to try it out :-)

mindflvx commented 5 years ago

Yes, that explains it - I kind of suspected a memory issue too. Great to hear you're already aware of it and thinking about the solution! I assume downscaling the HDRI would work perfectly well, like you mentioned it shouldn't really affect the sun position accuracy. Let's face it, 16k is pretty overkill for that purpose ;-)

Oh, you already have a sun rig implemented? That's awesome news! I'm used to setting one up manually when working with V-Ray so having something like that automated would be godsend. I'm definitely going to give it a try, thanks for the heads-up!

akej74 commented 5 years ago

Hi, I just updated the develop branch with a fix for processing large HDRI's. Now, a 8k takes ca 5 seconds to process, a 16k ca 15 seconds (tested on a i7 7700k 5 GHz CPU). Not instant, but better than a crash :-). Please give it a try.

Note that used memory on my test machine increased from 7.9 GB to 12.7 GB while processing the 16k HDRI.

akej74 commented 5 years ago

Master branch is also updated, release 1.3.

mindflvx commented 5 years ago

Sorry for the slow reply, been very tied up with real work ;-)

Thanks for the update, just gave the latest version a go with a 16k HDRI and it's indeed working perfectly! Nice work. Like you mentioned it takes something like 15-30 seconds to process that large HDRI but really, it's nothing considering the size and I take that anytime over a crash :)

I think this issue can be closed now.

akej74 commented 5 years ago

Thanks for testing the new version! Let me know if you would like to see some other feature implemented 😀