How can I make the background color of a (3D) scene contained within an LScene ? Including backgroundcolor=:black in the scenekw arg doesn’t seem to do it, nor does setting the attribute directly on lscene.scene . However, setting the attribute on scene seems to change lscene.scene.attributes[:background].
With a bit of fumbling around I found that if I set lscene.scene.clear=true then I get the effect that I’m looking for in particular which is a black background. However if I use a different color, e.g. lscene.scene.attributes[:background] = :purple then this kills performance; also it seems that once that attribute has been set it can’t be changed.
Not as yet. Though I do wonder if it’s related to some of the other performance issues on MacOS and wonder if anyone can duplicate it on another platform.
That works for me as well but I think the issue I’m seeing has to do with wanting to have a different background color in a 3D LScene within a larger layout which has another background color. I probably should have made that part clearer in my post.
With regards to what I was observing about performance when I used :purple I just noticed something that I hadn’t before: it seems that the background in this case actually isn’t a constant purple but actually there is a very subtle color gradient towards black at the edges:
The really weird thing is that not every color causes this. I just picked purple at random; when I change that one word :purple in the code to :green instead, I see no gradient and no sluggishness:
Fortunately, as I mentioned in the original post, :black works in that it doesn’t kill performance, and I do get what I’m looking for which is something like this:
(in this last I also used the set_theme! as suggested to get the grey background outside of the 3D view).
Anyhow to be clear, for now I have the output I’m looking for but I really can’t say I understand why it works, and in particularly why lscene.scene.clear=true is important, and why I sometimes see the gradient and performance behavior based just on what color I specify in the scenekw args in the LScene call.
Is someone aware of a similar example combining controls on a different-color background, with a 3D view (subscene? LScene?), all using the newer layout API?
I’ll try to get to making a MWE and post it so others can explore this if they want, but unless maybe something about the gradient makes one of you Makie experts say ‘aha’, I won’t be too sad about going forward with what I have.
The gradient is an SSAO artifact I think, and that’s also what drags down performance. At least @ffreyer said something to that effect if I’m not mistaken, and he’s the one who implemented it and currently has a PR active to fix this (and disable SSAO by default)
SSAO uses a normal buffer which gets cleared to (1,1,1) at the start of the drawing process. I use that clear value to discard pixels that have no geometry. What I overlooked is that the background color again clears that buffer, so if you set it to something other than white the ssao pipeline thinks there is geometry there. I pushed a fix in the pr that allows you to skip the whole SSAO pipeline.