# How to make an object visible which is blocked by other static mesh object?

**URL:** <https://forums.unrealengine.com/t/how-to-make-an-object-visible-which-is-blocked-by-other-static-mesh-object/365299>\
**Category:** Rendering\
**Tags:** outline, block, unreal-engine, Post-Process, question, visible\
**Created:** [July 27, 2016, 6:56am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-visible-which-is-blocked-by-other-static-mesh-object/365299 "2016-07-27T06:56:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_a4f3ba3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a4f3ba3c](https://forums.unrealengine.com/u/anonymous_user_a4f3ba3c)\
**Post date:** [July 27, 2016, 6:56am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-visible-which-is-blocked-by-other-static-mesh-object/365299/1 "2016-07-27T06:56:19Z")

</div>

I want to show x, y, z arrows, just like unreal engine, to adjust object positions.  
I use three arrows to simulate it.

 ![100278-arrow.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/c/12ccae3f457cc3ba0b4b13d9f2d04dffc3cecde0.png)

 ![100279-3arrows.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/6/a1600ad4c6d10c2c7f7afb78d435a76ba454c828.png)

The result is like this:

![100280-result.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/d/e/3dea9c55061665bb57c11b2bb9aaac6b9ac8c096.png)

The problem is that: part of the arrows are blocked by the cube. How to make the arrows visible, no matter they are blocked or not?

I think it is the same problem as: how to make an object show in front of anything?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e42d7b13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e42d7b13](https://forums.unrealengine.com/u/anonymous_user_e42d7b13)\
**Post date:** [August 1, 2016, 5:55am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-visible-which-is-blocked-by-other-static-mesh-object/365299/2 "2016-08-01T05:55:43Z")

</div>

Hi Zhan,

Just like what UE4 editor, You need to get the Primitive in C++ and call UPrimitiveComponent::SetDepthPriorityGroup(). Normally, all primitives are render in SDPG\_World, but all UI or highlight primitive should render in SDPG\_Foreground. You can search these key words to see how it works in UE4 editor code.

Cheers,  
Jin Yaping

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a4f3ba3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a4f3ba3c](https://forums.unrealengine.com/u/anonymous_user_a4f3ba3c)\
**Post date:** [August 1, 2016, 12:34pm UTC](https://forums.unrealengine.com/t/how-to-make-an-object-visible-which-is-blocked-by-other-static-mesh-object/365299/3 "2016-08-01T12:34:59Z")

</div>

Thank you for your reply, really.  
We just tried with the code below. But it’s not working.

I searched the web and found something related to this:  
[https://forums.unrealengine.com/showthread.php?931-How-to-use-SetDepthPriorityGroup](https://forums.unrealengine.com/showthread.php?931-How-to-use-SetDepthPriorityGroup)

It seems like that SetDepthPriorityGroup does nothing in UE4.

Is there any other way to do this?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a4f3ba3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a4f3ba3c](https://forums.unrealengine.com/u/anonymous_user_a4f3ba3c)\
**Post date:** [August 1, 2016, 12:37pm UTC](https://forums.unrealengine.com/t/how-to-make-an-object-visible-which-is-blocked-by-other-static-mesh-object/365299/4 "2016-08-01T12:37:21Z")

</div>

void UZM\_FunctionLibrary::ShowActorInForeground(AActor \*actor)  
{  
USceneComponent \*scene = actor-\>GetRootComponent();  
if(scene == NULL) {  
UE\_LOG(LogActor, Error, TEXT(“scene is NULL”));  
return;   
}

```
	UPrimitiveComponent* priComp = Cast<UPrimitiveComponent>(scene);
	if(priComp) {
		UE_LOG(LogActor, Warning, TEXT("priComp is NOT NULL!"));
		priComp->SetDepthPriorityGroup(SDPG_Foreground);

	} else {
		UE_LOG(LogActor, Error, TEXT("priComp is NULL, cast failed"));
	}
}

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e42d7b13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e42d7b13](https://forums.unrealengine.com/u/anonymous_user_e42d7b13)\
**Post date:** [August 2, 2016, 4:05am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-visible-which-is-blocked-by-other-static-mesh-object/365299/5 "2016-08-02T04:05:52Z")

</div>

Aha, sad news. It seems UE4 don’t have any official solution about this now. But you can try this ( [How can you render 3D objects on the hud that are completely independent from the scene? - Rendering - Epic Developer Community Forums](https://answers.unrealengine.com/questions/118403/how-can-you-render-3d-objects-on-the-hud-that-are.html) ). That means you need use render target for it and add a postprocess to blend with original scene. Also, you can try 3D widget. It’s experimental but still you can try it. I am not sure if it come to stable in latest UE4.12.5.

Cheer,  
Jin Yaping
