On the image below, I have a solid color for my background. I want to use an HDRI texture instead, but so that it doesn't change when I move the camera. The objects on the scene should be lit in the usual way, by the entire HDRI.
I hope I understand correctly what you want to achieve. If so, here is how I would do it when using an HDRI as background. Please note that this only works when using the camera view, since you cannot simply plug the "viewport view" into the Shader Editor (maybe someone else knows a way with some python scripting?):
- Place an Empty in the world's center at X/Y/Z = 0/0/0 and leave the rotation 0°/0°/0° as well.
- Add a Copy Rotation constraint to the Empty and use the Camera as Target. You can leave all settings at default.
- Go into the Shader Editor set to World. Plug a Mapping node into the Environment Texture and connect it to the Object output of a Texture Coordinate node. Choose the Empty as Object.
- Now you can use the Rotation in the Mapping node to create an offset to the Camera's rotation to select the view of the HDRI you want to see. You can now move the camera around, the background will always stay the same. Just note that since the background is moving together with the camera, the lighting conditions change.
- If you want the view to change but not the lighting, you can duplicate the Environment Texture node and use it without Mapping. Use a Mix Shader with a Light Path node's Is Camera Ray output as factor. Of course both Environment Texture nodes can be mapped if you need it to get the lighting the way you want. You just can't use the Object output of the same _Texture Coordinate _ node for the one that shouldn't move, but the implicit default when not using the Vector input for the Environment Texture is Generated anyway.