Author Topic: Line Renderer Support?  (Read 540 times)

Trey Hayden

  • Guest
Line Renderer Support?
« on: February 23, 2021, 01:51:06 PM »
Hey there!  The new SSRR library seems to have a strange time handling Line Renderers (see below). 



The reflected angle seems to be off and doesn't display properly.  Would like to leave a nice review on the Asset Store, hopeful that this is a quick solution.

Thanks!
-Trey

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Line Renderer Support?
« Reply #1 on: February 24, 2021, 11:51:56 AM »
Hi Trey,

This is a limitation of all SSRR with transparent materials. The workaround is to make the effect render before transparent objects.
Go to Global Settings and change this option:


Screen Space Raytraced Reflection performs a depth-buffer raytracing. Since transparent objects do not write to this buffer, the reflection you see on the floor is actually the line render color on the wall reflected on the ground.

Regards
« Last Edit: February 24, 2021, 12:36:02 PM by Kronnect »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Line Renderer Support?
« Reply #2 on: February 24, 2021, 01:17:15 PM »
Using a tweaked transparent shader that also renders to depth can also work. Try the attached material/shader.
Note that this is a "trick" and could not be perfect but it could be a workaround for this case.
This one if for URP. For built-in, see a few posts below.
« Last Edit: June 06, 2021, 06:22:33 PM by Kronnect »

TreyH

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Line Renderer Support?
« Reply #3 on: February 25, 2021, 02:41:15 PM »
Oh I had no idea, reading around and that does seem to be a known limitation.

Thanks for the info and help with workarounds!

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Line Renderer Support?
« Reply #4 on: February 25, 2021, 02:52:59 PM »
Yes, by design, as with any post effect that relies on depth buffer: fog, etc. Anything like that requires special treatment. Usually it's not a big issue or a workaround can be implemented.
We're experimenting with reusing the last frame as an option so anything in the scene could be reflected.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Line Renderer Support?
« Reply #5 on: February 25, 2021, 03:15:11 PM »

Charles

  • Guest
Re: Line Renderer Support?
« Reply #6 on: June 06, 2021, 10:07:56 AM »
Hi there,

May I ask you some help for this? We are facing the same issue, but this shader is for URP. We would need this for built-in. Is there any chance you have a version of this transparent shader with Z- buffer for built-in, please?

Thank you!
Charles

Using a tweaked transparent shader that also renders to depth can also work. Try the attached material/shader.
Note that this is a "trick" and could not be perfect but it could be a workaround for this case.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Line Renderer Support?
« Reply #7 on: June 06, 2021, 06:22:12 PM »
Attached for built-in pipeline.

You can assign a texture or color. Use the Clipping material property to define the cutoff threshold.

hazegames

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Line Renderer Support?
« Reply #8 on: June 19, 2021, 09:07:11 AM »
Attached for built-in pipeline.

You can assign a texture or color. Use the Clipping material property to define the cutoff threshold.

Thank you so much for your quick reply! I have tested it, and unfortunately, I'm still having the same issue while using this shader:
[See attachment]

As you can see in the image, the red line is "self-shadowing" in the reflection, with the color (red). Whatever I do, it seems like I cannot find a way to not have this "bleeding" of the line.

Any ideas how I could solve this? I could potentially make these line renderers completely ignored by the reflection system, but I cannot see a setting to do so (culling mask or such). Is there a way to completely ignore transparent objects in reflection when using Built in + Forward? Or a way to fix the issue seen in the image, if possible.

Thank you,
Charles

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Line Renderer Support?
« Reply #9 on: June 21, 2021, 11:33:03 AM »
Hi,

Yes, in built-in you could add [ImageEffectOpaque] just before the OnRenderImage function to force Shiny effects to render before transparent objects.
Edit ShinySSRR.cs and find the "void OnRenderImage ..." line and add the [ImageEffectOpaque] attribute so it reads like this:

Code
[ImageEffectOpaque]
void OnRenderImage(RenderTexture source, RenderTexture destination) {
...

Regards

hazegames

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Line Renderer Support?
« Reply #10 on: June 21, 2021, 12:37:51 PM »
Hi,

Yes, in built-in you could add [ImageEffectOpaque] just before the OnRenderImage function to force Shiny effects to render before transparent objects.
Edit ShinySSRR.cs and find the "void OnRenderImage ..." line and add the [ImageEffectOpaque] attribute so it reads like this:

Code
[ImageEffectOpaque]
void OnRenderImage(RenderTexture source, RenderTexture destination) {
...

Regards

Wow, thank you so much! This worked perfectly, transparent objects are ignored!
Thank you again - you solved my issue :)
Charles

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Line Renderer Support?
« Reply #11 on: June 21, 2021, 12:42:31 PM »
Nice. Glad to help.