Field of view visualisation (E03: stencil shader)

In this bonus episode we create a stencil shader to achieve a cool limited FOV effect.
Source code:
github.com/SebLague/Field-of-...
Some links about stencil shader:
docs.unity3d.com/Manual/SL-Ste...
forum.unity3d.com/threads/unit...
Support my videos on Patreon:
bit.ly/sebPatreon

Пікірлер: 176

  • @SebastianLague
    @SebastianLague8 жыл бұрын

    I thought the series was finished, but apparently you guys thought differently! As requested, in this episode we look at creating a stencil shader to render only what is visible to the player. Check links in description for some extra info on stencil shaders. Hope you enjoy :) Don't forget that you can support these videos on Patreon if you wish. www.patreon.com/SebastianLague?ty=h

  • @Mikekan13

    @Mikekan13

    8 жыл бұрын

    +Sebastian Lague Totally support these. Only wish I could afford to give you more.

  • @SebastianLague

    @SebastianLague

    8 жыл бұрын

    +Michael Kantack Thanks, I appreciate it!

  • @YuriNoirProductions

    @YuriNoirProductions

    8 жыл бұрын

    +Sebastian Lague Wow Sebastian this is great.. i'm a gamedesigner and had a concept a long time in my mind.. I planned to realise this via normal shadows and lighting but ewncountered so many problems..you really helped me to get back on that project ! thanks a lot!

  • @Wulcat

    @Wulcat

    8 жыл бұрын

    +Sebastian Lague Hello , how can i ask you question about the topic related to procedural cave generation tutorial>?

  • @krontexpit

    @krontexpit

    6 жыл бұрын

    +Sebastian Lague your tutorial is fantastic even until now! How would you create a stencil object shader for a 2D sprite?

  • @fatal510
    @fatal5108 жыл бұрын

    The production value and quality of your videos is outstanding. You deserve any success that may come your way.

  • @fallenhoenix1255
    @fallenhoenix12557 жыл бұрын

    I can't thank you enough! i was dreaming of how to make a render mask for effects like glow or lens distortion. i leaned more in the first 3 minutes than i could've hoped. keep up the excellent work!

  • @AvoidingCrisis
    @AvoidingCrisis4 жыл бұрын

    2020. 5 year old and still relevant tutorial series (the whole Field of View I mean). Holy damn man.

  • @Mikekan13
    @Mikekan138 жыл бұрын

    This is really awesome. It almost works for a perspective cam too.

  • @hunterongames77
    @hunterongames776 жыл бұрын

    Again, very cool stuff. Thanks for your wonderful tutorials helping us beginners learn the ropes.

  • @InnocentEX
    @InnocentEX7 жыл бұрын

    Awesome tutorial series, your articulation is on point.

  • @alaslipknot
    @alaslipknot8 жыл бұрын

    Literally everything in this video is 100% new to me Thank you !! And Happy new year =) !

  • @rodolforubens
    @rodolforubens8 жыл бұрын

    shaders are black magic

  • @EdgarGarcia-kt7bv

    @EdgarGarcia-kt7bv

    6 жыл бұрын

    I swear

  • @tim6kya635
    @tim6kya6358 жыл бұрын

    Really good tutorial with many clear explanations. I love it. I think that there is something to do with this principle - a good puzzle game. Thank you Seb ++

  • @speed2908
    @speed29088 жыл бұрын

    Infinitely useful tutorial. Thanks!

  • @asdzxcvbqwerty
    @asdzxcvbqwerty8 жыл бұрын

    Amazing work as always!

  • @user-ke3cm1gh4o
    @user-ke3cm1gh4o7 жыл бұрын

    It's very cool!Hope you publish more tutorial like this!

  • @KaletheQuick
    @KaletheQuick8 жыл бұрын

    Nice! I'm going to try and make a version where what was previously in your fov fades slowly, like a memory.

  • @Dark.Flame97
    @Dark.Flame976 жыл бұрын

    Exactly what I was looking for. Thank ya!

  • @visumecadev1778
    @visumecadev17785 жыл бұрын

    Thanks @Sebastian for this tutorial serie about FOV. However, i can't get the stencil mask to work on my perspective camera (but it works very well in orthographic mode). What can i do to make it working in perspective mode ?

  • @Siausalas
    @Siausalas8 жыл бұрын

    TripleA. Amazing As Always!

  • @VaustXIII
    @VaustXIII11 ай бұрын

    Thank you so much for this series! A couple of questions: 1) If you were to implement the same mechanic now (7 years later), what would you change in your approach? Have you learned some better ways to do it or is this one as basic as it gets? 2) Is this approach good for 2d games? It feels like creating 3d meshes for 2d space is excessive

  • @Qmansvendetta1
    @Qmansvendetta14 жыл бұрын

    Hats off man! Beautiful!

  • @YuriNoirProductions
    @YuriNoirProductions8 жыл бұрын

    hey sebastian! do you know an easy way to implement something like a stencil falloff? like a view range that slowly fades out?

  • @NelliSw
    @NelliSw8 жыл бұрын

    Hello, I've been wondering on will you be continuing on the "Creating a 2D Platformer" -series?

  • @Silreen
    @Silreen8 жыл бұрын

    Hi! Awesome video! It helped me out alot. I have one pretty urgent question though - the fieldvisualization viewfinder I made according to this tutorial can't seem to see cast shadows. Do you have any idea what might be the problem?

  • @lordkelvin1
    @lordkelvin17 жыл бұрын

    Great tutorial as always! Followed it all the way through perfectly. Just a question if you happen to know. I tried an approach of duplicating the ground and having a standard material on the version that I want to see in the background, but for me that material has shadows of different lengths on it than are being projected onto my shader material when I make those parts visible in the field of view. Any thoughts on why?

  • @CodanCrux
    @CodanCrux6 жыл бұрын

    Hey Sebastian, i'm currently working on a little game using your technique to create long shadows. Is it somehow possible (maybe with a shader?) to soften the edge at the end of the field of view circle so that it fades out like a shadow?

  • @kaleidos2010
    @kaleidos20107 жыл бұрын

    Thank you for your work. The video and the resource are all perfect. I want to ask a question. Can I use it with sprite renderer?

  • @VictorWinberg
    @VictorWinberg8 жыл бұрын

    Firstly, I love your videos and have learned so much about Unity, coding, math applied to games and more. Secondly, I have a question regarding the shading effect when the camera is tilted. Is there some kind of easy way to make it work even tho the camera is tilted a bit? Because the shader effect gets really weird if the camera is not directly on top of the scene. Thanks so much for your videos, it helps a lot!

  • @noonoox12
    @noonoox126 жыл бұрын

    Hmmm. Is it possible to make objects using the StencilObject shader only cast their shadows within the mask?

  • @Secretlycat31
    @Secretlycat313 жыл бұрын

    These are amazing thank you so much

  • @checol70
    @checol707 жыл бұрын

    As a question, wouldn't it be better to scale the View Visualization object so that if you are doing a 360 degree area it shows the color behind as well as in front?

  • @Lost1nTranslation
    @Lost1nTranslation6 жыл бұрын

    This is so cool!

  • @wassilchoujaa3478
    @wassilchoujaa34784 жыл бұрын

    would be cool if you could still see the background with a reduced visibility

  • @maow9240

    @maow9240

    3 жыл бұрын

    have you found any tutorials on how to do that? i'm currently trying to figure it out.

  • @atoastlover

    @atoastlover

    3 жыл бұрын

    @@maow9240 Did you manage to figure it out by any chance?

  • @hangyboi

    @hangyboi

    5 ай бұрын

    you managed that yourself maybe? @@atoastlover

  • @bytestream64
    @bytestream648 жыл бұрын

    Short but great. Thx a lot.

  • @andreimuresanu1678
    @andreimuresanu16788 жыл бұрын

    THANK YOU VERY MUCH! You are a wizard! :)

  • @ItsIntelligentDesign
    @ItsIntelligentDesign4 жыл бұрын

    Is there a way to modify this shader so that instead of everything not in view being black it is simply darker (ie take the normal color for that pixel and multiply it by RGB(0.25f, 0.25f, 0.25f)?

  • @372leonard
    @372leonard8 жыл бұрын

    could you maybe do a series on how to make a ray tracer after this i would really love that.

  • @bsbalazs1585
    @bsbalazs15858 жыл бұрын

    This is working fine with 3D scene too, but the hidden objects have visible shadow :/ Any solution without set off shadow on the gameobject renderer? (I like to hide only the object, without black fog...)

  • @Sartoris36
    @Sartoris362 жыл бұрын

    Any ideas on how to convert this to URP/Shader Graph?

  • @joepeaden1661

    @joepeaden1661

    Жыл бұрын

    Hella late but for future devs- (kzread.info/dash/bejne/d66Bmq6AqrDQncY.html). It's the best I could find at least.

  • @klubkofta

    @klubkofta

    Ай бұрын

    If you are using URP and the masking effect isn't happening, or your stencil shaders are giving a parse error claiming there is an unexptect "}", you can fix it by creating a new URP shader graph (if this is for the stencil object shader, set up sprite color & alpha outputs from _MainTex inside the shader graph editor, so that the resulting material can get the color of your main texture), click on "View Generated Shader" in the inspector, copy the generated codes from the shader graph to your .shade file, then make the edits in this video (add the stencil pass in the subshader before all other passes). As long as both of your shaders are URP, things should work properly.

  • @javierflores9352
    @javierflores93526 жыл бұрын

    Thank you so much Sebastian, you have no idea of how much useful has being your tutorials, do you know how to implement this in a 3d enviroment? do you think this would be expensive?(i say it for the raycasting)

  • @Taubsen
    @Taubsen8 жыл бұрын

    Does this work on 2D too?

  • @jishmael98
    @jishmael988 жыл бұрын

    Thank you very much for this :3

  • @jirip.9347
    @jirip.93477 жыл бұрын

    Hi, this is really cool solution.. But I am still wondering, how to force viewMeshFilter to copy the terrain by its normal. If the terrain is not only flat surface. Or it would be nice, to detect height from ground during rendering the view angle..

  • @basistish
    @basistish8 жыл бұрын

    С новым годом тебя! Привет из Сибири!

  • @Somiaz
    @Somiaz3 жыл бұрын

    Is there anyway for the targets to have a bool inside them to check if they are being seen or not?

  • @Wightwing0
    @Wightwing05 жыл бұрын

    Hey, I know this is old, but I'm trying to figure out a way to create multiple levels of the field of view. For context: I'm trying to make a different level of field of view when holding a key to view objects at a low/higher level. Like, crouching behind a barricade, changing the field of view. Do you know how I could go about that?

  • @ogix123
    @ogix1238 жыл бұрын

    Hey Sebastian, great tutorial! What would you recommend as the best way to draw a darkened version of the level instead of just black outside of the cone of vision?

  • @maow9240

    @maow9240

    3 жыл бұрын

    have you figured this out? i got the black oustide but i don't want it to just be all black

  • @supercables251

    @supercables251

    2 жыл бұрын

    @@maow9240 have 2 cameras on top of each other, one renders the game, the other renders the fov mask to a render texture. A post processing shader draws the game where the fov mask is white and the hidden color/texture where the fov is black. Good shader tutorials kzread.info/dron/EklP9iLcpExB8vp_fWQseg.html

  • @notemp853
    @notemp8538 жыл бұрын

    Do you know use this variable "public List visibleTargets = new List ();" "VisibleTargets.Add" I wanted to convert but I do not know you know how one can convert to "Js" ???

  • @AltonDoyle97
    @AltonDoyle978 жыл бұрын

    Can you make a video on how to make compasses used in Skyrim or Fallout, with way point markers and such?

  • @cadebender7101
    @cadebender71013 жыл бұрын

    How do I make the shader compatible with a 2D Lit Scene?

  • @bobbill1589
    @bobbill15898 жыл бұрын

    Have you thought about doing a volumetric shader tutorial? for say..fog or clouds?

  • @Domingo155
    @Domingo1552 жыл бұрын

    Man, thx you very much! Спасибо!

  • @benmadine6033
    @benmadine60336 жыл бұрын

    Does anyone know if you can change the colour of the Visualization FOV mesh?

  • @spencertruett7136
    @spencertruett71363 ай бұрын

    for some reason my targets are not rendering I am using unity version 2022 I don't know if this is still viable with the later version. Everything up to this point was working fine and I had thought everything was fine until this point

  • @laurens109
    @laurens1097 жыл бұрын

    Does this work with UI elements, like canvases?

  • @alex39507
    @alex395076 жыл бұрын

    How do I make a 2d version?, I tried to convert it but it didn't work

  • @rendioktaviardo3757

    @rendioktaviardo3757

    5 жыл бұрын

    yeah, i search it too, waiting an answer

  • @wokarol
    @wokarol6 жыл бұрын

    Can you make something like Mark's of the Ninja Fov, where everything not in field of view is blured?

  • @user-wy1fb4kj7u
    @user-wy1fb4kj7u4 жыл бұрын

    this doesn't work on latest version of unity. could you please explain last part of the camera setting

  • @inzolis2551
    @inzolis2551 Жыл бұрын

    I have an issue where if I add the material with the shader/object script, it brings the brightness/ contrast to my sprite very low, is there a way to fix this, do I need to add some code to the .shader file?

  • @jishmael98
    @jishmael988 жыл бұрын

    Is the field of view method and also this shader adaptable for 2D objects in Unity?

  • @SebastianLague

    @SebastianLague

    8 жыл бұрын

    +Josh Nicholson Yes, though you'll have to add transparency to the stencil object shader if you want it to work well with sprites.

  • @SandDashGaming

    @SandDashGaming

    8 жыл бұрын

    +Sebastian Lague Hey, I have tried to make the "Object Mask" stencil transparent to work with sprites but the sprites don't seem affected by my changes to its transparency. I have looked on the unity forums and can not find anything to help, could you tell me what exactly needs to change in the stencil?

  • @reed9269
    @reed92695 жыл бұрын

    just a thought but could the mesh be created in the shader so it performs even better? i might just be uninformed of course.. : -)

  • @vxg2963
    @vxg29637 жыл бұрын

    Good times. Favorited, liked, subscribed, belled. >:D

  • @vxg2963

    @vxg2963

    7 жыл бұрын

    Question: Camera following and WASD movement with W being forward at all times (based on character's facing, while A and D strafe based on character's facing and D moves backward). I got the camera part by using: Camera.main.transform.position = new Vector3(rigidbody.position.x, 50, rigidbody.position.z); (is there any better way to do it?) Can you help me out with the movement?

  • @simondatking
    @simondatking4 жыл бұрын

    hey sabastian did you know that a game thats called (among us) is using exactly that line of sight effect?

  • @realtimberstalker
    @realtimberstalker6 жыл бұрын

    Can you make tutorials on how to make and edit 3d meshes in unity using script

  • @user-li6ty2um4r
    @user-li6ty2um4r7 жыл бұрын

    Awwwwwww Awesome!!

  • @RawrtexX
    @RawrtexX8 жыл бұрын

    Hi sebastian! I love your tutorials the helped me quite a lot. But now i have a little problem. I want the camera to follw the player. I cant get this working. everytime i my player turns arround like a freaking wheel... i have no idea how to fix this...

  • @jamestmp4071

    @jamestmp4071

    6 жыл бұрын

    Try the following: using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraTracking : MonoBehaviour { public Rigidbody Target; // Update is called once per frame void Update () { transform.position = new Vector3(Target.position.x, 10, Target.position.z); } } Just set the Target to the player rigidbody, or any other rigidbody you wish to track.

  • @paularbas2444
    @paularbas24448 жыл бұрын

    Having a hard time getting this to work for 2d game with sprites. Is it possible to adapt this to sprites/2d? Can't wrap my head around it at all.

  • @eggsscramblerzz4711

    @eggsscramblerzz4711

    5 жыл бұрын

    mesh != sprite

  • @snoober6690

    @snoober6690

    4 жыл бұрын

    I got something working in 2D The ` marks are not to be included and designates code between them: - I used the "unlit shader" instead of "surface shader". not sure if that part matters. Make the two shaders that Lague makes in the youtube tutorial. - Change the tags `"RenderType"="Transparent"` and `"Queue"="Transparent"` (and Transparent-100 for the mask). Below the tags add `Cull Off` line and `ZWrite Off` line. Do this for all 3 shaders total we will make. - Make a 3rd shader (I used unlit) and do the same changes as in the last step. Add a color property (check out Ronja's tutorial on properties www.ronja-tutorials.com/2018/03/22/properties.html). This involves a line in Properties block `_Color("Color", Color) = (0, 0, 0, 1)`, a line below pragma's but outside of structs/functions `fixed4 _Color;`, a line in the appdata struct `fixed4 color : COLOR;`, a line in v2f vert function `o.color = v.color;`, and a line in the frag function `col *= _Color;`. - Also add a blend to the fog shader. add below tags `Blend SrcAlpha OneMinusSrcAlpha`. - Add a stencil block to your fog shader, but it's going to be opposite of your object shader. So it's: Stencil { Ref 1 Comp NotEqual } - Make a material for each of the shaders (3 materials, one for mask shader, one for object shader, and one for fog shader). For the fog material, the color is currently white because of the (0, 0, 0, 1) part from last step. Change it to black and change the alpha via inspector window. The blend line will use this alpha so play around with this value. - Make a sprite that covers your level. Make sure everything on the same z-level (probabably 0). This will be your fog, so change the material to your fog material. - Change your view visualization cone material to your mask material, and change any objects you want to not render outside the cone to your object material. I hope I got everything I did in this comment. The fog is an optional difference I made, because I would like certain objects to just be darkened instead of not rendered at all, but you could leave that part out if you want it more like Lague's tutorial (and just make everything object shader so it won't be rendered when outside of view cone).

  • @phoder1

    @phoder1

    4 жыл бұрын

    @@snoober6690 Any chance you can upload the files somewhere? The link for the guide you provided no longer exists.

  • @snoober6690

    @snoober6690

    4 жыл бұрын

    @@phoder1 here's the page from the wayback machine: web.archive.org/web/20200407085549/www.ronja-tutorials.com/2018/03/22/properties.html

  • @phoder1

    @phoder1

    4 жыл бұрын

    @@snoober6690 Great thank you! I got it to work.

  • @hybrid4551
    @hybrid45518 жыл бұрын

    How would you go about making the viewmesh more of a cone to allow for a more 3D look

  • @keraunos94

    @keraunos94

    7 жыл бұрын

    Hey man it's been 1 year but did you make it ? I need a solution for this exact issue ! Thx

  • @hangyboi

    @hangyboi

    5 ай бұрын

    did you make it eventually? xd@@keraunos94

  • @keraunos94

    @keraunos94

    5 ай бұрын

    @@hangyboi hahaha waw 6 years ago. IIRC a dev friend helped me to make a 3d cone with many ray tracing (from origin to many points on a circle), from all hit points he created a dynamic mesh I guess, now about the mask/shader stuff I really don't remember sorry, not event sure we made it XD There should be more stuff now than 6 years ago though. Good luck^^

  • @hangyboi

    @hangyboi

    5 ай бұрын

    @@keraunos94 yeah, honestly for my game this tutorial was more than enough. Glad you are alive, just commented on you for fun :)

  • @conceptfactory5604
    @conceptfactory56043 жыл бұрын

    Have a way to fade in-ou the distant enemies?

  • @alexandrecosta8875
    @alexandrecosta88758 жыл бұрын

    n1, ty mate

  • @conceptfactory5604
    @conceptfactory56043 жыл бұрын

    My characters have a toonshader, how to blend two shaders?

  • @Prototypezxz
    @Prototypezxz7 жыл бұрын

    Can i using your skrip for my project?

  • @TheStigChristensen
    @TheStigChristensen8 жыл бұрын

    How can I add a transparency to it, if I'd prefer it not totally black?

  • @Blocks0

    @Blocks0

    7 жыл бұрын

    Hi. I'm looking for an answer to this also. Have you found a solution?

  • @TheStigChristensen

    @TheStigChristensen

    7 жыл бұрын

    Nope, nothing so far :/ Shaders are hard man

  • @Blocks0

    @Blocks0

    7 жыл бұрын

    Maybe I figured it out. You build a mesh of the visualisation and give it a transparent white-ish material. Then, place another mesh over all of the map. Make it have a transparent dark material. The places that are not seen in the field of view are darker than the where there is a view mesh, since the mesh's white-ish material cancels out the darkness. It's a hacky way of doing it, and I'm sure there's a way better way, but it's what I've got so far.

  • @distrologic2925

    @distrologic2925

    7 жыл бұрын

    you would probably need something else than a stencil shader, since a stancil shader is mostly only used to store "On/Off" vaules. a depth shader could store float values, which you could use as a transparency value. I have no idea if or how this works in unity however.

  • @neverever719

    @neverever719

    6 жыл бұрын

    I'm currently trying to find a different solution, but right now I have this (I'm using a 2D scene, this might not work in 3D): 1) Duplicate the original object, darken the surface of the duplicated one, and move the original object above the duplicated one. 2) Apply the Stencil Object Shader to the original object. When the original object is hidden, the copy below it be be revealed, giving the illusion of transparency.

  • @gotbaka3
    @gotbaka3 Жыл бұрын

    You are amazing

  • @AnteP-dx4my
    @AnteP-dx4my8 жыл бұрын

    Can you make more blender tutorials I realy liked ones you made I would realy be happy if make some Thanks.

  • @seaniboy2009
    @seaniboy20094 жыл бұрын

    any one having issues with this not showing the enemys but its showing the view as blocking them. also the buildings are showing but are not getting any color

  • @timotheemonney6547
    @timotheemonney65476 жыл бұрын

    I copy the shader but nothing diseappear with the object mask I'm in unity 2017.3 is there something to change ?

  • @timotheemonney6547

    @timotheemonney6547

    6 жыл бұрын

    I didn't set my camera as orthographic. That why it didn't work But it there a way to do the same with perspective camera?

  • @davidawesome4569
    @davidawesome45692 жыл бұрын

    Great tutorial, but the source code isn't up to date to the finished project in the video, there's some parts lacking in it like the scene doesn't have the stencil mask layer.

  • @stilllemonade3874
    @stilllemonade38746 жыл бұрын

    It just shows damn pink instead of being like a light.

  • @sarveshchavan4391
    @sarveshchavan43916 жыл бұрын

    can we do this for 2d ?? please reply

  • @reed9269

    @reed9269

    5 жыл бұрын

    so can we ?

  • @Teddy_Bear312
    @Teddy_Bear3127 жыл бұрын

    Since my camera is not entirely topdown but with a 45 degrees angle the shader is cutting through the objects, how would i solve this? imgur.com/a/jKGrb (screenshot of problem)

  • @hadiseylani2265
    @hadiseylani2265Ай бұрын

    how to make a shader for this created mesh ?

  • @psiho92
    @psiho926 жыл бұрын

    I managed to setup the shaders on 2d textures, but I am having issues with the maskCutAwayDist, I don't know how to show all edges of the blocking textures, at most I manage 2. for example I use Vector3.up * maskCutawayDist + Vector3.right * maskCutawayDist and I get the texture edges shown on left and bottom parts (Vector3.forward * maskCutaway does not do anything for 2d). Has anyone tackled this?

  • @psiho92

    @psiho92

    6 жыл бұрын

    Hmm, I think the issue is I do not rotate the player object :/

  • @psiho92

    @psiho92

    6 жыл бұрын

    Ok, this is how you would go around this: Vector3 tempPoint = transform.InverseTransformPoint(viewPoints[i]); vertices[i + 1] = tempPoint + tempPoint.normalized * maskCutawayDist;

  • @simonaberg4392

    @simonaberg4392

    6 жыл бұрын

    Would you mind sharing how you setup the shaders for 2D?

  • @lostsin1
    @lostsin17 жыл бұрын

    YOU ARE THE ONE!!!! THANK YOU!!

  • @shatley123
    @shatley1238 жыл бұрын

    Oh shit shaders

  • @ShadowLow25
    @ShadowLow258 жыл бұрын

    So it can be applicable on an RTS Fog of war system ? Am I wrong ?

  • @emascheg

    @emascheg

    8 жыл бұрын

    +Castor Holyday Yep well be work but is going to need to more work.

  • @ShadowLow25

    @ShadowLow25

    7 жыл бұрын

    Tile based game ? haha switch to unreal engine everything is free and easy to make fog of war :p

  • @exavi
    @exavi Жыл бұрын

    So, how make shader for URP?

  • @shazilsindhu
    @shazilsindhu8 жыл бұрын

    in my own project, whenever i put the stencil mask on my view visualisation material, the field of view disappears. Why is that? can anyone help?

  • @binyang8849

    @binyang8849

    7 жыл бұрын

    i have the same problem

  • @binyang8849

    @binyang8849

    7 жыл бұрын

    I JustNow Solved this Problem By Upgrading Unity

  • @hippopotamus86
    @hippopotamus863 жыл бұрын

    Can this work on a 2d scene?

  • @shurikend
    @shurikend8 жыл бұрын

    Hello, I'm currently translating your Fov code to 2D, I have your part 1/2 and 2/2 working but I don't understand how to use the shader on 2D sprites. From what I can read in the comment we have to use transparency to make it work. But I don't see my level through the plane with the Shader. Can you help me a little (even if it's been 4 month you created this tuto) ;)

  • @shurikend

    @shurikend

    8 жыл бұрын

    +shurikend Managed to resolve it by editing the sprite default shader instead of the one you used :)

  • @eysi94

    @eysi94

    8 жыл бұрын

    +shurikend Can you share your code(the shader) with your fellow scrubs :)

  • @docmuerte

    @docmuerte

    8 жыл бұрын

    +shurikend Could you share your shader code? I can't get my head around shaders.

  • @shurikend

    @shurikend

    8 жыл бұрын

    +DocMuerte this is the shader script for the sprites you want to hide : pastebin.com/NaiXch83 and this one is for the mesh to reveal the previous one: pastebin.com/E2Nu2ytb

  • @docmuerte

    @docmuerte

    8 жыл бұрын

    +shurikend Big thanks! I experimented until I got it working.

  • @foveal
    @foveal6 жыл бұрын

    How can you apply this to a 2d game?

  • @EdgarGarcia-kt7bv

    @EdgarGarcia-kt7bv

    6 жыл бұрын

    with black magic as rodolfo rubens said

  • @alexbryer490
    @alexbryer4904 жыл бұрын

    Looks like for some reason that method doesn't work anymore 2019.1f. Thx for the tutorial anyway

  • @Mikekan13
    @Mikekan138 жыл бұрын

    YOU ARE A GOD AMONG MEN!

  • @JoeVonFo
    @JoeVonFo4 жыл бұрын

    This sadly seem to have stopped working in the newest version of Unity :-/

  • @Shringyshrong

    @Shringyshrong

    3 жыл бұрын

    it definitely still works, have just got it all setup!

  • @erdrako1805
    @erdrako18058 жыл бұрын

    Hi! I want to achieve this visible Field Of View but in runtime... Any hints?

  • @kamilblue
    @kamilblue8 жыл бұрын

    Tutorial showing how to use it on sprites in 2D would be great :)

  • @kamilblue

    @kamilblue

    8 жыл бұрын

    +Kamil Buczel doesn't matter, made it myself :p

  • @andreimuresanu1678

    @andreimuresanu1678

    8 жыл бұрын

    +Kamil Buczel How? I can't seem to do it.

  • @kamilblue

    @kamilblue

    8 жыл бұрын

    +Andrei Muresanu FieldofView class codeshare.io/y9JKN editor class: codeshare.io/O4NOn Code expires in 14 days :) Goodluck (don't mind polish comments :P)

  • @andreimuresanu1678

    @andreimuresanu1678

    8 жыл бұрын

    +Kamil Buczel Thank You Very Much :D!!! Yet is it supposed to cast shadow? Because that does not work. Thanks again :).

  • @eysi94

    @eysi94

    8 жыл бұрын

    +Kamil Buczel I'm desperate!! Please share the code again.

  • @luisacosta6020
    @luisacosta60207 жыл бұрын

    Hello I liked your tutorial and I want to apply what I learned in a game that I am doing and maybe I will market it, it would affect me legal inquiry Please answer quickly

  • @rikrishshrestha5421
    @rikrishshrestha54214 жыл бұрын

    why does shader seem to be the most hardest thing to learn in unity?

  • @ufukseyithan

    @ufukseyithan

    4 жыл бұрын

    Ikr

  • @psych0p3
    @psych0p37 жыл бұрын

    This could work for an AI

  • @BigDaddyGameDev
    @BigDaddyGameDev6 ай бұрын

    This hurt my little brain

  • @conceptfactory5604
    @conceptfactory56043 жыл бұрын

    My mesh is totally irregular

  • @longers2550
    @longers25507 жыл бұрын

    500 (like) :D