New Idea, please help understand the feasibility

So absolute new developer, and just exploring; curiosity and exploring play-space things. I was thinking of implementing this in a tactical shooter style game, so lighting and the map environment stays consistent.

Currently I am working on creating a concept for a camouflage panel, like the ninja trope of having a patterned curtain to hide oneself. But I wanted it to be an object in the world, so player-characters can collide, be pushed back, and can stand behind the panel. optimally, this new in game object can be put in a corner, as to provide a small hiding space/corner for the player to stand in, or in a corridor, so that if the opponent players break the panel, the player can play off it breaking, or if they were standing behind the panel, be killed by the opponent’s gunfire.

I have explored the possibility of trying to real-time calculate the environment, and then remove the player character, but that seems too resource intensive; as I want to try and have this concept run on as low spec a pc as possible. I also considered making a copy of the map, and super imposing the images from that map onto the game object; but i thought that too would be too intensive.

I want to first explore this space if it possible before I give up totally, and just realistically, take a quick snapshot of environment behind the panel, and just superimpose it onto the game object.

Hey there @TryBurningGundam! Welcome to the community! If you were to use something like RenderTargets and and Scenecaptures you could pull something off like this but it’d have to be one time render, otherwise if you did it on Tick it would get really expensive. By no means are scene captures and RT’s light either though, how many would you need? and does the quality need to be perfect?

There’s always other more programatic alternatives but they get more custom and harder to implement the further you go.

1 Like

Thanks for the reply. Given the scenario I am trying to implement this proposed object: as a utility item in a tactical shooter, I was hoping to create it as a one time use object, deployed until destroyed or recalled. Good to hear that investigating this first was a good idea.

Also it does not have to be perfect, as I want the opposing players be able to have a hint that utility is being used (makes counter play possible)

But potentially, would it be possible to create some mask/chromakey for a player character when they are in view through a transparent-material-object (i.e. a game object with a glass material set). It would achieve the wanted effect, but I don’t know if such an implementation is possible.

If you know of someone doing something similar, would mind sharing the resource?

Theoretically, if I were better at shaders I’d probably be able to guide you towards either making a material shader that could pull off something similar natively, just as you can make a glass material that ignores all glass behind it (which is usually a translucency depth issue more than a feature). However my area of expertise is more on the programming side of game development so I’m not sure the limitations of materials here.

I’d recommend testing the Scene Capture technique first, as it’s easily the most straight forward way to do this but would require a bit of effort. Possibly doing a 3D scene capture that has player actors hidden in it, making sure it’s set up as a world space texture so it moves/stays in line/parallax when the other player walks around it. However some alternatives could be custom render stencils and post process materials, but that’s at the far end of my knowledge and may not work for this use case. I’ll include some resources on both, and if you need help implementing the scene capture version I can go more in depth with how I’d pull it off.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

Long tutorial on how you can use captures to make portal like effects, in your case the capture would be close to the same location it’s spawning from, but would operate (material wise) kind of like this:

Custom stencil example:

thanks again, I’ll look into it.

1 Like

So I have been looking into the two provided videos, and I can get an Idea of what they are trying to do, but ultimately I am still a bit stuck on how to handle the masking-out of the player characters. Because this is going to be used in a gameplay environment, and the object is going to be created by the players and would be experienced by multiple players. Right now I kind of have two possible solutions to problem

Solution 1 (the simple one): from the portal example, the creator used a static texture that was created from the perspective of the paired portal, and the portal is a sphere with a Fresnel effect to create the edges of the portal. this would work really well, but the creator seems to be creating a example that was for a static portal/gateway rather than say a portal gun or something similar. Say if there was an “on-create” or “on-place” event, it would trigger the “create-static-texture” command that the creator uses to create the inner view for the portal; this would solve my problem all together.

Solution 2 (the complicated solution): from the stencil example, I was sure this would be a key part of the interaction of the material I would want to make, but I was stumbling on how to implement it. Because I would need it to interact with the object that the players would create. E.g. if the object was placed in an open field, and there was the observer and another agent in that field, if the agent was to move behind the object, the observer would be able to see the agent until it was fully behind the object. also if a portion of the agent’s body was not being obscured by the object, those portions of the agent would still be visible to the observer. I was considering a line of sight/raycast solution, but again I am a newb to UE and don’t know if that kind functionality is available or provided by base UE. So from the observer perspective a raycast from their POV is thrown from their field of view; and any casts that would pass through object, but hit the agent; the material would then mask out the portions of the agent hit. Vice versa; any raycasts that do not pass through the object but hit the agent will not be masked out.

While I believe solution 1 is the most feasible and the most likely the solution a studio would use as it would be less resource intensive; I would like to explore solution 2 as well as it would a cool tool to have on my belt and in general would be fun to explore.

That’s exactly how I’d go about it because I’m better at mechanics than I am materials. Having the capture just capture once on on BeginPlay and have the scene capture ignore the rest would likely have the same effect as the latter but I definitely understand going for the fun path! Let us know how it goes! Might be a great resource for the community!

So this would be handled in the event chart correct? also how would I access that? Although I have programming knowledge/experience, I would like to try and code in blueprint. Is there a tutorial you would suggest a complete newb see first?

Here’s a basic setup for it:

Gotta set the player reference when you put it down (you could do that from the player) and then call the scene capture, and then it will capture the scene once, hiding the player actor. I left the details there so you can see the SC setup too, in your case it’d be the capture cube instead of the 2D SC.

thank you, I’ll look into it.

1 Like