🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses 🔴 RELATED VIDEOS 🔴 What are Events? (C# Basics) kzitem.info/news/bejne/sKuQ2JyvpIiqp5w Make Awesome Effects with RenderTextures! (Minimap, In-game TV, Camera to Texture) kzitem.info/news/bejne/op5onmpogKxkkqg How to make ZOOM Shader Effect! (Unity Tutorial Shader Graph) kzitem.info/news/bejne/qnlrsKOJaamJY6g SMOOTH with LERP! (Move, Rotate, Float) kzitem.info/news/bejne/y3eEmH2lkJaBrYI ✅ Get the Project files unitycodemonkey.com/video.php?v=9g2VqJvWnQI
@devzozo
2 жыл бұрын
So there's another way you can do this! You can make a standard glass shader, which there are plenty of guides on making, and using the index of refraction, you can simulate a real telescopic lens! One of the advantages to this is that you get distortion at the edges.
@reactga
2 жыл бұрын
Great video 👍 but I believe the third method can be optimized by disabling the camera when not zooming and just rendering black (or red) on the zoom scope.
@CodeMonkeyUnity
2 жыл бұрын
Yup, if you don't want that bonus effect where you see it working while the rifle is down then disabling the camera will give you a nice boost
@mintesnotmelese6552
2 жыл бұрын
Exactly like in Realm Royale (If you knew this game). And the scope is a little bit smaller, right?
@joy211191
2 жыл бұрын
For the third one, you can add a fish-eye effect on the second camera to get a better effect.
@DarioDAversa
2 жыл бұрын
Nice -- I always use the 1st version for just aiming, and the 3rd one for powered zooms.
@marksmithcollins
2 жыл бұрын
It perfectly makes sense using method #1 with ironsight.
@ezpz4646
2 жыл бұрын
@@marksmithcollins Or reflex/red dot sights
@nocturne6320
2 жыл бұрын
I think the best way gameplay-wise is just do it the way most FPS do. That it, just increase the FOV, disable the weapon viewmodel and use UI to simulate the scope. Works like this in TF2, CSGO, Overwatch, etc.
@at930pmgames
2 жыл бұрын
Yup, best way.
@jaspervandijk27
2 жыл бұрын
@@at930pmgames not the best way but its a way
@jzjzjzj
2 жыл бұрын
yeah but anyone with a brain knows it looks trash and you cant see if some thing is walking near you
@nocturne6320
2 жыл бұрын
@@jzjzjzj It is the best way since I am trying to look trough the scope, not around it. The ways shown in the video are great as a little visual effect for when the weapon is just being held. Actually zooming in is painful when the zoom is only in the center with the rest of the screen remaining unzoomed. Think about it as risk and reward, you get better zoom and accuracy for your whole screen, but loose the wide fov for your surroundings, so its easier to sneak up on you.
@jaspervandijk27
2 жыл бұрын
@@nocturne6320 Just no haha you are full of bs
@agnarzb
2 жыл бұрын
thanks a lot, amazing tutorial. Maybe zoomcamera can be disabled while player not pressing the zoom button. That could solve the problem of continuous resource allocation.
@CodeMonkeyUnity
2 жыл бұрын
Yup that would help performance if you didn't want that bonus effect of seeing the scope working while the rifle is down
@ivailomanolov6908
2 жыл бұрын
WOW ! Love it , it was very fun to watch this video. Nice job
@infinixs4600
2 жыл бұрын
Thanks for this I hope I could support you by Money but I am still a student😂
@CodeMonkeyUnity
2 жыл бұрын
Thanks for watching the videos!
@GameDevForLife
2 жыл бұрын
I will start saving money for you to support your Channel and for keeping creating these incredible video
@infinixs4600
2 жыл бұрын
@@GameDevForLife Absolutely He deserve
@KalponicGames
2 жыл бұрын
are you planning to make a full 3rd person shooter game or something? Would love to see some melee 3D combat too :)
@CodeMonkeyUnity
2 жыл бұрын
Heh not really planning something that big, just exploring lots of topics. 3D Melee is also something I'd like to research, just need to find the time
@diliupg
2 жыл бұрын
Nice Tute! You are very hard working and very smart. Thanks!
@jesse143_
2 жыл бұрын
Can you make a video on mesh deformation? This would be great for tank tracks
@swanoftheeast
Жыл бұрын
Great Video, thanx. Helped me a lot to understand basic priciples.
@CodeMonkeyUnity
Жыл бұрын
I'm glad you liked it! Thanks!
@adamodimattia
2 жыл бұрын
Great content as always!
@vacantknight
2 жыл бұрын
Could you do a tutorial on how to make a gun like your Hookshot but you can swing from the hook so you can like run jump shoot the hook and swing from a object and land
@stephenmackenzie9016
2 жыл бұрын
Nice 👍🏻
@akstis4183
2 жыл бұрын
Is that a magic? I'am currently thinking about scopes implementation :D But anyway thanks for the video. They are very helpfull
@iorusoul
2 жыл бұрын
RenderTexture works fine even in a ps vita wich has a really small arm processor, I guess the complexity of the scenario adds up for potencial problems. I Usually show the render as a part of UI is that less effiecient?
@CodeMonkeyUnity
2 жыл бұрын
You could definitely show it in the UI instead but if you do then it wouldn't look good combined with the rifle up animation. If there's no animation then yup it would look perfect
@PoddStudios
Жыл бұрын
Here's a tip if your using the 3rd option and to lazy to mask the plane just use a cylinder and shrink it. It just WORKS
@4xh9
2 ай бұрын
First Methode Very Good u Can a get Blure Texture For environment with Scope Texture and Hidle all Make the Textures in Ui And u Have it !
@nikodromikro
Жыл бұрын
Thanks
@abhisheksuper20
2 жыл бұрын
simply amazing!!
@huguesdepayens9558
2 жыл бұрын
With the first method, is there a way to blur the area outside of the scope?
@CodeMonkeyUnity
2 жыл бұрын
Only way would be with some kind of mask texture to blur the area outside the scope. Easy if all your scopes have the same shape, more difficult if they're different unitycodemonkey.com/video.php?v=dKsqupXLuSU
@stuart5980
2 жыл бұрын
Could you make a tutorial on how to make a save load system with bolt? I know bolt has save variables but i'm yet to find any tutorial on how to put that to use
@CodeMonkeyUnity
2 жыл бұрын
You can combine it with JSON to save lots of data in a string kzitem.info/news/bejne/laWIvIF5i3WngWU kzitem.info/news/bejne/l6uDrHmDZqCSo3o
@FelineRaptor-gv4te
2 жыл бұрын
@@CodeMonkeyUnity but JSON or XML is not very secure. using binary formating would be better
@CodeMonkeyUnity
2 жыл бұрын
@@FelineRaptor-gv4te It's not intended to be secure, binary formatting by itself is also not secure. Saving Data and Securing that data are two completely separate topics. You can do one without the other or both
@FelineRaptor-gv4te
2 жыл бұрын
@@CodeMonkeyUnity oh. actually i had seen Brackeys tutorial on Save and Load System and there he had said binary formatting was more secure than JSON and XML as these files can be modified easily which is not the case for binary formatter since it is written in binary. but yeah, securing data is a completly different topic, so never mind. was just a suggestion. thanks for replying anyway. means a lot coming from a famous youtuber
@pedramkavian
2 жыл бұрын
Most of the games usually show only the weapon's scope when players press the mouse right button. What about adding some kind of Shader/Post Processing/etc. to the first way to just make the whole screen black but showing only the scope?
@CodeMonkeyUnity
2 жыл бұрын
Sure you could improve the first method by hiding the rest of the screen, could be as simple as a texture with a hole in the middle or a cutout shader
@jihadrouani5525
2 жыл бұрын
3rd Method downside: This might be late but there's a huge downside to the 3rd method, in low light environments (Night time) the lens (quad) won't show up because it needs to be lit, it's only visible when you pass near a light and acts as an opaque material because it is. Potential fix: Make the material unlit, but it'll look weird and way to bright "relative to the night environment", so might need a script to turn down the brightness when you're not scooped. You could use this opportunity to switch the render texture to a low res one to save performance.
@chibidoragon
Жыл бұрын
Attach a script to the scope camera that uses Unitys OnPreRender() call to set ambient light a bit higher and then setting it back on OnPostRender(). Or if you have night vision scope set ambient light to bright green OnPreRender().
@Huyuimu
2 жыл бұрын
i just love this guy
@CodeMonkeyUnity
2 жыл бұрын
Im glad you like the videos! Thanks!
@Huyuimu
2 жыл бұрын
@@CodeMonkeyUnity Always!
@pikkigaming2024
2 жыл бұрын
great vid thanks please keep making videos of like this
@Darmsofficial
2 ай бұрын
I don't know how does reticle works in scopes.. is there any video tutorial on how this thing works??
@MarekNijaki
2 жыл бұрын
Awesome!
@ShortBarrelRaifu
2 жыл бұрын
IMO, use 2nd method for low magnification mode, and 3rd method whenever the scope enter medium-high magnification mode ... and also need to figure out how to integrate those two seamlessly into just one ScopeSystem
@marksmithcollins
2 жыл бұрын
Bravo
@yudipscodeshow
2 жыл бұрын
Excited for squid game 🤞🏻🤞🏻😄😄😄
@Saskamon
2 жыл бұрын
thanks a lot!
@aminthemar
2 жыл бұрын
I disagree that the 3rd one is the best of them since a real-life scope zooms your entire vision which is the 1st one. But if you were to create a magnifying glass for your game, the 3rd one is surely the best.
@CodeMonkeyUnity
2 жыл бұрын
What? How does a real life scope zoom outside of the scope?
@aminthemar
2 жыл бұрын
@@CodeMonkeyUnity In real life, you'd hold the scope up to your face and look into it with one eye and close the other which means you never see outside the scope. Here, you are holding it far away from yourself like a magnifier hoping to kill people with it 🤣.
@Junaidy-hk8ff
2 жыл бұрын
@@aminthemar no, i think the 3rd one without shader and camera post processing is the closest one to real-life scope
@johnbeverly9723
2 жыл бұрын
What about combining methods 1 and 2
@alaa0khallouf
2 жыл бұрын
would love to see your opinion on making scopes for vr. now the third option definitely works in vr but what are your other options for making vr scopes especially if it's for mobile vr which is very hard to optimize
@CodeMonkeyUnity
2 жыл бұрын
Depends on how resource intensive is the rest of your game. If you need maximum performance then the first method would be the best or lower the RenderTexture resolution on the third method
@blitzo8753
2 жыл бұрын
Hi CodeMonkey have you made a video about arranging or sorting scenes assets, files of full games?
@tone.c.a.e
2 жыл бұрын
i wish all fps games have scope zoom effect 1, i love games like that im sad that batttlefields dont have it, but 2042
@arcday4281
2 жыл бұрын
Cool!
@activoysaludable
2 жыл бұрын
Buen vídeo amigo 😃
@dotmbarricade3424
2 жыл бұрын
Can you make a turotial on how to apply stun affect on characters?
@runnair
Жыл бұрын
Hi! Thank you for the great tutorial, I am using the third method. I've got one question. If I throw a smokebomb it will emit partiles over time (texture sheet material) and when I use the scope the particles spread out if I'm inspecting the smoke (because of different FOV). Is there a way to display the smoke and zoom into it at the same time without it being spreaded? PS: I know it's possible to simulate smoke in other softwares and then put it on a non scaling plane, but I'd like to do it with built-in particles, even in standard render pipeline.
@zakvaska666
2 жыл бұрын
Awesome =)
@watercat1248
5 ай бұрын
With sniper's for my game I will probably have the first 1 But with the with gian image that caver the wail screen like old game's. such as counter screen. Not 3D models but I'm sure I will use the second effect in some port's off my game. Also I'm not sure what what type of zoom I will use for weapons that have the option to aiming down site.
@thg1nrediar
2 жыл бұрын
Good
@guidetogamedev3657
2 жыл бұрын
hey can you cover MLAPI and make a tutorial on how to make a fps with it
@bigphizzle9493
2 жыл бұрын
Can you use the third method for a VR game on the oculus quest 2 or will it be too demanding for the hardware?
@MarushiaDark316
2 жыл бұрын
When do we get to see your Squid Game sim?
@CodeMonkeyUnity
2 жыл бұрын
Tomorrow! kzitem.info/news/bejne/pZVoyHumhpeHZ4o
@PRodi_
2 жыл бұрын
Is there a way in to improve quality of the second method?
@CodeMonkeyUnity
2 жыл бұрын
Not really, the shader just zooms in on the already rendered image, it cannot create extra resolution. You could try increasing the global render scale to make the whole game render more but at that point it's much better to use the last approach
@PRodi_
2 жыл бұрын
@@CodeMonkeyUnity Good to know thx :)
@ahmadgamal65
2 жыл бұрын
The best method is to use stencil mask to render what's behind the scope glass and use shader for the reticle and the scope lens affect and zoom using the first method
@iahmed1400
2 жыл бұрын
i am doing exactly that. But with the 2nd zoom shader. But the problem I m facing rn is that, I cant see any transparent object through the zoom shader. Everything else works fine.
@ahmadgamal65
2 жыл бұрын
@@iahmed1400 but I have never seen such a problem
@iahmed1400
2 жыл бұрын
@@ahmadgamal65 i fixed it about an hour after posting the comment lol.
@ahmadgamal65
2 жыл бұрын
@@iahmed1400 I posted a solution but I don't know why the duck 🦆 it's not here
@salimnihat6966
2 жыл бұрын
Great Video !!! Can I ask for a Video about 2D Joints ? ^_^
@CodeMonkeyUnity
2 жыл бұрын
That is something I'd like to research at some point, there's lots of interesting physics joints but I haven't used them much
@SondaPower
Жыл бұрын
I have a problem in URP and Standard Render as well... if I zoom in at some angles the scope becomes too bright or too dark. I can't find the solution only something about the shader but it didn't work.
@A5tr0101
Жыл бұрын
Hey, do you have a video of correcting the barrel spawn to where the scope faces? My idea was to change the bullet spawn position but im unsure how to make it look good
@CodeMonkeyUnity
Жыл бұрын
Best option is simply do a raycast to find the position in front of the scope, then spawn a bullet from the barrel and move to that point instead of straight forward, I did something like that in my Third Person Shooter unitycodemonkey.com/video.php?v=FbM4CkqtOuA
@A5tr0101
Жыл бұрын
Thanks dude, i did just that and it works perfectly
@A5tr0101
Жыл бұрын
I ended up spawning the bullet, lerping it up to the scope alignment then firing forward, in games like battlebit i noticed the tracer isn't visible for 10 feet or so so maybe they do something similar with it
@discoman4118
Жыл бұрын
Is it possible to use 1 render texture and material for 10 snipers, or would I have to create a seperate render texture and material
@CodeMonkeyUnity
Жыл бұрын
As long as you only use one sniper at a time then yes they can all share the same. Just keep the other cameras disabled and only enable the one you're using
@LaughingMan44
2 жыл бұрын
IRL, you wouldn't be able to see through the scope unless your eye is directly behind it and the correct distance away (not too close or too far), and would just appear black or you'd only see a % through the scope. Games like Escape From Tarkov do it, but I'm not sure how? I guess it's a shader of some kind?
@mudokin
2 жыл бұрын
I think it's a dynamic alpha shader, that changes according to the angle of the rifles scope.
@diliupg
2 жыл бұрын
@@mudokin nope! You can do it very easily by having the gunscope ( a black image with a hole in the center with the crosshair) on the UI and while zooming in towards the gun using a cinemachine camera, you can activate the UI crosshair image and see only thru the scope while keeping the surrounding black.
@LaughingMan44
2 жыл бұрын
@@mudokin Cool thanks
@LaughingMan44
2 жыл бұрын
@@diliupg That's not what I was talking about
@OlehBilov
2 жыл бұрын
Yeah, there must be a shader. I've found red dot shader and modified it a little bit so instead of a dot it was rendering a black image with transparent alpha hole in the center. But I couldn't get rid of some graphics artifacts
@zanmeong6289
2 жыл бұрын
Is i7 gen 4 8gb ram and gt740m is enough for developing 2d or simple 3d game on unity?
@CodeMonkeyUnity
2 жыл бұрын
It all depends on how big is the game, just download and try it
@calzar2009
3 ай бұрын
yes i have around the same specs and i have been making games for 4 years
@OmuniReborn
2 жыл бұрын
Bro, We love your work and appreciate it a lot but... WHY LIGHT MODE?! lol
@CodeMonkeyUnity
2 жыл бұрын
Because dark mode burns my eyes, I can't look at it for more than 10 seconds
@OmuniReborn
2 жыл бұрын
@@CodeMonkeyUnity Thanks for the reply ^^ Was totally kidding of course but I'm actually shocked that that's the case :o sorry to hear!
@MASTONGAMES
2 жыл бұрын
lack of blur area outside the crosshairs (peripheral vision)
@CodeMonkeyUnity
2 жыл бұрын
The third method does have that
@Anders2057
2 жыл бұрын
7:52 hola. mi shader es rosa. sabes que podria ser? 7:52
@ekekw930
6 ай бұрын
At 9:40 how do I add that depth of field effect only to that camera?
@CodeMonkeyUnity
6 ай бұрын
You can define the Volume layers on the camera. So you can have one volume with DoF and one without, and make the cameras that you want to have DoF include that volume in their layers
@ekekw930
6 ай бұрын
@@CodeMonkeyUnity I cannot seem to get it to work. I have one MainCamera, with my sniper model under it, and in my sniper model I have my AimCamera. I have two different post processing volumes; one global and one with DoF. Both are enabled, and the DoF field I have put on the Layer "Lens". In the MainCamera I have added Defualt and Lens layers to the Volume Mask and now the DoF takes effect but also on the AimCamera. How do I exclude this one?
@ekekw930
6 ай бұрын
I have also tried removing "Lens" from the AimCamera culling mask but without any luck
@ekekw930
6 ай бұрын
@@CodeMonkeyUnity Its only blurring when aiming, when moving around the image looks clear in the scope
@victorcamacho6253
2 жыл бұрын
i did something similar to 3rd method some years ago, more recent a had troubles to get a good solution to simulate a red dot, do you know some shader to can replicate the functionality of a red dot or holographic sights?
@CodeMonkeyUnity
2 жыл бұрын
I'm not sure what is the specific effect for a holo sight, is it just staying a bit behind when the player moves? If your renderer has motion vectors you could probably use that, or just some simple code logic based on the mouse input
@TigerMax96
2 жыл бұрын
Second solution doesn't work in URP? Renders plain white material. Thanks for your tutorial!
@CodeMonkeyUnity
2 жыл бұрын
I am using URP in the video, watch the dedicated video on the zoom shader kzitem.info/news/bejne/qnlrsKOJaamJY6g
@adhochero6619
2 жыл бұрын
was hoping this would've been a bit more advanced and make it look like looking through a real scope. all these option just look like the scope is digital and not optical
@CodeMonkeyUnity
2 жыл бұрын
What do you mean by that? How would you make it look "optical" ? Add some lens distortion on the side? You could do that on the shader that is rendering the render texture
@adhochero6619
2 жыл бұрын
@@CodeMonkeyUnity yeah something like that also if your not looking at it strait on have the black edges from the scope. idk don't to describe it but it was solve the unrealistic issue of seeing through the scope while its down by your side. great video though. just was hoping one of the options went into to how to really make a realistic scope as its hard to find much more than the basic ways
@charliekendall7511
2 жыл бұрын
Could the second camera be improved by moving the zoom shader effect to the end of the sight, so the cross isn't magnified?
@s4shrish
2 жыл бұрын
Fundamentally, it will always be a little pixelated, as it's essentailly a screen-space effect. Meaning, it essentially takes the scene_render.jpeg, cuts it to seperate layer, zooms in, and pastes it on the scope object. You can move it whereever, a 4X Zoom will lead to a 4X reduction in Pixel Density. Or like we say in terms of Phone cameras, it's Digital Zoom, not optical Zoom. Tho I would like to say one thing, if we consider the third method's Scope's area on the screen, it doesn't really take more than 50% of the vertical height. So for a 1080p image, that would be 540p. Or even 512x512. 1000x1000 seems small when you compare it to actual screen res, but when you actually look at how much area it occupies at most, the max res it will need on a 1080p monitor is 512x512. And if one optimises it acc to game's resolution settings, we can save more performance whilst keeping the scope only as pixelated as the rest of the game.
@mudokin
2 жыл бұрын
yes and no, the cross would not be zoomed, the rest would still be pixelated.
@CodeMonkeyUnity
2 жыл бұрын
For the cross, you can make it use a shader that renders after the zoom shader, put in on Queue Transparent + 100 and it should be unzoomed
@juice1884
2 жыл бұрын
Why would you ever use normal C# events using Unity? I find the serializable nature of UnityEvents so helpful during game design, as I can change the game in seconds without changing code at all. Even in this case, what if the user wanted to add a sound when the rifle goes up? They'd have to add extra code.
@CodeMonkeyUnity
2 жыл бұрын
Yup that's exactly the difference. Do you prefer working mainly in the Editor? Use UnityEvents. Do you prefer working mainly in code? Use C# Events. Personally I like to keep my games as much in the code as possible so for me I prefer C# events.
@juice1884
2 жыл бұрын
@@CodeMonkeyUnity Gotcha!
@cate01a
2 жыл бұрын
Damn, I wonder if there's better options for vr? 1 is N/A, 2 works but is not great coz pixels (pavlovs solution), and 3 is cool but probably wouldnt work if you looked at the scope at angles, also would probably be buggy if the gun clipped through the ground
@thepolandman2447
2 жыл бұрын
You could probably change the rotation of the zoom camera depending on the angle the player is looking into the scope. If the angle is too big (e.g. looking at the scope from almost the side) turn off the render texture.
@cate01a
2 жыл бұрын
@@thepolandman2447 oh yeah that might be a solution!
@iahmed1400
2 жыл бұрын
I tried the shader method. It worked fine, but when i aim, i can see the inside of the body of the scope because my 3d model is hollow. Is there a way I can keep the sphere with zoom shader at the front of the scope and render its output to another one that is at the rear / closer to the camera?
@CodeMonkeyUnity
2 жыл бұрын
Nope, that method just expands the pixels exactly as they are. Maybe you could try something really complex playing around with the render tags queue but for your case using hte third method seems best.
@kris.tamang
2 жыл бұрын
3:18 only scope zoomed in will be better and realistic, I guess !!
@CodeMonkeyUnity
2 жыл бұрын
You could disable the zoom camera while the rifle was down if you didn't want that bonus effect
@Inf4mousKidGames
Жыл бұрын
So... Zoom levels are just hard coded FOVs?
@CodeMonkeyUnity
Жыл бұрын
You can put that data anywhere you want, doesn't have to be directly in the code, you could make a ScriptableObject for each Scope and store the fov there
@Inf4mousKidGames
Жыл бұрын
@@CodeMonkeyUnity oh I understand that but the one thing I've been looking for, for an fps game I wanted to make was zoom levels for scopes. Like what are the values to mimic zoom levels such as 1.4x 2x 3x 5x 6x 10x And I never got an answer. This video you've made is the closest I've gotten to an answer
@vrajmodi8122
2 жыл бұрын
how to use post processing and Depth of field?
@CodeMonkeyUnity
2 жыл бұрын
You add the Volume component and enable Post Processing on the camera This video covers the steps to add Bloom which is a PP Effect kzitem.info/news/bejne/w6GGy2WesYGelX4
@infinixs4600
2 жыл бұрын
First one to see this video
@crazyfox55
2 жыл бұрын
In the second method both the scope and the crosshair are pixelated. Is there anyway to get the crosshair to stay small?
@diliupg
2 жыл бұрын
yes.
@CodeMonkeyUnity
2 жыл бұрын
You can make the cross use a shader that renders after the zoom shader, put in on Queue Transparent + 100 and it should be unzoomed
@Junaidy-hk8ff
2 жыл бұрын
hey codemonkey, how about 3d person camera scope ?
@CodeMonkeyUnity
2 жыл бұрын
Usually in third person games it either only uses the first method, changing the FoV, or it swaps into a full screen view of the scope
@impheris
2 жыл бұрын
bookmarked
@absolutesolver-ur5hb
2 жыл бұрын
how to make elevator when press button to move up or down??
@diliupg
2 жыл бұрын
use transform translate on the elevator object and a C# Action event to send a message for the translation to happen.
@absolutesolver-ur5hb
2 жыл бұрын
@@diliupg thank very cool
@ferdiandestrinata9573
2 жыл бұрын
Codemonkeyy i need ur help
@burhanahmad3140
2 жыл бұрын
@tunnatio9751
2 ай бұрын
BRUH CANT DOWNLOAD IT FAKE
@CodeMonkeyUnity
Ай бұрын
What do you mean? There's a download link in the description
Пікірлер: 161