Dustyroom / flat-kit-doc

Documentation of the Flat Kit asset.
https://flatkit.dustyroom.com
Apache License 2.0
2 stars 1 forks source link

Fog Feature prevents rendering of transparent materials #40

Closed niccabc closed 2 years ago

niccabc commented 3 years ago

Describe the bug The Flatkit fog renderer feature appears to be incompatible with transparent materials. Specifically I am referring to materials with Surface Type set to Transparent. This prevents me from using the particle effects in my project that have transparency :(

To Reproduce

  1. Create a new material and set Surface Type (Under Surface Options) to Transparent.
  2. Create a 3D Gameobject and apply the transparent material to it.
  3. Select the Flatkit Example Forward Renderer in the Project Window.
  4. In the Inspector Window, enable Flat Kit Fog under Renderer Features.
  5. As soon as the fog is enabled, the object with the transparent material will stop rendering.
  6. Disable the Fog, and the object reappears.
  7. This occurs with both default unity shaders and with the Flatkit Stylized Surface shader.
  8. This occurs regardless of object distance from camera.
  9. This occurs regardless of Fog Settings.

Expected behavior I expect the fog feature to not prevent certain objects/materials from rendering! :)

Unity details:

Build platform:

dustyroom-studio commented 3 years ago

Thanks for reporting this.

The fog image effect currently doesn't work with the transparent objects because they are not reflected in Unity's depth image. To overcome this limitation we would need to introduce a custom renderer feature that renders depth for the transparent objects.

That change is in our plans, but I can't give a time estimate for the solution at this point. Please let us know if this feature is critical for your project.

niccabc commented 3 years ago

Thanks for the quick response!

That all makes sense, and I'm glad to hear that you are working on a fix. Solving this issue is definitely critical for my project. For the time being, I will have to find a work around :(

Also, while we're on the subject of the fog,I've noticed another issue. When I move the outline effect above the fog in the renderer features list, the outlines no longer render. It would be so, so great if the fog could influence the outline colors.

dustyroom-studio commented 3 years ago

Thank you for your patience! Regarding the fog affecting the outlines, please, have a look at the order of the Renderer Features in the Forward Renderer. This order of the effects works top to bottom, meaning the effect lower in the chain has an influence on those above it. We have a note about it in our manual (see the screenshot) — here Hope this will help.

niccabc commented 3 years ago

Yes, that is the effect I'm after. However, It is not working properly for me. :( Here I have outlines underneath fog and they render: Screen Shot 2021-04-24 at 11 30 30 AM

But here, with fog underneath outlines, the outlines do not render at all: Screen Shot 2021-04-24 at 11 30 52 AM

dustyroom-studio commented 3 years ago

Could you please go to outlines settings and try adjusting Render Event parameter. 'After Rendering Transparents' or any similar event. Make sure you have the correct settings file selected in Edit - Project Settings - Graphics and Quality panels (both panels). Please, let me know if it won't work for you. Render Event parameter is described here.

niccabc commented 3 years ago

AH yes! Changing the Render Event parameter did the trick. Thanks for your help! :)

albrrt commented 3 years ago

I’m adding my voice here for transparent materials.

This problem also affects World-Space UI (we’re using TextMeshPro) so it’s quite critical for our use-case

Is there a timeline for this fix?

Thank you

dustyroom-studio commented 3 years ago

I’m adding my voice here for transparent materials.

This problem also affects World-Space UI (we’re using TextMeshPro) so it’s quite critical for our use-case

Is there a timeline for this fix?

Thank you

Hi, @albrrt

Could you please specify what exactly doesn't work for you. Also, if you can, please add your set-up details such as Unity, URP, Flat Kit versions and build targets.

Thank you.

beareality commented 3 years ago

Hi @dustyroom-studio, I also need to get the fog renderer feature working on transparent objects.

dustyroom-studio commented 3 years ago

Hi @dustyroom-studio, I also need to get the fog renderer feature working on transparent objects.

Hi @beareality

Could you please let me know your setup details, like Unity, Universal RP and Flat Kit versions. You can find those if you go to Project panel -> Assets -> Flat Kit -> Readme. Ince you select the Readme file, you should be able to see all the versions numbers at once. A screenshot of this panel would help.

Also, please add as many details which may help as possible. You can consider writing to info@dustyroom.com as well.

Thank you.

beareality commented 3 years ago

Flat Kit: 2.2.0, URP: 10.5.0, Unity: 2020.3.8f1 2021-05-18 11_58_15-Window

albrrt commented 3 years ago

@dustyroom-studio here is my config FlatKit Version

and here are the steps to reproduce my issue:

1) Create a new Unity project with URP template 2) Import TextMeshPro Essential Resources Import_TMP_Essentials

3) Import FlatKit 2.2.0 4) Import FlatKit URP Package 5) Open the Valley demo scene with Fog 6) Create a new canvas with Text (TMP) hierarchy

7) Set your canvas to World Space and move it in front of Camera 1. Set the event camera to Camera 1. The camera doesn't render the canvas. Canvas_World_Space_Fog_On

8) Disable the fog in the Renderer The camera renders the canvas Canvas_World_Space_Fog_Off_2

Our build target is Standalone Windows x86_64.

Thank you

dustyroom-studio commented 3 years ago

Thank you for the screenshots @albrrt, we are able to reproduce this issue. It's going to be fixed in the next update to Flat Kit, which should appear on the Asset Store early next week.

albrrt commented 3 years ago

Thanks @dustyroom-studio the canvas components seem to render correctly in v.2.2.6 using FlatKit Fog.

I still need to test URP/Lit materials with Transparent surface types (@niccabc 's original problem) and get back to you