EntroPi-Games / GPU-Line-of-Sight

GPU Line of Sight / Field of View visualization for Unity
Apache License 2.0
129 stars 24 forks source link

LOS with Post-Processing Layers #4

Open Bjorn-S opened 2 years ago

Bjorn-S commented 2 years ago

Thank you for a great project!

I am trying to combine LOS with Post-processing layers (Unity) but cannot seem to get them to play together.

Any idea how to get them to combine? To run the post-processing layer on top of the image stack?

EntroPiGames commented 2 years ago

Do you want to apply the post processing layers only to the area outside of the LOS, or to the whole image after the LOS has been applied?

Bjorn-S commented 2 years ago

Either before or after, preferably after.

But I plan on using Temporal AA and AO.

EntroPiGames commented 2 years ago

If you want to use AA or AO, it should probably be applied after. In that case just make sure the post processing component is placed after the LOS Mask component on the camera.

Bjorn-S commented 2 years ago

Thank you for the response.

Problem the camera goes black when placed before and the LOS is not visible when placed afterwards.

Any ideas?

EntroPiGames commented 2 years ago

Is this with v2 of Unity' post processing stack? Which image effect are you applying to the LOS?

Bjorn-S commented 2 years ago

I fixed it with unchecking "Directly to Camera Target" on the post process v2 stack.

Is there a way to apply this post process to the actual LOS without writing a shader? Because it doesn't seem to effect the LOS when I apply for example Lens distortion.

EntroPiGames commented 2 years ago

Is there a way to apply this post process to the actual LOS without writing a shader? :)

Not sure if it will work, but have you tried moving the post processing component between the LOS buffer storage and mask component?

This system was designed before the new post processing was released, and I currently don't have the time to rewrite it to properly support it.

jhughes2112 commented 2 years ago

If you wanted to integrate this directly with the PPSv2, you could look at my free asset that does something similar, as a guide on how. My asset does pixel-perfect outlines and uses the depth buffer, which PPSv2 clobbers with certain effects. If you integrate with its stack, your effect can be slide up or down in the render order so users could put it into play at the right place. It's called Post Liner Free on the asset store, so you can check out the code w/o paying anything. Nice project!