adizanni / floor3d-card

Your Home Digital Twin: aka floor3d-card. Visualize Home Assistant state and perform actions using objects in a 3D home model based on Three.js.
https://github.com/adizanni/floor3d-card
MIT License
452 stars 65 forks source link

New Sun setting causes artifacts at top of walls #83

Closed reaper7 closed 2 years ago

reaper7 commented 2 years ago

Hi!

The new SUN setting causes artifacts at top of walls and other elements that reach the height of the room. This only occurs when the SUN and SHADOW options are enabled. When the sun is low (near the horizon) or at night then artifacts are not visible.

art1 art2

adizanni commented 2 years ago

Hello Reaper, have you put a "transparent_slab" in your model ? I have the same behaviour only when putting the transparent_slab on top of the floor. If you have not put that in your model, please send me your model so that I can check why this is happening.

reaper7 commented 2 years ago

yes, I have translucent elements placed there... like translucent bathroom panel lamps (hidden when turned on) and fragment of a hallway lowered ceiling with spot lamps.

art

adizanni commented 2 years ago

I'm looking into it: maybe some iddent property of the the transparent material. As I can reproduce it, I will take care of investigating.

adizanni commented 2 years ago

hello @reaper7, I've understood the cause of the issue. When the objects have exactly the same elevation, the shadow behaviour is not very well managed. I'm exploring some parameters, but so far when I fix the strange shadow pattern I introduce other side effects. So if it is not bad for your model try to alter slightly the elevation of the transparent objects to make them slightly higher or lower in SH3D (0.5 cm is enough). So far it is the only workaround I can suggest, please let me know

reaper7 commented 2 years ago

Hi @adizanni, I removed all the elements and left only the rooms and the walls but the artifacts are still there.

Schowek01

adizanni commented 2 years ago

Have you verified what is the color that is set for the top of the wall in SweetHome3d ? You can try to set it to white instead of default. Patterns appears only on some walls......

reaper7 commented 2 years ago

on a simple model with white top artifacts are almost invisible simple1

but on my model (only with walls) they are still visible simple2

the strange thing is that the artifacts cause the items below, like windows simple3

second, strange thing, why the shadow of the sun looks like stairs? it shouldn't be more like a straight line ? maybe this is causing these weird stripes on top of the walls? simple5

simple4

adizanni commented 2 years ago

Yes @reaper7, the shadow generated by the sun is not defined well (low resolution) because it is requiring a lot of calculation. And I also think that it is causing the patterns on the wall. I will check if I can improve

reaper7 commented 2 years ago

@adizanni - relax :) it's a nice addition but I temporarily turned it off, the graphic system is at the limit :)

it is a pity that the tops of the walls cannot be eliminated from the calculation and lighting (in the real world, they are invisible elements)

adizanni commented 2 years ago

I have created the possibility to put what I call "transparent slab". If you put an invisible object on the ceiling of your floor light is blocked. Condition for it to work:

  1. the objects should be named transparent_slab* (meaning you can have more than one but the name of all of them should begin with transparent_slab.
  2. you have to use the ExportToHass plugin in order for it to work

Unfortunately, even when you cover the full model with a transparent slab, the pattern appear.....

reaper7 commented 2 years ago

is it possible to add a exclusion group where there will be elements on which we do not want shadows to be generated ? (tops of the walls are separate elements)

we have a similar solution for lights sources where there is a global shadow: 'yes/no' and an individual shadow: 'yes/no' for each light

adizanni commented 2 years ago

Yes you are right the wall top is always named the same way so I could exclude it from receiving shadow. I will study a way to make this working in all scenarios (the one you propose seems good). In the meantime please have a look to the v1.3.9 (I'm releasing it right now) with a soft shadow effect.

adizanni commented 2 years ago

In the new version I have also allowed the ceiling. When Ceiling are dispIayed in Sweethome3d, they turn into transparent shields for the sun (no light pass through them). Activating this feature I realized that the patterns are only appearing on top of the wall when there is a hole or a door underneath.

reaper7 commented 2 years ago

@adizanni - 1.3.9 is better for me, artifacts are much less visible. It is no longer a chessboard with high contrast and transitions are softer. simple_new1

simple_new2

adizanni commented 2 years ago

Have you tried to use the ceiling in SweetHome3d (it seems yes from the pictures) ? I think that it will be difficult for me to achieve better, but I can keep this issue open for continuous improvement and other cases that may be discovered by users.

reaper7 commented 2 years ago

To be honest I don't know where the ceiling settings are in sh3d, I searched yesterday but couldn't find it.

I think it's ok. Maybe new ideas will emerge over time :)

adizanni commented 2 years ago

The ceiling parameter is in the room properties dialog (double click on the room)

image

reaper7 commented 2 years ago

indeed, I have a ceiling in each room, color White and Matt

adizanni commented 2 years ago

So this is what I saw. Good

adizanni commented 2 years ago

@reaper7 can you state if we can close the issue ?