Sniper Scope Using Bump Offset

I’m working on making a sniper scope that in some way behaves like an actual sniper scope. Here’s what the material looks like right now.

It works by having a circular window that is moved around via the bump offset node, showing certain parts of what is streamed back from a Scene Capture 2D component. This get’s me similar results to what can be seen here and here in that the crosshair points exactly where the rifle is going to shoot, and you need to look directly down the scope to see the full picture. But it also has some problems.

  • The window moves in the exact wrong direction. As the camera moves from left to right the window should move from right to left, and as the camera moves from the top to the bottom, the window should move from the bottom to the top.
  • The window maintains it’s apparent size when the camera moves closer or further away, when it should shrink significantly as you move further away, and grow to the right size when moving close.
  • The window doesn’t move nearly enough, even with an extreme value such as -2000. The amount it moves should be doubled or tripled from what it currently is.

I know this isn’t the intended use for the Bump Offset node, but I’m not sure how I could go about achieving this effect using anything else.

I was able to fix one problem, the window and picture shrink when moving further away and grow to the proper size when moving close. I had to increase the field of view from 1 degree to 5 degrees to make it work but the problem was fixed. I also made the little visible area fade to black when the camera got too far away.

I still haven’t figured out how to solve the other two problems though, so please if anyone has any idea how to reverse the direction the bump offset shifts the UV or how to increase the amount it moves I would greatly appreciate it.

This might seem obvious, and I haven’t worked much with BumpOffset, but couldn’t you just invert the height value?

I tried it. I also tried reversing the height ratio and reference plane. I got the same result, the window moves in the same direction as the camera. I also have realized that if there is a way to convert the bump offset output to Texture 2D I can apply regular transformations to it and get the result I want, but looking around there doesn’t seem to be a way to do that either.

Looks like you’re having the same amount of luck as I was trying to use bump offset node.
Instead of trying to make that work, I switched to manually feeding in the UV offsets into the material.
This let me control which direction the sight image goes and which direction the shadow goes.

I’m sorry for my ignorance, but how would I go about doing this?

A quick forum search found a nice thread on the subject:
How to split U and V in texture coordinates?

I split the UV using two component masks, but even when I modify them separate from each other anything I try to do still has no effect. Using an add node doesn’t shift the UV’s at all, multiplying just scales the UV’s, it doesn’t change the direction they shift. I’ve tried rotating them using sin, cos vector rotation. I’ve tried appending them in reverse. It’s the same story when I try do do all of these things when the UV’s are together.

Should look something like this:

The TexCoord is a default one - nothing changed.
The clamp is there to be fed into two multipliers used for the UV’s of the shadow textures.
Prevents them wrapping around :expressionless:

hi guys, i wanted to know the difference between hunting scopes and some good sniper scopes? Except for qualities, is there any other thing that distinguishes these two types of scopes? are can they be interchanged for their purposes and serve fully? I know my question is a bit off the topic, but this is the only chance I have to ask about this. Thank folks.

I still can’t get the bump offset to work in the right direction, it looks good, but when I move from left to right, the black inner circle, that uses the bump offset goes from left to right too, but it should go from right to left, since this is how a real sniper scope works, splitting the UV didn’t help.
Any tips for that?