1
$\begingroup$

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.

$\endgroup$
6
  • $\begingroup$ So you want to see HDRI background, but you want the perspective to be fixed, as if whenever you rotate the camera, it doesn't actually rotate but instead everything else rotates? $\endgroup$ Oct 23, 2022 at 10:24
  • $\begingroup$ The HDRI background image is fixed in A state (so the color is also fixed), I want only that Gundam image I made to move at various angles. $\endgroup$
    – GKCC
    Oct 23, 2022 at 10:58
  • $\begingroup$ Do you mean something like this? If so, I'm sure I've seen it posted, but can't find it.... $\endgroup$
    – Robin Betts
    Oct 23, 2022 at 12:25
  • $\begingroup$ Stupid question but I don't seem to understand what you want. You want the background to be fixed while the camera is moving...? Moving to... see the object from different sides while keeping the background consistent? What about rotating the object instead of moving the camera? $\endgroup$ Oct 23, 2022 at 13:39
  • $\begingroup$ Every time you move the screen, the HDRI background color keeps changing. I wanted to fix it. I couldn't find a proper way. So I just change it to a simple HDRI Puport background color changes less. I decided to write this Thank you very much for your interest in the comments $\endgroup$
    – GKCC
    Oct 23, 2022 at 14:51

1 Answer 1

3
$\begingroup$

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?):

  1. 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 empty

  1. Add a Copy Rotation constraint to the Empty and use the Camera as Target. You can leave all settings at default.

copy rotation

  1. 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.

add mapping

  1. 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.

rotation offset

moving background

  1. 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.

mixing backgrounds

$\endgroup$
6
  • $\begingroup$ Alternatively, you could just use the Texture Coordinate: Camera for the image sampling. But then your HDRI image needs to be flat. $\endgroup$ Oct 24, 2022 at 9:46
  • $\begingroup$ Wow!!!! This is the need I was so looking for. I'm so happy you taught me a really cool method!!!! $\endgroup$
    – GKCC
    Oct 24, 2022 at 10:01
  • $\begingroup$ @MarkusvonBroady Right, but since HDRIs used for lighting are usually 360°, I didn't go for the simple solution here. $\endgroup$ Oct 24, 2022 at 10:07
  • $\begingroup$ @GordonBrinkmann oh, I mean your solution, just that the Camera Ray part could use the Camera coordinate, and another Image Texture. Perhaps you could even figure out the maths to still use the same Image Texture, I've never tried that so I don't know how hard it would be… The simplest approach seems to be to render an empty scene, and then use the resulting image. $\endgroup$ Oct 24, 2022 at 10:10
  • $\begingroup$ @MarkusvonBroady My bad, of course you're right, this would work as well... just the perspective of the background would change, the equirectangular mapping doesn't work the same if you use Camera. Maybe I'll edit the answer later. $\endgroup$ Oct 24, 2022 at 12:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .