Author Topic: Transparent Terrain underneath Cells?  (Read 92 times)

Qwerku

  • Newbie
  • *
  • Posts: 34
    • View Profile
Transparent Terrain underneath Cells?
« on: May 10, 2019, 11:31:57 AM »
Is there some way to not render the Terrain underneath the cells? 

When I put a transparent shader on the Terrain, the grid system doesn't seem to appear or function.  Disabling "Draw" on the Terrain also seems to disable the TGS.

When I move the camera around, I can see the Terrain underneath the cells at the world's edges (not to mention Terrain artifacts despite 3 unit high grid elevation).  It'd be so much simpler if the Terrain weren't drawn or were transparent and I could just use the grid cells as my rendered Terrain, so to speak.


Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4555
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #1 on: May 10, 2019, 11:50:19 AM »
Currently cell shaders allow transparency so they don't write to depth therefore they won't be visible unless there's "some" geometry behind them.
You can hide the terrain and add an opaque plane far behind the grid but covering the entire area and the grid will be visible again (because the plane takes care of writing to depth).
I'll add the ability to render in the opaque queue to next beta so it's possible to have the grid visible even if you hide the terrain.

Qwerku

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #2 on: May 10, 2019, 01:13:54 PM »
Thank you for slating that for the next beta.

When I put a plane underneath everything, I notice that the grid coloring disappears when I give the Terrain a transparent material (see attached).  Will the cell colors render once TGS can render in the opaque queue?

Thanks yet again!
Qwerku

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4555
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #3 on: May 13, 2019, 03:47:20 AM »
This has been tricky since Unity won't render anything if there's no depth information at that pixel. So something must be rendererd in opaque queue. Problem is that forcing to write to depth buffer triggers additional clipping artifacts so new options have been added to next beta to control how territories and cells surfaces offset relate.
All in all, next beta will include support for this. Just make sure you enable "No Background" checkbox in the inspector.

Qwerku

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #4 on: May 15, 2019, 04:52:18 AM »
I'm sorry this has been such a pain. Nevertheless, I'm looking forward to using it!  Right now, grid elevation and the depth knobs cause rendering artifacts that look worse than the terrain sticking through the cells, so I've just been gritting my teeth whenever the pure white terrain suddenly appears on certain camera angles, telling myself to be patient for the next beta.

I appreciate all of the hard work!
Qwerku

Qwerku

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #5 on: May 15, 2019, 10:53:09 AM »
You did it!  I'm absolutely loving this change.  Everything looks so much better now with a transparent terrain!

I did notice that with transparent terrain, the highlighted cell seems to show the grid mesh of whatever is behind it.  (I've attached an example) 

I'm so happy with the latest beta though. Thanks for pulling that off!

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4555
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #6 on: May 15, 2019, 12:47:27 PM »
Hey,
I'm trying to reproduce the effect you have now with the highlighting, with no luck I must say.
Could you please send me that scene?
Regards

Qwerku

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #7 on: May 16, 2019, 05:47:31 AM »
I'll get a stripped down version to you as soon as I can.  The project is getting larger and larger, and I'm under a deadline.  Maybe in a day or two.

Thanks!

Qwerku

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #8 on: May 19, 2019, 01:35:45 PM »
Sorry for the delay.  I successfully retained the issue while stripping the scene down to the bare essentials for you.

Thanks for looking into this!  One of my playtesters noticed this bug over and over and over again.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4555
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #9 on: May 20, 2019, 03:54:16 AM »
Thanks for the repro. Check out the new beta - you may want to try the Highlight Effect mode "Dual Colors" which matches better the No Background option.

Qwerku

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Transparent Terrain underneath Cells?
« Reply #10 on: May 20, 2019, 10:18:11 AM »
Thanks for the quick turnaround!  I can confirm that the latest beta fixed the issue.  I'll also definitely make use of the alternate highlight color feature.  Thanks!