Semantic Texture Tutorial not working with URP

  • Issue category: Semantic Segmentation / URP
  • Device type & OS version: Android
  • Host machine & OS version: Windows 10
  • Issue Environment : Unity Mock / On Device
  • ARDK version: v1.3.1 (and an earlier one, installed Nov 21)
  • Unity version: 2020.3.9 & 2021.3.1

Bug reproduction steps:
Using a Unity 3D project template -

  1. Install ARDK, as per ARDK documentation
  2. Install URP to that project, as per Unity documentation: Installing the Universal Render Pipeline into an existing Project | Universal RP | 14.0.2
  3. Apply ARDK/URP set up process, as per ARDK documentation
  4. Follow steps 1 to 11 in Lightship Semantic Textures tutorial: Niantic AR Development Kit (ARDK): Semantic Segmentation Textures Tutorial
  5. Test in Mock in editor, and in an Android build

Expected Behaviour:
Semantic information IS read, semantic texture IS applied.

Actual Behaviour:
Semantic information IS read (I’ve tested this with a semantic-specific hit placement test), semantic texture is NOT applied.

The Semantic Texture tutorial works perfectly in both Unity 2020 & 2021 (I know the latter isn’t officially supported), so I’m assuming it’s somehow related to URP?

Curiously, the supplied example ‘ContextAwareness/Segmentation/SemanticSegmentation.unity’ DOES still work in URP - though the white overlay in that seems to be applied via a Raw Image gameobject instead of a shader on a material like the Semantic Texture tutorial.

Am I doing something wrong/is there a way I can fix this, or do I need to wait for a future ARDK update to fix it?

Side note:
I’ve spotted two slight errors in the written version of the tutorial and have accounted for them in my bug testing. For posterity, those are:

//add a callback for catching the updated semantic buffer
        _semanticManager.SemanticBufferUpdated += OnSemanticsBufferUpdated;

There should be no ‘s’ at the end of Semantic - it should be

//add a callback for catching the updated semantic buffer
        _semanticManager.SemanticBufferUpdated += OnSemanticBufferUpdated;

Step 8 of the written tutorial misses telling you to add Texture2D _semanticTexture; - this is captured in the code at the bottom of the page.

Hi @Jess_Woodward thanks for the bug report! We’ll look into the issue and follow up internally.

Hi again @Jess_Woodward , as I was reproducing this issue locally I noticed that the shader script from the Semantic Texture Tutorial couldn’t be converted to URP using Unity’s Render Pipeline Converter. It’s likely that the shader script from the tutorial isn’t compatible with URP, and would need to be rewritten.

If this is the case, then the semantic texture not being applied would make sense. I’ll try to get confirmation that this is actually the case, but at this point I think that it’s safe to assume that the tutorial isn’t compatible with URP as it’s currently written.

In regard to the documentation bugs that you mentioned, these have now been logged
and will be fixed in a future release. Thanks again!

2 Likes

Thanks @David_Quevedo! That would explain why it was still reading the semantic channels just fine & only not applying the shader. Appreciate your help! :slight_smile:

1 Like

any update on this?

1 Like

Not a fix, but a workaround for a similar effect: you can use the semantic channel to mask a Raw Image instead. :slight_smile:

If you download the ARDK Examples, they used that technique in the Context Awareness>Segmentation example. I just copied how they set it up there.

1 Like

Old conversation I know but I’m having trouble with this. I’ve tried the Context Aware example suggestion but the raw image flashes white, or glitches on device until the channel has been loaded? Any suggestions as to why this might be happening or how to fix it?

Oh, I had that issue too - if I recall correctly, I disabled the Raw Image component at Start, and then re-enabled it in OnSessionInitialized ( Subscribing to ARDK Events — Niantic Lightship Augmented Reality Developer Kit release-2.5.2 documentation ).

If that doesn’t work let me know and I’ll dig out the project and double check my code to see what I did. :slight_smile:

Hey Thanks! Tried disabling and reenabling after a few seconds, but I’ll try with the OnSessionInitialized.