Author Topic: HardClipping with Custom UITexture Shader  (Read 6464 times)

ferretnt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
HardClipping with Custom UITexture Shader
« on: May 01, 2013, 07:36:28 PM »
Hey Aren,

Quick question before I do some coding: If I have a UITexture with a custom shader in a hardclipped panel, and I implement a hardclipped version of my shader (transform worldpos, call hlsl clip()) and name it correctly should everything "Just work"?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HardClipping with Custom UITexture Shader
« Reply #1 on: May 02, 2013, 03:50:31 AM »
Hard clipping has been removed a long time ago. You need to use either alpha or soft clipping. But yes, it will "just work".

ferretnt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: HardClipping with Custom UITexture Shader
« Reply #2 on: May 02, 2013, 05:49:21 PM »
Almost... The material has multiple properties and textures, which get updated. Not every frame, but frequently. And mClippedMat doesn't pick them up.

With my sledgehammer, I can make something that looks correct, by doing this in OnWillRenderObject().

      if (mClippedMat != null)
      {
         mClippedMat.CopyPropertiesFromMaterial(mSharedMat);

What would be the correct / efficient way to do this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HardClipping with Custom UITexture Shader
« Reply #3 on: May 03, 2013, 09:53:15 AM »
You should mark the widget as dirty (MarkAsChanged) before and after making any material-related changes.