ViewLocation & ViewRotation are not initialised in FSceneView in realtime editor viewport

Hi,
I am writing an Custom render pass to do some custom OpenGL code into the engine. In order to do this I need to convert the matrix space (similar to the stereoscopic matrix). This math depends on FSceneView having a correct ViewLocation and ViewRotation. It appears that these are not set (as the comments say) by the creation of the ViewMatrix, but by the ULocalPlayer::CalcSceneView function. Which means the ViewLocation & ViewRotation values are undefined values while the editor is in realtime view mode.

I can happily create a patch to fix this, but I am curious if this is the intended use of those variables or not.

I’m curious where you’re seeing this. The code changed a bit in main (what will become 4.8) but all the needed values are initialized in the FSceneViewInitOptions that are passed to the FSceneView constructor.

In the case of realtime editor viewports, this happens in FEditorViewportClient::CalcSceneView.

If there is a case where they are uninitialized can you provide a callstack? That will give me more context as to what the code is doing.

Hi,
Sorry I forgot to mention I am running 4.7.1 from the Github release branch.
Here is a call stack of where i think the variable should be getting initialised: Callstack

The reason I want access to these variables is because I have written a custom render pass that needs a different layout for its matrices. So I need to reconstruct the matrix during the render pass. Here is a callstack for where I would be accessing the viewlocation and viewrotation: Render thread callstack

In my fork I have manually added a patch to fix this. I am not sure if I should post that here or not.
I can send it through if you want it.

Thanks

CalcSceneView should initialize those variables but it’s certainly possible we’ve missed something :slight_smile:

If you can make a pull request on GitHub that’s the easiest way for us to take a code change. I’d love to get your fix integrated in to main!