1 like 0 dislike
2.3k views

Hi,

My team and I really like the power of PopcornFX, and are hoping to use for our up coming game, but so far we've encountered a conflict with it rendering in front of geometry when we add the image effect SE Screen-Space Ambient Occlusion (SESSAO). We are also using deferred rendering in case that might be a factor. 

From my initial debugging, I seem to have narrowed it down to two lines being called by the SESSAO script.

OnStart()

{         

    attachedCamera = this.GetComponent<Camera>();

    attachedCamera.depthTextureMode |= DepthTextureMode.Depth;

    attachedCamera.depthTextureMode |= DepthTextureMode.DepthNormals;

}

By changing the "depthTextureMode" to either Depth or DepthNormals, it seems to clear something being used by the PopcornFX Rendering Plugin and causes it to draw effects over top of the scene despite any three dimensional occlusion that would normally occur.

Is there by any chance something within the plugin that can be set to remedy this?

 

The following attempts have not yielded any results:

- Turned on the "Has Post FX" setting on the Rendering Plugin.

- Tried re-ordering script execution of the image effects within Unity.

 

Thank you for any help you can provide.

 

EDIT:

After a bit more research, it seems as though the problem occurs when SSAO is combined with specific shaders that change the renderQueue. In some shaders that set their "Queue = Geometery+501", some transparent PopcornFX ribbons are rendered in front of geometry.  Below details my current setup, and how to replicate the issue.

Unity Version: 5.1.1f1

PopcornFX Rendering Plugin for windows: Build 1.8.2.25815 (current one available on the asset store)

Popcorn Editor: v1.8.2.25908

 

Here is how you can replicate the issue in a new project.

- Create new project.

- Import "PopcornFX Particle Effect Plugin (Windows Mac Linux) 2.5p1"

- Import "SSAO pro"

- Open scene "Sample_Teleporter".

- Add SSAO pro to the camera, and set the camera to “deferred”

- Add a default cube between the camera and the teleporter, and scale it so that it covers half the screen.

- Add another default cube and position it in the center of the screen between the camera and the previous cube. Then create/add a “standard” material to it and set its rendering mode to “Transparent” or “Fade”

- press play and move the "Transparent cube" in and out of the camera view to see the particles appear/disappear.

If required, I can also provide a test project I made that displays this issue.

by
After some further testing, It seems that this issue is not just restricted to just SESSAO. It appears to be present with any screen space image effect that uses/alters the depthTextureMode.

2 Answers

0 like 0 dislike

Hi,

Are you using the latest version of the unity plugin, which is v2.5p1 (Build 1.8.2.25903) ?

And what is the version of unity you are using ?

That reminds me that we encountered  some issues with certain image effects like SSAO some time ago.

But, I just tested the plugin with different scenarios with the standard image effects "Screen Space Ambient Occlusion", "Screen Space Ambient Obscurace" and another pro plugin "SSAO Pro".

And all thoses image effects apparently work with the PopcornFX plugin.

Unfortunately I could not give it a try with this specific SSAO plugin.

Could you tell us if you experience the same issue with other screenspace effects (that I can test) ?

Another thing that is good to know, in unity 5.2, they extended the native rendering interface API.

 

It will use the CommandBuffer module, so we will not be stuck with rendering the particles at the end of the transparency pass anymore.

In that way, we should be able to render particles in a specific render path allowing us to have:

-          Particles that light the scene
-          Particles can be rendered in the opaque pass, etc …

And certainly avoid some conflicts like this, as we will have more control over the rendering order

Thanks.

 

 

by Maxime (640 points)
Hi Maxime,

I've edited the question above to provide some further details about the issue, and how you can replicate it with SSAO pro and default Unity.

my current rendering plugin is 2.5p1 (build 1.8.2.25815). Is there by any change somewhere else I can get the latest rendering plugin build provided I input my asset store information?
Oh as well, that's great to hear about Unity 5.2. I would love to get my hands on the plugin for 5.2. If there's any chance of getting a beta of the PK rendering plugin, please let me know.
Hey Maxime,

I was wondering if you we able to replicate the issue I encountered, as detailed in the edited question above.
Hi,

Sorry for the delayed response.
If you want, we can provide you the latest plugin as well as the beta version 5.2 when available, just drop a mail to support@popcornfx.com
Can you send us your test project, as we can't reproduce the issue.
Thanks !
Hey Maxime, yeah that'd be great to get the beta version of 5.2 when it comes out! I'll contact your support email about it. As for the test project, I've put one together, but I just need to get approval from the SESSAO author before I can send it to you guys.
Hi Maxime,

I was able to replicate the issue without a third party shader. I've sent the project to your associate Raphael at your support email.
1 like 0 dislike

Just for posterity, here are the final issues and solutions that the PopcornFX support team helped me resolve.

Problem 1: My shader script had the [ImageEffectOpaqueattribute on the OnRenderImage method.
something about this attribute breaks ztesting for some reason, and may be related to a Unity bug...

Solution 1: A quick workaround for this would be switching the effect's layers from Additive to Additive_Soft, since this mode takes the scene depth in a texture instead. Another solution of course would be to remove the attribute entirely.

 

Problem 2: There is a known issue with transparency due to a lack of access to Unity's API.

Solution 2: Unfortunately we'll have to wait for the Unity 5.2 version of the popcorn plugin (through no fault of PopcornFX) since Unity 5.2 will include an extended native rendering interface API.

by
So they just added unity 5.2 any idea if this issue is fixed in it?
Just tried replicating the issue in 5.2. Unfortunately the [ImageEffectOpaque] attribute is still causing these issues. One work around is to make all your particle system renders use "Additive_Soft" within PopcornFX before baking it into an asset. Something about the way additive soft is rendered doesn't cause this issue.
I am experiencing the same issue as the original post, but I don't use a shader with ImageEffectOpaque anywhere. I am using Unity's built-in SSAO shader. Also, using Additive_Soft doesn't seem to fix the issue.
^ Same. Additive_Soft and writing a custom fx shader to adjust the blend mode in Unity didn't seem to do anything either. Particles are getting clipped by our alpha Tenkoku clouds

here's a gif
http://gph.is/2s8nMxm

I also commented on Tenkoku's forums - found another guy with a similar issue that says he got it fixed with your help, but haven't heard back from him.
http://tanukidigital.com/forum/index.php?topic=851.0

Any help is super appreciated!
...