Join us on Discord at https://discord.gg/CeUpmbC :parrotsailor: All tutorials available at https://chamferzone.com/

Get Your Holographic Sights Here Lads! (UE4)

Anything cool you want to share that may otherwise be hard to categorize.
Post Reply
User avatar
siks
Site Admin
Posts: 798
Joined: Tue Mar 28, 2017 8:04 pm
Location: Great United of Britania's Kingdom Long Live Her Majesty The Queen Elizabeth II
Has thanked: 667 times
Been thanked: 648 times

Sun Aug 06, 2017 12:52 pm

I'm sharing a pretty basic UE4 material that uses pixel depth offset to create a holographic sight. Mainly for those who want to render guns and sights in Unreal, but this could also be used in a game, though don't ask me for the performance metrics.

Download: Just drag and drop the folder into your 'Unreal Project>Content' folder.
https://mega.nz/#F!9eoEiawK!Wiw44afU5pZNrsD_iD7vkg



Notes:
  • The glass you want to apply the material to needs to be centred on the UV 1-1 space. If it's not directly in the centre then the sight will be offset. So just give the glass element its own material/textureset for painter and slap it on its own UV sheet. The proportions and size don't really matter, it doesn't have to use up the entire UV space, just keep it centred.
  • If you set the distance hologram too far, it'll basically make the sight appear orthographic. So if you pan your camera around, it'll just move along with your camera.
  • Make sure the distance is a negative value.

Big ol' ramble:
I was really scratching my head over how these holographic sights actually work, but I came to a conclusion based on the videos I saw, mainly this wiki article and this video:
https://www.youtube.com/watch?v=NNrOetjzme4
https://en.wikipedia.org/wiki/Talk%3ARe ... allax_free

Looks like the holo sight isn't perfect, it has a distance at which it's optimal at and aiming it at something closer or further than that will make the hologram deviate from where the gun is actually pointing.
This material is basically the same thing as other people have shared online, but unlike the others I could find I added a distance variable and a scale variable for the hologram.
Make love, not war.
Except for in games... everybody loves war in games. And love, yep, that too.

ArtStation - https://www.artstation.com/artist/siks
Nathan_is_cool
Posts: 26
Joined: Mon Jan 16, 2017 2:43 pm
Has thanked: 11 times
Been thanked: 7 times

Fri Aug 11, 2017 9:38 pm

Cool! Quick question. How do you make the glass transparent?
User avatar
siks
Site Admin
Posts: 798
Joined: Tue Mar 28, 2017 8:04 pm
Location: Great United of Britania's Kingdom Long Live Her Majesty The Queen Elizabeth II
Has thanked: 667 times
Been thanked: 648 times

Sat Aug 12, 2017 9:21 am

The material should already be transparent, make sure you use the M_SightTest_Inst, there you can control lots of parameters like opacity.
If you want to make a default material into a transparent material you need to change the blend mode to 'Translucent' and lighting mode to 'Surface TranslucencyVolume'.
Image
Make love, not war.
Except for in games... everybody loves war in games. And love, yep, that too.

ArtStation - https://www.artstation.com/artist/siks
User avatar
Maxime Dupart
Posts: 38
Joined: Wed Jan 11, 2017 11:07 pm
Location: Paris
Has thanked: 37 times
Been thanked: 26 times
Contact:

Thu Sep 28, 2017 8:57 am

Hey siks, tried downloading your sample but it asked for a encryption key :thinking:
User avatar
siks
Site Admin
Posts: 798
Joined: Tue Mar 28, 2017 8:04 pm
Location: Great United of Britania's Kingdom Long Live Her Majesty The Queen Elizabeth II
Has thanked: 667 times
Been thanked: 648 times

Thu Sep 28, 2017 9:24 am

Hmm sorry! I should've checked it before. It should be working now. :thumbsup_dude:
Make love, not war.
Except for in games... everybody loves war in games. And love, yep, that too.

ArtStation - https://www.artstation.com/artist/siks
Post Reply