🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses 🔴 RELATED VIDEOS 🔴 What are Events? (C# Basics) ua-cam.com/video/OuZrhykVytg/v-deo.html Make Awesome Effects with RenderTextures! (Minimap, In-game TV, Camera to Texture) ua-cam.com/video/Ah2862Gz3_s/v-deo.html How to make ZOOM Shader Effect! (Unity Tutorial Shader Graph) ua-cam.com/video/IC5JoS0wX0s/v-deo.html SMOOTH with LERP! (Move, Rotate, Float) ua-cam.com/video/jAN2IoWdPzM/v-deo.html ✅ Get the Project files unitycodemonkey.com/video.php?v=9g2VqJvWnQI
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.
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.
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.
@@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.
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.
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.
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().
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
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?
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
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?
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
@@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
@@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
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.
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.
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 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 🤣.
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
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
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
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
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
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
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.
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
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
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
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 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.
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
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.
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
@@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?
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
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?
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
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
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.
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 ua-cam.com/video/bkPe1hxOmbI/v-deo.html
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?
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.
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
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
@@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
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.
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.
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.
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
@@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
🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses
🔴 RELATED VIDEOS 🔴
What are Events? (C# Basics) ua-cam.com/video/OuZrhykVytg/v-deo.html
Make Awesome Effects with RenderTextures! (Minimap, In-game TV, Camera to Texture) ua-cam.com/video/Ah2862Gz3_s/v-deo.html
How to make ZOOM Shader Effect! (Unity Tutorial Shader Graph) ua-cam.com/video/IC5JoS0wX0s/v-deo.html
SMOOTH with LERP! (Move, Rotate, Float) ua-cam.com/video/jAN2IoWdPzM/v-deo.html
✅ Get the Project files unitycodemonkey.com/video.php?v=9g2VqJvWnQI
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.
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
Exactly like in Realm Royale (If you knew this game). And the scope is a little bit smaller, right?
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.
For the third one, you can add a fish-eye effect on the second camera to get a better effect.
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.
Yup, best way.
@@at930pmgames not the best way but its a way
yeah but anyone with a brain knows it looks trash and you cant see if some thing is walking near you
@@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.
@@nocturne6320 Just no haha you are full of bs
Nice -- I always use the 1st version for just aiming, and the 3rd one for powered zooms.
It perfectly makes sense using method #1 with ironsight.
@@jamesmillerjo Or reflex/red dot sights
Thanks for this I hope I could support you by Money but I am still a student😂
Thanks for watching the videos!
I will start saving money for you to support your Channel and for keeping creating these incredible video
@@GameDevForLife Absolutely He deserve
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.
Yup that would help performance if you didn't want that bonus effect of seeing the scope working while the rifle is down
WOW ! Love it , it was very fun to watch this video. Nice job
Nice 👍🏻
Nice Tute! You are very hard working and very smart. Thanks!
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.
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().
Great content as always!
Great Video, thanx. Helped me a lot to understand basic priciples.
I'm glad you liked it! Thanks!
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 !
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
Can you make a video on mesh deformation? This would be great for tank tracks
Thanks
Is that a magic? I'am currently thinking about scopes implementation :D But anyway thanks for the video. They are very helpfull
are you planning to make a full 3rd person shooter game or something? Would love to see some melee 3D combat too :)
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
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
I don't know how does reticle works in scopes.. is there any video tutorial on how this thing works??
simply amazing!!
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?
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
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?
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
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
You can combine it with JSON to save lots of data in a string
ua-cam.com/video/4oRVMCRCvN0/v-deo.html
ua-cam.com/video/6uMFEM-napE/v-deo.html
@@CodeMonkeyUnity but JSON or XML is not very secure. using binary formating would be better
@@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
@@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
i just love this guy
Im glad you like the videos! Thanks!
@@CodeMonkeyUnity Always!
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.
Bravo
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.
Awesome!
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.
What? How does a real life scope zoom outside of the scope?
@@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 🤣.
@@aminthemar no, i think the 3rd one without shader and camera post processing is the closest one to real-life scope
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
great vid thanks please keep making videos of like this
What about combining methods 1 and 2
Excited for squid game 🤞🏻🤞🏻😄😄😄
With the first method, is there a way to blur the area outside of the scope?
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
thanks a lot!
Buen vídeo amigo 😃
i wish all fps games have scope zoom effect 1, i love games like that im sad that batttlefields dont have it, but 2042
Awesome =)
Good
Cool!
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
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
Hi CodeMonkey have you made a video about arranging or sorting scenes assets, files of full games?
hey can you cover MLAPI and make a tutorial on how to make a fps with it
Is there a way in to improve quality of the second method?
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
@@CodeMonkeyUnity Good to know thx :)
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
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.
@@iahmed1400 but I have never seen such a problem
@@ahmadgamal65 i fixed it about an hour after posting the comment lol.
@@iahmed1400 I posted a solution but I don't know why the duck 🦆 it's not here
Can you make a turotial on how to apply stun affect on characters?
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
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
Thanks dude, i did just that and it works perfectly
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
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?
I think it's a dynamic alpha shader, that changes according to the angle of the rifles scope.
@@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.
@@mudokin Cool thanks
@@diliupg That's not what I was talking about
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
Can you use the third method for a VR game on the oculus quest 2 or will it be too demanding for the hardware?
7:52
hola.
mi shader es rosa.
sabes que podria ser? 7:52
Is i7 gen 4 8gb ram and gt740m is enough for developing 2d or simple 3d game on unity?
It all depends on how big is the game, just download and try it
yes i have around the same specs and i have been making games for 4 years
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.
lack of blur area outside the crosshairs (peripheral vision)
The third method does have that
At 9:40 how do I add that depth of field effect only to that camera?
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
@@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?
I have also tried removing "Lens" from the AimCamera culling mask but without any luck
@@CodeMonkeyUnity Its only blurring when aiming, when moving around the image looks clear in the scope
When do we get to see your Squid Game sim?
Tomorrow! ua-cam.com/video/D_2bGpMeV4U/v-deo.html
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
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
Great Video !!! Can I ask for a Video about 2D Joints ? ^_^
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
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?
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
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
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.
@@thepolandman2447 oh yeah that might be a solution!
how to use post processing and Depth of field?
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 ua-cam.com/video/bkPe1hxOmbI/v-deo.html
3:18
only scope zoomed in will be better and realistic, I guess !!
You could disable the zoom camera while the rifle was down if you didn't want that bonus effect
Second solution doesn't work in URP?
Renders plain white material.
Thanks for your tutorial!
I am using URP in the video, watch the dedicated video on the zoom shader ua-cam.com/video/IC5JoS0wX0s/v-deo.html
Bro, We love your work and appreciate it a lot but... WHY LIGHT MODE?! lol
Because dark mode burns my eyes, I can't look at it for more than 10 seconds
@@CodeMonkeyUnity Thanks for the reply ^^ Was totally kidding of course but I'm actually shocked that that's the case :o sorry to hear!
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?
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.
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
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
@@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
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.
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.
@@CodeMonkeyUnity Gotcha!
First one to see this video
Could the second camera be improved by moving the zoom shader effect to the end of the sight, so the cross isn't magnified?
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.
yes and no, the cross would not be zoomed, the rest would still be pixelated.
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
In the second method both the scope and the crosshair are pixelated. Is there anyway to get the crosshair to stay small?
yes.
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
So... Zoom levels are just hard coded FOVs?
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
@@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
hey codemonkey, how about 3d person camera scope ?
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
how to make elevator when press button to move up or down??
use transform translate on the elevator object and a C# Action event to send a message for the translation to happen.
@@diliupg thank very cool
bookmarked
Codemonkeyy i need ur help
BRUH CANT DOWNLOAD IT FAKE
What do you mean? There's a download link in the description