[4.13] Scenecapture2D, SceneDepth capture not working as expected

Hi!

I’m trying to use the new 4.13 features for capturing scene depth to a render target from an ortographic scenecapture2d.

However, I’m currently having these issues which leave me unable to proceed:

The Setting “Capture Source” in 4.13 has an option for capturing “SceneDepth in R”
However, there are no settings for the depth scale of the capture. The default settings give me a very narrow depth so I only see what’s immediately in front of the camera.

I found a workaround for this though: By instead capturing “Final Color (LDR) in RGB” and using a post process material with a “SceneTexture:SceneDepth” node, I can then divide by 10000 before outputting to emissive which gives me the intended result!

This though, leads into another issue:

  1. The Blueprint Node “Capture Scene” does not seem to work with the “Final Color (LDR) in RGB” setting on the SceneCapture2D.

It works fine if the scene capture is set to any of the other modes (Scenecolor, normal, scenedepth), but Final Color just gives a black result. Worth mentioning is that it works fine if I check the “Capture Every Frame” Box, but I can’t do that for performance reasons.

Any help would be super appreciated, thanks!

Hey LudvigLoven,

So I am a bit confused by your post, and maybe you can clarify what you expect to be the end result?

Just for my own sanity, I read over the documentation where we announced the release of Orthographic projection for SceneCapture2D actors, and did not see where we specifically said we support Scene Depth for Orthographic projections.

I believe the reason for this is that Orthographic cameras are by definition a flat projection with no depth. This is why you are getting a single output of 1.0 when using the scene depth option on an Orthographic scene capture. I don’t expect scene depth to be supported as there is not way to capture depth with an Orthographic camera.

Let me know if this makes sense or if you have further questions.

Cheers,

Hey, Capturing depth with ortographic projection works in 4.13, there just seems to be some bugs with it.

109989-help_1.png

These are the settings I’m talking about. I’m capturing an SM_Chair from above for illustration.

SceneColor (HDR) Gives this result:

109990-help_2.png

SceneDepth in R gives this result (Note that’s it’s not just 0 or 1, but it’s capturing just the top of the chair):

109991-help_3.png

FinalColor (LDR) With a post process material that divides scene depth by 100:

109992-help_4.png

Same as above but with “Capture Every Frame” Unchecked and the “Capture Scene” blueprint node used in the construction script:

109994-help_5.png

So an update on my first post: What seems to be happening is that the post process material is ignored when Capture Every Frame is unchecked. Why is this?

Also, why is not the depth Scale of the SceneDepth in R capture adjustable, for capturing objects at different scales?

If either of these two issues are solved, I can do what I want! :slight_smile:

So I am still unable to replicate the issue on my end. All I am getting is a white output using the same settings you are providing screenshots. So in order to confirm what you are reporting, I need to see a screenshot of any blueprint logic you are using to capture the SceneDepth in R output for the Orthographic camera (if any).

I can get all the same results in your other screenshots using the default settings as expected, but I am unable to reproduce the SceneDepth portion of your issue. After I can reproduce your issue, I will be able to more accurately answer your other questions.

Thank you,

The SceneDepth in R capture isn’t using any blueprint logic, it’s just a standard SceneCapture2D, rotated to look downward.

Sorry, maybe I should have been more clear on this, but to get the result in the SceneDepth in R screenshot you will need to align the scenecapture (Z-Value) to the top of the chair.

Try keeping the render target open for viewing and move the SceneCapture2D up and down through the chair mesh, it will then show sections of the mesh due to the limited capture depth.

Here’s a screenshot with everything, other than that just a standard blank project with starter content. Hope it helps you! :slight_smile:

Hey LudvigLoven,

Thanks for the clear and precise repro steps. I was able to confirm what you are reporting and have gone ahead and entered a bug report for the issue. You can track the issue following the link below on our public issues tracker.

UE-37350

Once the issue has been addressed by our engineers either myself or another staff member will return with an update.

Let me know if you have further questions or need additional assistance.

Cheers,

Hi Andrew! Thank you for reporting this, let’s hope for a quick resolution. :slight_smile:

That takes care of issue 1 in my OP, however issue 2 still remains.

First, a better illustration of Issue 1. In this pic I have Switched the Capture mode to Final Color LDR and instead added a post process material that outputs SceneDepth. I’ve discovered that dividing the result by a value of 3 gives the same output as capturing SceneDepth in R!! This is the parameter I would like to adjust, but it seems to be hard coded to 3 in the preset for some reason.

Next, I’ve changed the divisor in the post process material to 100, which gives you enough depth to capture the chairs and table! It seems reasonable that the SceneDepth in R preset uses a similar method to capture depth, and for the UE4 devs it should just be a matter of adding this parameter to the SceneCapture 2D.

Now on to the actual issue:

When capturing manually from blueprint, post process materials are ignored!

I’ve added blueprint logic to the scenecapture to capture once upon construction, and unticked both boxes for automatic capturing. Now, as soon as I check the “Capture Every Frame” box, the post process material is applied correctly and the result is as in the above picture. But with manual capturing I’m just getting the Final Color LDR result without post processing (Also it’s in Black And white here since I’m viewing the render target with desaturation)

Really frustrating, as we seem to be so close to getting this working otherwise. What we actually want to use this for is automatic heightmap modification (and generation of foliage masks) for a ~1000km² landscape divided into 70 or so different levels, which is why It’s not possible to capture every frame. Unfortunately, I can’t show anything from the real project for contract reasons.

This could be a tonemapper render order issue. There is a setting within your Post Process Material so you can designate the order in which the blendable is rendered.

I would take a look at these properties and mess around with those to see if you can get it to work correctly.

Let me know if you have more questions.

Cheers,

No, I don’t think that’s the issue at all. I’ve tried changing the blendable order but it makes no difference.

And why would it? There should not be a difference in how the post process material is applied when you’re capturing single frames via blueprint vs capturing every frame.

I think this needs another bug report.

Edit: To clarify.

  1. The rest of the post process settings (White balance, Color Grading) are applied correctly, but the blendables are not.

  2. Even if I do the simplest post process material possible, IE a constant input of 0 or 1 it is not being applied.

So I did some more digging and found that what you are reporting is a known issue. You can track it by following the link below.

[UE-28468][1]

As a workaround for now you can use the setup I created below, or the one that is working for you.

SceneCapture2D - Component

111624-scenecapture2dbp.png

This is going to be the current solution you will probably need to use until either bug gets fixed.

Thank you,

Alright, looks like we’ll just have to wait until this is fixed then, as doing a 2048x2048 capture 70 times each frame is not an option. We currently have another script outside of UE4 for the heightmap generation which achieves the same thing, but it takes over 3 hours to run so that’s something we would like to get rid of.

Anyways, thank you for your help Andrew!

So still nothing on either of these issues? We have managed to create a workaround for our implementation, where we create a C++ plugin to export the render targets to disk as PNG files during runtime, and then we import them back manually into the editor. It sort of works, but it’s… less than elegant.

With the post-process work-around it works for me when I multiply my scene-depth in the post-process-material with at least 0.001. If you only multiply with 0.01 the values get so bright, that the resulting picture looks just white :smiley:

I’ve wondered as well why my height data is just glowing white. I’m using SceneCapture2D in Orthogonal view. I was also asking myself, which distance it captures and how I can “clip” the distance and “move” the max. white-point to this specific point (note: the distance-property does nothing in orthogonal mode).

Below you can see how I’ve done it and it seems very exact.

216562-untitled.png

Still not giving up on this!