Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Change stencil to scissor test in SSAO #175

Merged
merged 1 commit into from
Apr 12, 2021
Merged

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Apr 3, 2021

This pr swaps out the stencil test for a scissor test, which works regardless of clear. This does have some other potential issues though. The ssao postprocessor should only run once per pixel. With the scissor test multiple overlapping scenes could be running it, making things darker than they should be. To avoid this somewhat I only allowed leaf scenes (i.e. no children) to run SSAO. This means that SSAO will be wrong if a scene with children has a different projection matrix than it's children, or if its children cover less area. (I think this should be very rare?)

See also: JuliaPlots/AbstractPlotting.jl#624
I'm pretty sure JuliaPlots/AbstractPlotting.jl#649 breaks SSAO again (it uses clear = false) which this pr should fix.

@ffreyer
Copy link
Collaborator Author

ffreyer commented Apr 3, 2021

Yup it does break SSAO: (more or less the example from docs/lighting)
Screenshot from 2021-04-03 18-10-25

With this pr:
Screenshot from 2021-04-03 18-09-07

@ffreyer
Copy link
Collaborator Author

ffreyer commented Apr 3, 2021

This will also be useful for JuliaPlots/AbstractPlotting.jl#677 because it allows us to use clear = false in LScene and Axis3, which in turn allows information to be visualized in the screen space scene of the parent figure.

@SimonDanisch
Copy link
Member

Hm, I'm pretty sure i had pretty important reasons for using stencil tests, since they're much more complicated and the initial version used scissor tests... I need to try to remember the reason before we can merge this :D

@ffreyer
Copy link
Collaborator Author

ffreyer commented Apr 6, 2021

This is just the ssao postprocessing, not general rendering (i.e. not any plot rendering). I set it up with the stencil buffer originally, see #97

@SimonDanisch
Copy link
Member

Oooh, the code looked so similar to the window rendering code :D I see... Ok, lets merge this then!

@SimonDanisch SimonDanisch merged commit 099bb6f into JuliaPlots:master Apr 12, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants