Off-screen rendering and lighting

TL;DR first: I’m trying to replicate the gimbal at the bottom center of the screen in Kerbal Space Program (reference image).

I have an actor blueprint, placed arbitrarily in the level, that contains a StaticMeshComponent sphere as the gimbal and a SceneCaptureComponent2D that looks at it. This capture component has a RenderTarget asset attached. I have a simple unlit material that uses this render target as emissive color. Finally, in the WidgetBlueprint that is my HUD, I use an image widget to display this material. (The image widget doesn’t seem to accept a render target, hence the intermediate material use.) So far, this works fine in the sense that I see the sphere rendered on my HUD. (I also see everything in its background, but I can work around that by playing with the capture component cull distance or placing the blueprint such that it faces the void.)

Now this is where I bump into: The gimbal sphere receives light from the sky light in my level. If I place a directional light, it also affects the gimbal. Similarly in reverse, if I place a directional light to illuminate the gimbal, it affects the whole level. This all seems like the natural behavior to me, too. The thing is, I’d like to separate the gimbal’s lighting from the rest of the level. Think of it like this: The gimbal is, along with other instruments perhaps, inside the spacecraft, which has no windows. I’m trying to reach a solution where I don’t have to remove the sky/directional light(s) or static lighting.

I’m working with engine version 4.7.6. So far I’ve tried messing around with lighting and shadow options, placing the gimbal blueprint in a streamed level, and enclosing it inside a hollow BSP cube made up of either a single BSP brush with the hollow option or six separate BSP walls.

What is the best way to accomplish this, if it is possible at all?

Thanks in advance.


Original, badly worded question:

I have a level with directional lighting in it. I want to render a scene, with lighting independent from the level, to a texture and use it on my HUD. I did the render target and draw-on-HUD part, but the directional light in the level affects the HUD scene, and vice versa. Level streaming didn’t solve this. Is this somehow possible to do?

Hello Valthoron,

I am having a hard time understanding what you are attempting to accomplish. How are you applying the rendered scene to your HUD and how are you capturing the scene?

Also, what version of the engine are you using?

Thanks,

Hello ,

My sincere apologies for not being clear, I was unsure how to put in words what I was attempting. I edited to rephrase my question in detail, please check again.

Thanks.

Hello Valthoron,

After looking over your issue I was able to find a workaround for the gimbal that you would like to make. You were on the correct path. I was able to create room that held the 3D object that I wanted to display and from there I used a Render target 2D in combination with a Scene capture 2D camera for the effect. I have provided the example below. I hope that this helps.

Example.

I created a room that I applied a flat black material to and placed my 3D object inside of it. I then aligned my Scene Capture 2D camera so that I got the angle that I wanted. Please Note: That if you are going to place the fake room below the level as I have done in the example, you will need to move the kill volume down so that it does not destroy your actor.

I then created the materials that I would need. These Include the flat black that was mentioned above, the cube color that is an unlit emissive, and the masked material that uses the render target 2D texture.

This is a picture of the final result. The cube is rotating in place and it has been added to the viewport view an image widget that has been applied to a widget blueprint.

Make it a great day

Thank you very much for your time, Rudy! This is almost exactly what I wanted. I added a constant 0 to the gimbal texture specular to remove the shine from any directional lights on the level. I also pulled down opacity mask clip value on the render target material to 0.001 so that darker colors on the gimbal don’t appear transparent. It works great now. Thanks again!