shmuelzon / home-assistant-floor-plan

Home Assistant Floor Plan Generator Plugin For Sweet Home 3D
MIT License
129 stars 4 forks source link

Q/A: What's the difference between renders and floorplan folders? #38

Closed guimatheus92 closed 2 weeks ago

guimatheus92 commented 2 weeks ago

I selected the CSS option and generated images in renders and floorplan folders, what's the difference between them please?

How does CSS option actually works when user select that option?

shmuelzon commented 2 weeks ago

Hey,

The renders directory includes the rendered images as generated by SH3D. The floorplan directory includes the images you need to copy over to Home Assistant. With the CSS option, both directories are pretty much the same, except that the base image (with all the lights turned off) exists only in the floorplan directory. This is because in this mode, we let the browser to the light blending and this plugin doesn't need to do anything special. With the room overlay mode, the renders, again, includes all the images generated by SH3D while the floorplan directory will include the processed images with the transparent background. The renders directory was created (back when room overlay was the only option) in case one wanted to change any parameters (like the sensitivity) to generate a new floor plan without needing to wait for all the renders from SH3D, which don't change. It's basically a cache of rendered images.

As for how it works, my understanding is that when using the CSS mix-blend-mode: lighten option, the browser blends two (or more) images that overlap but checking, for each pixel, which one is brighter and displaying that one. So if one image (the base) is darker at a specific pixel and another image, with light on, has a brighter pixel value, the browser will display the brighter one.

Hope that helps!

guimatheus92 commented 2 weeks ago

Thank you very much for the explanation, I feel that README file should be improved. So I will make some changes and test on my end and also update the README file.

Based on your explanation, the option Use existing renders? was meant to work only with Room overlay mixing mode? Or does this option works with every mode?

image

shmuelzon commented 2 weeks ago

Technically, it can work with any mode. You can start with the CSS mode and generate the least number of needed renders but then decide to switch to room overlay. When doing so, you already have part of the required renders and there's no need to generate them again. If you started with room overlay and switched to CSS, you'll have all of the required images and the whole process will be done in a few seconds