Player Rotation in a Cube Render Target

Hey guys,

So, I’m trying to map the player’s rotation (that comes with the default First Person template) to update instantly in a cube render target.
I know this is a common problem with cube render targets but anyone out there knows how to implement this?

Tried doing it in the Material Editor but I can’t seem to wrap my head around which nodes to use and how to have the rotation be read, etc.

Thanks in advance!

I am not sure what you are trying to describe. Could you give a full example of what the render target has to do with player rotation?

Ok, I have a Scene Capture Cube and a Cube Render Target applied to a basic geometry. I have a second camera pointing at the basic geometry with the render target (cube map) - this second camera is what will be rendered and seen in Game Mode.
After parenting the Scene Capture Cube to the Player Controller (with axes in translation and rotation mapped), I want the player’s movements and rotations to be captured and updated in the cube render target. So far, only the translations are reflected in the cube render target and not the rotations.

Hmmm interesting. I have not tried that before. I wonder if perhaps cube render targets do not actually use the actor rotation for firing the rays for capturing. That may make sense given that cubemaps are intended to be omnidirectional. If that is the case, perhaps you can perform the transform in the material. What are you using as the UVs for your cube render target? They should be a vector3 so you may be able to pass in the player’s X Y and Z vectors using material parameter collections and perform a matrix3x3inverse using those vectors and the 3d UVs.

RyanB,

Yes, that’s what I thought too. Unfortunately it would seem like cubemaps all require a reflection vector for their UV input… Which leads me to the other question: how do I combine a vector3/ texCoord node with a reflection vector to plug into a single UV input? Thanks for the reply, btw.

It can be reflection vector or just any v3 such as CameraVector or Worldposition. reflection vector samples it as a reflection but cameravector/worldposition would sample it like its a skybox without reflection… cameravector would always be centered on the camera but worldposition would actually map as if it was projected onto the surface so you could technically get close to the edge… in practice they are both about the same if you scale your mesh way up.

You don’t need to convert the value back to a 2 component UV, you can just perform your rotation or transform on the vector itself before plugging it into the camera.

ie, take reflectionvector, then make a node “inveretransform3x3matrix” and then make 3 vector params (or use material parameter collections) and use a blueprint to set those 3 vectors to be your players 3 axis vectors… ie the fwd the right and the up… hook each of those up to the X Y and Z input vectors of the transform node, then plug the result into the cubemap UVs. may just work.

f50849e5156290cd5c3b85776c87867e8389c8b3.jpeg

Hmm, you’re right - thanks!
On a side note however, setting the material up as a non-reflection sounds appealing… How would I achieve the same look (see attached image) using either the CameraVector or WorldPosition nodes?
I tried both and it seems like the WorldPosition node got closer to similar results though I am unclear as to how to modify it to match the result from the ReflectionVector exactly.

It depends on what you want. If the surface you are displaying this on is flat, reflection vector will literally just “reflect” or flip the cubemap along that axis. but if the mesh you display it on is round like a sphere, it will actually bend the reflection along the vertex normals resulting in that spherical mirror look you see in the preview above.

using cameravector is basically like you will be looking a screen space projection of the cubemap. it won’t matter what the geometry you put it on looks like or how it is rotated at all. Think back to like 1990’s skyboxes in ue2 where you had a separate environment for skyboxes and marked surfaces as “skybox” and it would just render the second scene without any parallax.

btw when using the 3 basic worldspace vectors that you did (1,0,0 ; 0,1,0 and 0,0,1), you basically return an unchanged vector since reflection vector is already in worldspace… but it should work as those 3 basis vectors change as long as they stay orthogonal (all 90 degrees to eachother).