Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Translate the entire conversation x

iOS Shader Bug

AlexK
15-Moonstone

iOS Shader Bug

Hi Community,

 

When I use a highlight shader on a semi transparent model item on my iPhone, the model item loses its transparency after the shader is changed back to normal. but it works in preview. See video of bug:

Video Player is loading.
Current Time 0:00
Duration 0:00
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x
    • Chapters
    • descriptions off, selected
    • captions off, selected
      (view in My Videos)

       

       

      Thanks for your help!

       

      Best wishes,

       

      Alex

      ACCEPTED SOLUTION

      Accepted Solutions

      Hi @AlexK ,

      I think the described issue is a problem already described in the post ( https://community.ptc.com/t5/Vuforia-Studio/Toggling-of-Shaders-not-working/m-p/713237#M9399 ) and reported to PTC dev team. There is a workaround to use instead of Default  shader the "" to remove the shader form the modelItem. Something like this;

       

      //set the properties of the TML 3D Renderer to highlight the selected item using a TML Text shader. "green" is the name of the script for the TML Text.
          var shader =(Math.random() < 0.5) ? "blue": "green";
          tml3dRenderer.setProperties(item, hilite === true ? { shader: shader, hidden: false, opacity: 0.9, phantom: false, decal: true }
                                                            : { shader: "", hidden: false, opacity: 1.0, phantom: false, decal: false });
      

       

      Alternatively you can use for transparence other shaders    like xray , class or others which will have  visual effects like transparency .

      I attached an example which  use 3 different shaders.  You need to click on component (where not modelItem are defined -the project js does not handle the modelitem widget and therefore a userpick on the both modelItems widgets does not have any effects) , where it  set randomly the green or blue shader /tml text definition. Also at the start the both modelItem widgets : modelItem-1 is    initialized with xref shader and modelItem-2 has opacity 0.5

      Here I attached the project what I tested. Please, let me know if you have questions.

      View solution in original post

      1 REPLY 1

      Hi @AlexK ,

      I think the described issue is a problem already described in the post ( https://community.ptc.com/t5/Vuforia-Studio/Toggling-of-Shaders-not-working/m-p/713237#M9399 ) and reported to PTC dev team. There is a workaround to use instead of Default  shader the "" to remove the shader form the modelItem. Something like this;

       

      //set the properties of the TML 3D Renderer to highlight the selected item using a TML Text shader. "green" is the name of the script for the TML Text.
          var shader =(Math.random() < 0.5) ? "blue": "green";
          tml3dRenderer.setProperties(item, hilite === true ? { shader: shader, hidden: false, opacity: 0.9, phantom: false, decal: true }
                                                            : { shader: "", hidden: false, opacity: 1.0, phantom: false, decal: false });
      

       

      Alternatively you can use for transparence other shaders    like xray , class or others which will have  visual effects like transparency .

      I attached an example which  use 3 different shaders.  You need to click on component (where not modelItem are defined -the project js does not handle the modelitem widget and therefore a userpick on the both modelItems widgets does not have any effects) , where it  set randomly the green or blue shader /tml text definition. Also at the start the both modelItem widgets : modelItem-1 is    initialized with xref shader and modelItem-2 has opacity 0.5

      Here I attached the project what I tested. Please, let me know if you have questions.

      Announcements
      Top Tags