You already have the camera vector (the vector of the camera's local X-axis)... so I assume you mean constructing the Eye Vector (aka Ray Vector: the vector of each individual pixel)?If so, you could certainly calculate that by building a ViewProjectionMatrix manually, based on an arbitrary camera position, FOV, orientation, etc... But I feel like that might be way over-complicating the problem, not to mention a LOT heavier on the GPU (matrix multiplication, etc).Since you already know the "camera position" (whether it be an actual camera, or even just an arbitrary helper widget or whatever), just feed that to the material, either as a MaterialParamCollection or directly as a param to a DynamicMaterial, and then just use the pixel WorldPosition (which should be correct, regardless of the "camera"/location you're rendering from) and calculate the worldspace eyeVector on the fly:It's entirely possible I'm missing a specific reason you'd need to factor in "Camera"Vector, ScreenSpacePos, etc... but based on your description, it doesn't seem like you need to factor in your "camera"Vector at all. And if for some reason you do, just feed the "camera" Front(X)Vector into the same MPC (in the BP) and access that the same way (in place of the intrinsic CameraVector node).
you don't need to feed the camera position into a shader using blueprint - you can access it directly from inside the shader using the cameraPositionWS node. https://docs.unrealengine.com/en-US/Engine/Rendering/Materials/ExpressionReference/Coordinates/index.html
Thanks for the help guys, appreciate it. but neither the world position or camera position works - nor camera vactor. This is because I'm not rendering to the screen. Basically nothing camera or world related works.I'd need the shadetroy method to work inside Unreal. So, construct both the camera vector and camera position from uv and fed in camera pos (like on the example image). The problem is that I don't understand matrices so I can't get the camera rotation to work properly.
after it goes through the rotate vector material function (with camera direction fed in from blueprints) to align it to the player view, something goes wrong
Obscura said:Thats awesome, many thanks Eric! Will post some updates soon. I can start doing half res lighting, denoising, and depth based post processes, such as dof which uses the raymarch scene depth.