unexpected surface "shimmering" when model argument is given to turn command with soft lighting

Hi all, I was playing around with movies where I rotate models around their own centers and noticed an unpleasant (to my eye) rendering glitch. Steps to reproduce (this is with 1.7rc202311150127): close open pdb:7vja; lighting soft; surf; ~show; view movie record; turn y 1 360 model #1; wait 360; movie encode test_spin_model.mp4 movie record; turn y 1 360; wait 360; movie encode test_spin.mp4 So we have two "spin" movies of the same surface, but one of them ("test_spin_model.mp4") has a shimmering artefact. At first I mistook this for a video compression artefact, but it's there in the "live" rendering and it disappears if I drop the "model" argument to the "turn" command. Also, I can't reproduce this if I don't use soft lighting. I will try to send the movies as attachments to a reply to this email (not sure they'll go through). Cheers, Alexis

Attached are the movies that I got when I ran the commands listed below. On Mon, Dec 11, 2023 at 3:47 PM Alexis Rohou <a.rohou@gmail.com> wrote:
Hi all,
I was playing around with movies where I rotate models around their own centers and noticed an unpleasant (to my eye) rendering glitch.
Steps to reproduce (this is with 1.7rc202311150127):
close open pdb:7vja; lighting soft; surf; ~show; view movie record; turn y 1 360 model #1; wait 360; movie encode test_spin_model.mp4 movie record; turn y 1 360; wait 360; movie encode test_spin.mp4
So we have two "spin" movies of the same surface, but one of them ("test_spin_model.mp4") has a shimmering artefact. At first I mistook this for a video compression artefact, but it's there in the "live" rendering and it disappears if I drop the "model" argument to the "turn" command. Also, I can't reproduce this if I don't use soft lighting.
I will try to send the movies as attachments to a reply to this email (not sure they'll go through).
Cheers, Alexis

Hi Alexis, The flickering on the surface of your spin movie is a limitation of the ChimeraX ambient shadow calculation. When you spin each model about its own center then the shadows have to be recalculated every frame because models are moving relatively to one another and so different shadows are cast. The ambient shadows are cast from 64 different directions (not very many) and that causes flickering on the surface. When you rotate all models at once in ChimeraX then in fact none of the models move in the scene coordinates and the camera simply rotates around the models and ambient shadows are not recomputed, so you don't see any flicker. The ambient shadows are from uniformly distributed lights in the scene coordinate space. So to reduce the flicker you increase the number of ambient shadow lights. This will make it render much slower. Using the default 64 shadow directions does 64 renderings to compute the cast shadows. So using 512 shadow directions will be 8 times slower. And there is a limit to how many directions your GPU can handle due to a graphics language buffer size limit. At any rate you can ask for 512 shadows using lighting multishadow 512 In addition to the number of shadow directions there is a shadow map size that is the size of the 2D texture that records the shadow depth for each light source. By default ChimeraX uses 1024 x 1024 which is shared by all the lights. If you increase that number the shadow boundaries become sharper, decrease it and they become blockier. Both directions give artifacts and the value more controls the extent of the artifacts, larger spatial scales for smaller texture size, finer spatial scale artifacts for larger texture size. In tests I found 1024 light directions with 4096 texture size was noticeably better than 512 shadow directions and 4096 texture size. lighting multishadow 1024 msMapSize 4096 Both 512 and 1024 directions were much less flickery than the default 64 directions. But both still show slight flicker. Tom Here I attach a spin movie with the standard settings 64 light directions, 1024 shadow map size (took ~5 seconds to record), and following that a movie with 1024 light directions and 4096 shadow map size (took about 3 minutes to record). 
On Dec 11, 2023, at 3:47 PM, Alexis Rohou via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi all,
I was playing around with movies where I rotate models around their own centers and noticed an unpleasant (to my eye) rendering glitch.
Steps to reproduce (this is with 1.7rc202311150127):
close open pdb:7vja; lighting soft; surf; ~show; view movie record; turn y 1 360 model #1; wait 360; movie encode test_spin_model.mp4 movie record; turn y 1 360; wait 360; movie encode test_spin.mp4
So we have two "spin" movies of the same surface, but one of them ("test_spin_model.mp4") has a shimmering artefact. At first I mistook this for a video compression artefact, but it's there in the "live" rendering and it disappears if I drop the "model" argument to the "turn" command. Also, I can't reproduce this if I don't use soft lighting.
I will try to send the movies as attachments to a reply to this email (not sure they'll go through).
Cheers, Alexis
_______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/

Hi Tom, Thanks for the patient explanation. I think I understand. I tried your settings (lighting multishadow 1024 msMapSize 4096), redid the spin movie, and couldn't see any of the shimmering artefacts in the result. Beautiful! Cheers, Alexis On Mon, Dec 11, 2023 at 5:19 PM Tom Goddard <goddard@sonic.net> wrote:
Hi Alexis,
The flickering on the surface of your spin movie is a limitation of the ChimeraX ambient shadow calculation. When you spin each model about its own center then the shadows have to be recalculated every frame because models are moving relatively to one another and so different shadows are cast. The ambient shadows are cast from 64 different directions (not very many) and that causes flickering on the surface. When you rotate all models at once in ChimeraX then in fact none of the models move in the scene coordinates and the camera simply rotates around the models and ambient shadows are not recomputed, so you don't see any flicker.
The ambient shadows are from uniformly distributed lights in the scene coordinate space. So to reduce the flicker you increase the number of ambient shadow lights. This will make it render much slower. Using the default 64 shadow directions does 64 renderings to compute the cast shadows. So using 512 shadow directions will be 8 times slower. And there is a limit to how many directions your GPU can handle due to a graphics language buffer size limit. At any rate you can ask for 512 shadows using
lighting multishadow 512
In addition to the number of shadow directions there is a shadow map size that is the size of the 2D texture that records the shadow depth for each light source. By default ChimeraX uses 1024 x 1024 which is shared by all the lights. If you increase that number the shadow boundaries become sharper, decrease it and they become blockier. Both directions give artifacts and the value more controls the extent of the artifacts, larger spatial scales for smaller texture size, finer spatial scale artifacts for larger texture size. In tests I found 1024 light directions with 4096 texture size was noticeably better than 512 shadow directions and 4096 texture size.
lighting multishadow 1024 msMapSize 4096
Both 512 and 1024 directions were much less flickery than the default 64 directions. But both still show slight flicker.
Tom
Here I attach a spin movie with the standard settings 64 light directions, 1024 shadow map size (took ~5 seconds to record), and following that a movie with 1024 light directions and 4096 shadow map size (took about 3 minutes to record).
On Dec 11, 2023, at 3:47 PM, Alexis Rohou via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi all,
I was playing around with movies where I rotate models around their own centers and noticed an unpleasant (to my eye) rendering glitch.
Steps to reproduce (this is with 1.7rc202311150127):
close open pdb:7vja; lighting soft; surf; ~show; view movie record; turn y 1 360 model #1; wait 360; movie encode test_spin_model.mp4 movie record; turn y 1 360; wait 360; movie encode test_spin.mp4
So we have two "spin" movies of the same surface, but one of them ("test_spin_model.mp4") has a shimmering artefact. At first I mistook this for a video compression artefact, but it's there in the "live" rendering and it disappears if I drop the "model" argument to the "turn" command. Also, I can't reproduce this if I don't use soft lighting.
I will try to send the movies as attachments to a reply to this email (not sure they'll go through).
Cheers, Alexis
_______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
participants (2)
-
Alexis Rohou
-
Tom Goddard