Can someone help me understand this conversation? I think “Person B” figured out a solution I am looking for.
Person A:
“Using a Scene Capture 2D, I can not manage to make ONLY one actor visible and everything else ALPHA, I want the texture to be 100% transparent except the actor. There is an option in the SceneCaptureComponent2D called “SceneColor (HDR) in RGB, Inv Opacity in A” which does JUST THE OPPOSITE and its driving me nuts. Why not an option just the opposite of this!”
Person B:
Create a material that inverts the opacity and use it to process the captured render target. Then you can draw that material to a render target.
Person A
How can I create the material, and how to drive the material again to the render target?
Person B
Use Draw Material to Render Target. You need to create a new render target.
Hey there @Sean3Dmonkey! There’s a couple of settings you’ll need to do to get this rolling, so I’ll go step by step on how to set up a scene capture that only captures the actor you want.
So first make your RenderTarget where you want it in your content browser.
(Optional) Right click it and select create material (if you’re gonna use it as a material that is).
Then go to your scene (or the BP you’re putting the scene capture in) and create the SceneCapture2D:
After pulling that out, we need to set all of it’s settings correctly. The first two settings will be to set the RenderTarget you wanted to send the viewport to, then set the primitive render mode to “Use ShowOnly List”.
After that we need to scroll even further down to the General Show Flags and remove all of the (nonactor) things you don’t want to see in your capture:
Hello SupportiveEntity, may I ask you one more question? Can we make everything that is black, transparent?
In the first post, “Person B” eluded to a technique that can make everything black into a transparency by editing a material.
a. “Create a material that inverts the opacity and use it to process the captured render target. Then you can draw that material to a render target.”
I have successfully followed your tutorial, this is a test scene screen grab. I hope we can turn everything black into a transparency.
So I’m not much of a tech artist so I don’t play around too much with material nodes, but I went with a basic chroma key setup and chroma’d out the black. This is NOT the best way to do this, this is only because I could not get the SceneCapture2D to output a correct alpha. Currently investigating that now, but this will do in the meantime.
OMG! WOW! This is very interesting, is there a way to smooth out the antialiasing? I tried to increase the resolution in the TextureRenderTarget2D 8192 x 8192 and my 4090 graphic card started to run out of memory.
Question: can we use a second Scene capture2d …somehow apply a stencil to make the character White and the BG Black…Then pipe that TextureRenderTarget2D into the first Material alpha channel?
You probably don’t want to set it to be 8192 x 8192… It would be very heavy.
You can possibly attach a background plane to the character which is black or something else. This could help with the chroma keying. Alternatively you could use a post process material and use the scene depth to get only the character as a mask.
Yes, I’ve seen that. It is also hard to imagine an implementation method. I was hoping someone had already figured it out. I’m new to UE. There are so many wonderful tools in UE.
Oh there’s definitely a better way, the problem stems from the Scene capture itself not putting anything into the alpha channel. I assumed the base or the scene depth variants would put information in the alpha channel (or something I can make the alpha), but they do not. If we could get the true alpha out we wouldn’t have to worry about doing any Chromakeying. Chroma works directly on the image, while the alpha the scene capture is supposed to be putting out would be as crisp as it’s rendered.
this one specifically references putting Inv Opacity to A. I think it might be a specific renderer issue because looking at the source it should be taking it. I’m combing through the rest of it, but source code is complex so it might be a bit. Since it’s not even giving back the depth channels I’m assuming it’s environmental right now. I’ll be back with more information!
Back with more information! So it looks like it’s tied to both scalability and preview rendering level. Medium or below scalability cuts it off if this Cvar is below 4 r.SceneColorFormat thanks to Kaidoom, Ess, and everyone else in this thread below!
So first try to change the scalability to epic, then go over to your RenderTexture and look at just it’s alpha channel and see if it worked out.
If it did, head back to the material, cut out the chromakey (which you WILL need if that Cvar I mentioned before goes below 4) then connect the opacity to a “OneMinus” node (just negates it) then hook it up to your opacity or opacity mask. (I swapped mine to translucent material because it’d be cleaner).
Hey! I’m having a related, but kinda different, problem and I’m running out of ideas here on how to solve it. I’m fairly new to all this so, sorry if it’s a dumb question:
I’m trying to get a Scene Capture Component to follow above the Player looking down (like I’ve seen many people do mini maps), but also have the same functionality discussed in this thread, only showing certain actors and everything else be transparent.
If I place the SCC directly in the world, I can set it to “Show Only Actors…”, but then it won’t move with the player (idk if there is a way of achieving this, I haven’t found one though), OR, I can place the SCC in the Player character BP and attach it to the player and it will follow, but I don’t even have the option of setting “Show Only Actors…”.
How do I go about solving this? I have literally 0 previous experience with SCC’s, so some guidance from more knowing people would be GREATLY appreciated…
Hey there @Tampepunchh! So there’s quite a few ways to get the effect you’re looking for, just depending on how you want to do it. Personally adding the Scene Capture into the player BP and setting it’s settings via Blueprint would be my go to for something similar.
You could use the flags to designate what can be seen or not if you don’t need much control:
Alternatively the Show Only Actors list won’t be visible in BP but will be accessible once the BP is in scene. So you’d add to the list programmatically. The problem stems from needing to do this at runtime would mean adding things to the map on the fly and that’s far more expensive than just using general flags. It’s not impossible, and I can show you an implementation, but let’s figure out exactly what your map needs before we go down the harder route.
Give me a quick rundown of how your minimap needs to work, down to the mechanics. This is will help me determine if you really need to go as deep here.