UE4 - Tutorial / HowTo - Line of Sight Vision System

Поделиться
HTML-код
  • Опубликовано: 30 сен 2024

Комментарии • 143

  • @GrieferStudios
    @GrieferStudios 16 дней назад +1

    is there any way to fix all the ugly aliasing/bleeding?

  • @bierkules2608
    @bierkules2608 3 года назад +8

    Everything that a great tutorial needs, straight forward, great pace and a good audio!

  • @aburns89
    @aburns89 2 года назад +2

    Thanks for the tutorial, I took the system you built during the "Create Line Trace System" section of the video to enable a cone shaped line tracing system for a football (soccer) game I'm developing.
    It looks asthough the system needs ~>50% of the line traces to be inhabited by another character for the desired player to become available to pass to (set by the "Out Hit Hit Actor"), do you know if its possible to set the "amount of traces required" to a certain amount? Thanks

  • @SilllyLizard
    @SilllyLizard 9 дней назад

    how would you make it transparent like darkwood instead of a flat color?

  • @ShortBusTrip
    @ShortBusTrip 2 года назад +2

    Great tutorial. Love the implementation. As others question, multiplayer implementation is a hurdle. I’m sure most people are thinking Among Us style LOS fog… or maybe that was just me 😂 Thanks bud I’m sure I’ll find this useful moving forward

  • @antimeh666
    @antimeh666 8 месяцев назад +1

    Super great tutorial.
    I have a question. Is there a way to actually change the opacity of the mask so you can see parts of the background?

  • @MrRemingt0n
    @MrRemingt0n 11 месяцев назад +1

    Amazing, thanks! I'm trying to change the opacity of the Material to have a semi-opaque effect, how do you achieve something like this? And potentially trying to blur the edges of the masks so it appears a bit softer. Thank you!

  • @MasterPiffy
    @MasterPiffy 7 месяцев назад

    I know this is old, but its not hard to make a custom event that ends with a retriggerable delay and then have that event start on play to make your own timers and not use event tick.

  • @FinnBossen
    @FinnBossen Год назад +1

    Great tutorial. Was really nice to follow. What do I need to add that also niagare effects are only showing inside my line of sight?

  • @chewa3948
    @chewa3948 Год назад +1

    Awesome tutorial, thanks! I managed to make it work with multiplayer thanks to your explanations in other comments. In general, it seems pretty heavy on performance, specifically if you want to draw it 360 degrees, and with 'only' 360 raycasts, it can look pretty jittery, is it expected? Any tips on if it can be optimized to make it more smooth / less heavy on performances?

  • @bombum1487
    @bombum1487 3 года назад +1

    Did this works for 3rd person perspective or just works for topdown, thanks!
    I read the doc but dont clear much!

    • @Okaricraft
      @Okaricraft  3 года назад +1

      yes, its designed for a general 3rd person perspective.

  • @mikewill4440
    @mikewill4440 4 года назад +3

    Great video do you know how to mask out the actors that are being hidden by the post process? I lerped the hidden part with the scene so it would show a bit of it so its not 100 one color, but doing this will also show the actors along with the scene. How can I render just the background and not the actors when they arent in sight? thank u

    • @Okaricraft
      @Okaricraft  4 года назад +4

      Great question, the answer has multiple parts. The first difficult part is that there's no way to render behind an object while its still there without rewriting engine files, this is just due to how the render culling works in unreal. This means you need to mask the portions of the actor that aren't in 100% sight by having their materials, not just the post process, affected by the mask as well. I actually played around with this, object opacity masking, initially when I was first developing this method for LoS Vision, and wonderfully if you simply collapse most of the material nodes, the portion that determines the lerp value, into a material expression, you can absolutely use it to control masking opacity directly, thus 'erasing' an object when its in, or not in, view. This introduces two major issues though.
      The first issue was, when an object is masked this way, the engine does not fill in the slice, thus all geometry can be thought of as hollow, and slicing it reveals the inside, complete with potential issues of backface culling. the solution to this would be needing to render a filler polygon to match up with the partially sliced face, but I could not find a good performant way to handle this, so you would need to overcome this. You can ignore this issue though if your game is as close to orthographic as possible and looking straight down.
      The second issue is that masked objects do not cast shadows, or block dynamic lighting. If this isn't an issue then no worries here, but I was looking for a way to allow off camera objects to still have visual effects that made sense, and you can get some weird lighting issues if for example, the wall between you and a light source only exists while you can see it.

    • @NateIorg
      @NateIorg 4 года назад +4

      In your trace function, you can store an array of actors that are hit. If it isn't hit, it essentially shouldn't be rendered. Combine this with tags and you've got a fairly solid solution.
      Example, all actors of BP_Character_Base should be hidden if they're not traced, UNLESS they have the tag "AlwaysRender". Rather than looping through all actors of class on every frame, just check for changes to the array. If it's newly added, set the visibility to true. If it's newly removed, set the visibility to false. This will make the operation MUCH cheaper than looping through all actors, will dynamically remove the actors when they are behind walls, and still render scenery.
      For multiplayer, extend this a bit with network culling and the IsNetRelevantFor() method. The server will check if the player's array contains the other player pawn. If it does, it will replicate. Otherwise, it won't. Without the culling in place, it'll be extremely easy for someone to create hacks that will always show other players. That may be of no concern to you, however.

    • @jamesfraser8303
      @jamesfraser8303 3 года назад +1

      @@NateIorg @Okari First up great tutorial Okari, really clear and super useful, thank you. I am having trouble adding the functionality of hiding the enemies the player can't see. I understand the logic of Nate's suggestion but I can't implement it! I'm trying to take the On Hit Hit Actor and turn that in to a set visible for the hit actor. As I'm 'paying' for this trace already it makes sense to get the results out of the same trace but running this new stuff on from the current trace array adds has me dumbfounded! Could you expand on this point with more specific blueprint wiring? Any help very very appreciated. Thanks

    • @MasterPiffy
      @MasterPiffy 7 месяцев назад

      been a while, but you can apply this whole material to an enemy master material instead of a post process material and set it to use opacity.
      You can also use a boolean on your enemy bp to set visibility on tick (or a timer), checking if that bool is true, and if it is, after the trace, check if the actor has a tag, if it does, cast to it and set the bool.

  • @steven-pascalking875
    @steven-pascalking875 3 года назад +1

    How can i do that for Multiplayer that everyone have one seperate ?

  • @arthurmestre2192
    @arthurmestre2192 2 года назад +1

    realy thx, just how can i up the size of the triangle pls ?

  • @Dontasticats
    @Dontasticats 9 месяцев назад

    I'm absolutely losing my mind over this, the default brick-like texture works as it should, but as soon as I put anything into the texture object slot of world aligned texture, it refuses to pick up the updated character position. It's on my onTick event, it picks it up whenever I start the game, it just doesn't send an update every frame like it's supposed to.

    • @Dontasticats
      @Dontasticats 9 месяцев назад +1

      Update; I'm a fucking idiot and somehow attached a spawned in pawn to my player start point, so whenever I moved that it would move the overlay. Deleting the pawn fixed it.

  • @redaikir2901
    @redaikir2901 3 года назад +1

    Having a very weird issue where i have a point in the scene that isn't within the traces appear, no matter how far you get from it, as well as, as many errors as i have traces. stating, "Blueprint Runtime Error: "Attempted to access index 101 from array TraceResults of length 101!". Blueprint: MyCharacter Function: Prepare Triangle for Canvas Graph: PrepareTriangleForCanvas Node: Add" with the numbers decrementing down to 0.

    • @redaikir2901
      @redaikir2901 3 года назад +2

      Literally a few seconds after i figured out the weird bug, when subtracting the index, i had mistakenly placed a -2 in the subtraction a - b, right after clearing the triangle array. *facepalm*

  • @nomiki8436
    @nomiki8436 3 месяца назад

    Maybe it's just my computer... but it seems like the png attached to your tutorial is corrupted.

    • @nomiki8436
      @nomiki8436 3 месяца назад

      Great tutorial none the less btw! Loved it. Precise and interesting, never got boring the whole way through.

  • @LorcanG
    @LorcanG 4 года назад +1

    Anyway of making the raytraces to slowly extend to the collision point instead of making it an instant trace I'm trying to make a shock wave effect for throwing up dust. The effect looks really well on a project I have on unity.

    • @Okaricraft
      @Okaricraft  4 года назад +2

      If your just looking to extend the far points of the line trace then there is a fairly trivial solution of having a timeline that you trigger outside of the LoS system in the event graph. its value should go from 0 to 1 as a float, save this and multiply this value by the max distance we use for the line trace itself. If you also want to move the back points of each trace, such that the vision ends away from the player center, the solution is more complex as you can no longer render the view region with triangles, and instead need quads to describe the mask region. To do this though based on what's shown, instead of saving a vector for each line trace, I would instead save a struct that contains the Ray far point, and the Ray near point, so that when you construct triangles you can modify the for loop to draw triangles based on the additional information, this will double the for loop length though.

  • @SpankyDmonkeyChannel
    @SpankyDmonkeyChannel 3 года назад +1

    I have an issue with this, in that I want to make the area around an object clickable when the player is nearby it by clicking the box collision. However, because this means I'd need to make the trace responses on the box collision visible in order to accept the click happening. This with the LOS Vision system ends up interpreting the box collision as something being hit, masking everything behind it in darkness.
    Any potential solution to this? Is there a way to make the box collision clickable without it blocking the traces that determine what is masked and what isn't?

    • @jeremiebonneau4991
      @jeremiebonneau4991 3 года назад

      You could make a new line trace channel response in the project setting :). Cheers!

    • @SpankyDmonkeyChannel
      @SpankyDmonkeyChannel 3 года назад +1

      @@jeremiebonneau4991 Thanks! I actually had figured this out a bit after I commented, but always good to see someone coming in to help.
      Say I am running into another odd issue, don't know if anyone else would be able to assist. At the very end of the video Okari describes how to implement the little sphere around the character so you can see around him. I did exactly as the video said (as far as I'm aware), and I am able to make this sphere. However, meshes just outside the sphere show up. I'm assuming this is happening because it is a "sphere"mask, thus picking up bits of the 3D space around it.
      Is there any way to make it simply a solid circle that gets revealed?

  • @AlanSikora
    @AlanSikora 3 года назад +1

    First of all, thank you very much for this tutorial, I really appreciate that you took the time to share that knwoledge with us.
    I have a question: if I'm working on a multiplayer game, would that view cone be easily hackable on the client side? If so, how the server could ensure the client is not hiding that?

    • @Okaricraft
      @Okaricraft  3 года назад +1

      I'm glad you liked the tutorial! As far as hackability goes, I don't have a good answer to the question. I haven't dealt or considered cheating much in games yet, but I can wildly speculate a little.
      one of the primary ways to cheat would be to intercept the server/client conversation and use that information somehow or add fake messages to it. since in a replication situation the vision system would be handled client side there wouldn't be anything to intercept this way. the system does rely on a texture in a post process, so theoretically changing that texture (like I've seen in dark souls with nick cage faces replacing everything) might be possible. the good note is, as I recommended in another comment, that texture can and should be created and then updated dynamically which means there is no specific place on the hard drive to actually change something. That would mean you would have to crack the game and change actual assets and materials and how they functioned.

  • @SimonHalliday001
    @SimonHalliday001 3 года назад +1

    Excellent tutorial, really appreciate the documented companion website too, keep up the great work! :)

  • @TheKidWhoCodes
    @TheKidWhoCodes Год назад

    When I try to import any png or jpg file I get 2 errors:
    1- "Unable to retrieve the payload from the source file"
    2- "Texture has zero width or height"
    What's the issue?
    Edit: It was the size of the pic, changed it to 1024x1024 and it worked :}

  • @joaquinvaleron21
    @joaquinvaleron21 6 месяцев назад

    This is an amazing tutorial m8! :). I have a question, is there any way to activate the cone with an input? For example if you want the cone look like a flahslight. Thanks, you're a beast :D

  • @mar7en608
    @mar7en608 3 года назад +1

    Big love for that

  • @flowscurrent6310
    @flowscurrent6310 2 года назад +1

    Literally explains everything perfectly. Best tutorial ever.

  • @AfterHoursGames
    @AfterHoursGames 4 года назад +1

    Hey man, excellent tutorial! Just curious, do you believe it's possible to render multiple cones- IE if I had multiple pawns that I'd want to use this effect for?
    I imagine that I could duplicate my nodes and have different material parameters for each pawn, but that seems a little clunky.

    • @AfterHoursGames
      @AfterHoursGames 4 года назад

      UPDATE: It indeed works if I duplicate the nodes and combine them via an add node and then input it into the alpha. A bit unwieldy, but it works. I'll continue to search for a more elegant solution.

    • @Okaricraft
      @Okaricraft  4 года назад +2

      Glad you were able to find a way that worked, additionally another user, t3q qwtqw, asked a very similar question, and I've got a more detailed response there about how to make a number of small changes to push this functionality into the pawn and control it dynamically individually.

  • @Kramez
    @Kramez 4 года назад +1

    Hi, it seems extending the linetrace beyond a certain point introduces tiling, for example I set my linetrace to 1000 and the B value to 1050 and I started to see the render target repeat itself, is there anyway to fix this? I have my cone drawn at 360 degrees if that matters. Thank you for the tutorial!

    • @Okaricraft
      @Okaricraft  4 года назад +1

      Assuming it works properly for the shorter line traces and you followed the prevent tiling section at 43:15, most likely this is because of the size of the canvas render target. at 1800x1800 if we are dead center we have at most a 900 radius sphere to work with, so depending on canvas settings you may be wrapping how your drawing triangles to it. For your numbers to be safe try at least a 2100*2100 canvas size, and remember to change the textureSize vector input on the WorldAlignedTexture node to match the new canvas size.

    • @Kramez
      @Kramez 4 года назад +1

      @@Okaricraft Thanks! it turns out I just forgot to update the offsetXY parameter

  • @pualgror7083
    @pualgror7083 7 месяцев назад

    hey, that's a crazy good tutorial, thanks a lot!! I have a question though - how heavy is it on performance? can you still get 120 fps with those 80+ traces?

    • @Okaricraft
      @Okaricraft  7 месяцев назад

      Great question! I don't know actually. It's definitely not free. You would need to A/B test it in to find out. You could also throw it onto a custom timer vs using onTick (used that because its simpler for tutorial context) and do the updates slightly less often if needed and blend the transitions.

    • @pualgror7083
      @pualgror7083 7 месяцев назад

      @Okaricraft hey I actually did test it a couple of days ago, and, with 360 traces per frame (lol) I lost about 10 fps in performance. Yes, on timer is a great suggestion, and also I was thinking about splitting thise 360 across multiple frames. I didnt try the latter though

  • @Rinlok
    @Rinlok 3 года назад +1

    thank you for sharing!

  • @djkwon9999
    @djkwon9999 3 года назад

    Thank you okari for share this
    (i did something wrong now fixed problem.)
    thank you for your shares!!!!!!!!!!!

  • @kevinchidiac4590
    @kevinchidiac4590 2 года назад

    Hey there ! Great tutorial helped a lot ! But when i go on full screen the RenderTarget jumps to the left of the screen ( as its not in WorldSpace anymore) and when i move my camera on full screen, the RenderTarget starts moving. Do you have any idea why this would happpen ? Thank You !

  • @ChrisCardozaisawesome
    @ChrisCardozaisawesome 3 года назад +1

    Wow! This tutorial is really great and written documentation is amazing. I wanted to know if it was perhaps possible to draw discrete lines instead of triangles like you did.

    • @Okaricraft
      @Okaricraft  3 года назад +1

      depending on what you mean by discrete lines most likely. the triangles are created using discrete line traces, and their (the triangles) purpose is to ensure a complete continues viewable region. but their use is simply a design choice as their the easiest shapes to fit the data generated (line trace beginning and end points) to.

  • @The1Wolfcast
    @The1Wolfcast 11 месяцев назад

    The render target stuff reminds me of programming opengl with the array of triangles, telling it when its done rendering and beginning draw lol

  • @BenVlodgi
    @BenVlodgi 3 года назад +1

    Great tutorial.
    Was wondering how to draw custom shapes to render-targets. Neat to see a way to do it with triangles on a canvas!

  • @franciscor692
    @franciscor692 Год назад

    I know how to make the cast ray longer but does Anyone Know how to make the vision cone larger?

  • @mekbots
    @mekbots Год назад

    How would I change this so that the end of the cone is centered on the mouse cursor? I know how to get the location of the mouse cursor and I can get it to draw a line from the actor to said location, but if I try incorporate the main bulk of your code here so that it generates a cone, it all acts very strangely.

  • @AhviMa
    @AhviMa 3 года назад

    question: why does my post processing renders higher than what i want to block

  • @gregclarke5225
    @gregclarke5225 3 года назад +1

    How do I make it so that it applies to multiple actors (not multiplayer)?

    • @Okaricraft
      @Okaricraft  3 года назад +1

      You mean so multiple objects or actors can draw shapes to the render target? If so I would recommend a parameter collection, or some way of finding the position of the player themselves as the setup presented here assumes the player is always in the center of their view. If you have a second object however that at least knows its position relative to the player you could do a little vector math to adjust where it would be drawing to the render target without too much issue.

    • @gregclarke5225
      @gregclarke5225 3 года назад +1

      @@Okaricraft I used your tutorial exactly on an actor not in the centre of view and it works perfectly, I'm just struggling to get a second (and more) to work. The traces work fine but the post processing doesn't happen.

    • @Okaricraft
      @Okaricraft  3 года назад +1

      @@gregclarke5225 if your just directly applying the method to more than one then you need to doublecheck your not resetting the render target each time ANY object is attempting to write information to it. At 14:50 you'll notice one thing that is done before anything is drawn the the render target is that it is cleared and reset. If you've got more than one object drawing then its possible you might be erasing information between objects.

    • @gregclarke5225
      @gregclarke5225 3 года назад +1

      @@Okaricraft that's exactly what I thought the problem might be so I was trying to test it with a for each cycling through an array of the actors and using a different render target each time. Struggling to get that to work though it doesn't seem to be cycling through the actors.

    • @gregclarke5225
      @gregclarke5225 3 года назад +1

      So I'm still struggling with this, I've set it to clear the render target before the for each loop cycling through the actors.
      It does seem as though my actors I have added to the array are all index 0 though, I'm not sure how or why but perhaps this is the problem?

  • @odchugames4080
    @odchugames4080 3 года назад

    Abdolute genius, god, i love you and your family you great man

  • @alexandresantos4380
    @alexandresantos4380 3 года назад

    Nice work! Just one doubt, how could I apply that to 2D, is that possible? Thanks!

  • @gangsterhommie9345
    @gangsterhommie9345 3 года назад +1

    Is it possible to do this but with a circle around the player instead of a cone?

    • @Okaricraft
      @Okaricraft  3 года назад +1

      Absolutely. In the section "Create Line Trace System", just make sure NumTraces * DegreesPerTrace equal a total of 360 degrees. The cone will then expand to cover a full 360 circle. Be sure to use enough line traces to get the level of detail desired in the resulting vision mask.

    • @gangsterhommie9345
      @gangsterhommie9345 3 года назад

      @@Okaricraft Than you so much! I seem to be having trouble making it bigger, extending the line length in (create cone) only seems to extend it to a certain amount, and messing with the texture size doesn't help either, any chance you could help me out on this?

    • @Okaricraft
      @Okaricraft  3 года назад

      The size of the texture is the mask being applied to the screen and is very much tied to Screen resolution, to adjust the length of the actual line traces look at the Create Line Trace System section. At 29:03 you can see me creating and adjusting the line trace begin and end values. I set a value to 700 to adjust the end point of my line trace, by increasing this number you can increase the length of the line trace.

  • @tristenbernier9998
    @tristenbernier9998 3 года назад

    How Do I do this with a 2D Sidescroller?

  • @t3qqwtqw840
    @t3qqwtqw840 4 года назад +1

    Do you know how to go about replicating this? currently this only works for one player in the server

    • @Okaricraft
      @Okaricraft  4 года назад +2

      You would need to make a number of small changes with replication in mind, mostly to push data and materials to an more dynamically created model. I've attached a link to a pair of images that show my quick dynamic creation, along with a server/client player both with their own personal working camera masks. imgur.com/a/JqJoJSa
      The basic concept though is you need to move the post process from the world post process volume, and instead attach it to the player camera, this allows the masking effect to be personal. this needs to be done dynamically though by creating the following: a dynamic material instance of the post process, a dynamic personal canvas render target (which we save to the LoS Render Target Variable used), and replacing the parameter collection (I was using this due to a larger system in mind that I'm working with) with a vector parameter that we update with player position instead. Hopefully this explanation can get you started!

    • @t3qqwtqw840
      @t3qqwtqw840 4 года назад +1

      @@Okaricraft Thank you so much!

    • @t3qqwtqw840
      @t3qqwtqw840 4 года назад +3

      @@Okaricraft On another comment you mentioned using a portion of the post process nodes as an opacity map to hide the actor, using this method in a multiplayer scenario seems to just make the character black, I was able to get the post process working fine in multiplayer but this seems to be my next hurdle. Thank you for the help you've given me so far!

    • @Okaricraft
      @Okaricraft  4 года назад +2

      I love that people are finding this tutorial interesting and useful, and that there are those who are trying to push it further! Unfortunately for this particular question: having a multiplayer game (replication) in which objects change their local material opacity based on the local version of the players texture is not something I'm confident about how to tackle right now.
      There are a number of issues to overcome here. The first is that the materials themselves reference a texture. In the tutorial the post process references a static render target that we directly update via the player. In the single player context this makes it trivial to just have any material we want to control the opacity of simply reference that render target. however once we include the dynamic render targets needed so that a multiplayer system grants individual players their own vision cones, we introduce two challenges; how to hardcode this reference to a as of yet created render target in a material, and how to coordinate that the proper local material version of a, assumedly, replicated actor is used.
      Since a standard material or material expression to control opacity cannot be pointed towards a static render target texture, every object will likely need to be at least an actor, and likely have their materials for static meshes created as a dynamic material instance. Then the issue of referencing the local render target texture stored in the player pawn needs to be dealt with. I do not believe you can simply point your dynamic material towards another blueprints data, so you would likely need to make a local copy, and then update that every tick, which would eventually slow things down.
      You could try having a couple static render targets available for a given max number of players, and then assign them each a particular one to use, though you will still need to create a dynamic material for each object that you want to have its opacity controlled. note that for this approach you cannot use the player controller ID directly, every local player uses player ID 0, so you would need to have another variable you create track who is assigned where.
      A simpler implementation of this kind of mechanic would be to create a dynamic mesh based on the vision cone vertices that is used as a collision mesh, that way when an object begins its overlap with the mesh you know it should be set to visible, and when its no longer overlapping it should be set to hidden. this would turn the whole object/actor on and off rather than allowing for partial masking, but depending on the objective of the mechanic this may be a simpler viable solution.

    • @t3qqwtqw840
      @t3qqwtqw840 4 года назад +2

      @@Okaricraft Thank you again for helping me in the right direction and for the thorough explanations, you've been super helpful.

  • @joudatkhan
    @joudatkhan 2 года назад

    How can you make the vision Cone angle and the vision circle diameter shrink as the player loses health and also when the player jumps? would really appreciate an explanation, Great tutorial btw!

    • @Okaricraft
      @Okaricraft  2 года назад

      So the diameter is just controlled by a distance value we set for how long the ray casts should go, since the cone gets redrawn every tick you would just need to tie it to some health value to shrink it for that. jumping is a little more dependent on how you want to implement it, but a timeline would be one way.

  • @xEvilGod
    @xEvilGod 3 года назад

    been searching for something similar almost a year now, having 0 knowledge in materials been a pain in the **.
    1 thing i wanna know, is there a way to increase the view cone, perhaps a circle around instead of a cone,
    thank you so much, i have gained a lot watching!.

    • @xEvilGod
      @xEvilGod 3 года назад +1

      never mind! go it figured, + made it multiplayer supported!

  • @CupCakeUnleashed
    @CupCakeUnleashed 2 года назад

    Hey, my scenetexture isn't working, gives the lerp an error, even with the R,G mask

    • @Okaricraft
      @Okaricraft  2 года назад +1

      Hmm... doublecheck your mask and the video, should be R,G,B, not just R,G. the Lerp wants your B pin to match the Vector3 from the A pin.

  • @programthis3805
    @programthis3805 Год назад

    does this work on mobile?

  • @officialjessecarr
    @officialjessecarr 3 года назад

    This is great! Three things, how would I edit the opacity of the post process material to make it somewhat see through so you can kind of see the environment around it? Second this is for a 3rd person esc game and I want the player to be able to see through windows (that are within the cone range), at the moment the window glass is just black, how would I make it so the cone extends into the house a bit so you can see through the window and see whats inside (in view)?

    • @garygnunewzoorevue5748
      @garygnunewzoorevue5748 2 года назад +2

      Multiply scene texture post process node by your colour which is currently input for A of Lerp.

  • @FunwithBlender
    @FunwithBlender 2 года назад

    How do I make the fog of war initially pitch black and then once explored the fog of war is faded ?

    • @Okaricraft
      @Okaricraft  2 года назад +1

      Unfortunately this particular setup doesn't lend itself well to a simple conversion to have a world-wide fog of war. The reason being, this tutorial locks the center of the render target to the player, so you could picture the world panning around under the player and the texture. For a Fog-of-War you need the same components, but you want the texture sized and locked to the level itself, and then as the player moves/pans around instead such that they would draw to specific spots on the render target, rather than from the center.
      One big concern would be the size of the worlds render target as it would potentially be huge. If I were to sit down and make a fog-of-war, I would probably first try the approach of a smaller plane with a masked material that gets tiled out over the level, and determines opacity based on its position relative to given point, think center of a sphere mask. there's a couple ways to generate this point, through a blueprint or through a render target, but this would be a direction that would be more manageable I think development wise for fog of war effects.

    • @FunwithBlender
      @FunwithBlender 2 года назад

      @@Okaricraft subscribed to your channel i literally tried all the LoS tuts for unreal this is the best one hands down

  • @gablagabla8751
    @gablagabla8751 2 года назад

    Hi is there a way to make the vision cone became a bit longer?

    • @Okaricraft
      @Okaricraft  2 года назад

      Short answer, yes. long answer, check out the comment thread of Dillon Tidwell, I went through and helped indicate what spots need to be changed to increase the length of the vision cone.

  • @llamaking0868
    @llamaking0868 2 года назад

    Got a question for you, Is there a way to do this, or something simular to how League of Legends works. By that I mean, you can still see terrain and such out side the radius or view, but mobs and players are not until they are inside the area?

    • @Okaricraft
      @Okaricraft  2 года назад

      Hmm, it might not be the most efficient way but you could make characters/mobs out of translucent materials and use the Scene Color node to sample the background and use the same positional logics in the main PP material to check if the mob is in or out of the visible area. another route would be to create a dynamic mesh out of the generated line traces and use it as a collision mesh to turn the visibility of mobs/enemies on or off depending on if they are inside it or not.

    • @llamaking0868
      @llamaking0868 2 года назад

      @@Okaricraft I don't know that im all that knoledged to be able to draw that, idk if you have any examples of how that'd work of if there was a way to show me

  • @gregclarke5225
    @gregclarke5225 3 года назад

    Hey, great tutorial!
    Just wondering how I go about increasing the view distance and decreasing the circle around the player?
    Increasing the view distance much more than it is already throws up a warning about potential crashes and the circle around the player, no matter how low I make the number, only goes down to a certain size!
    Thanks

    • @gregclarke5225
      @gregclarke5225 3 года назад

      Poked around a load more and worked it out!
      I spent all of yesterday trying to work out the problem and solved it today in 10 minutes!

    • @Okaricraft
      @Okaricraft  3 года назад +1

      Glad to hear it worked out! I was going to recommend that you can control the circle around the player by controlling the SphereMask Distance value in the post process, and to increase the view distance you need to adjust the length of the line traces (should be controlled via the vector multiply node after the RotateVector node for the LineTraceByChannel).

  • @FunwithBlender
    @FunwithBlender 2 года назад

    IS there a way to make the transition from what you can see to black less harsh/hard, more smooth/blended?

    • @Okaricraft
      @Okaricraft  2 года назад

      Another commenter asked this, and will have a more detailed explanation, but a simple way would be to blur the post process texture mask in the material before it goes into the LER. a more complex way would be to make a somewhat more complex line trace mesh, as the vertex color matters when using it to draw to the render target, so you can use that to produce a gradient in the render target texture directly.

    • @FunwithBlender
      @FunwithBlender 2 года назад

      @@Okaricraft cool i will try and give it a go thanks for getting back to me. This solution does it also work for multiplier, would i have to assign a tage or something for each duplicate LOS ?

    • @Okaricraft
      @Okaricraft  2 года назад

      @@FunwithBlender You would need to convert this so that each player created a custom dynamic render target that they would draw to, instead of a static one like the tutorial uses. I outlined in one of the earliest comments a fairly detailed method to this, as it requires a bit of reworking the tutorial.

  • @Ja2so4
    @Ja2so4 3 года назад

    Phenomenal video! Thank you for your effort to create it. I have a question: how should i go with adding gradient on edges of the generated shape so i could have some nice drop-off instead of hard line on the edges. Thank you!

    • @Okaricraft
      @Okaricraft  3 года назад +1

      Great question. there are different ways you could accomplish this, the most performant would to probably be to make the final drawn series of triangles a bit more complex so that you can adjust the color/opacity(alpha) such that it draws the the render target with a gradient. another way would be in the post process to sample neighboring pixels (similar to how you create edge highlights) to soften the information from the render target in the post process.

    • @jeremiebonneau4991
      @jeremiebonneau4991 2 года назад +1

      Is there a way you could show us all these different methods on how to achieve the edges smoothness @Okari?
      I've been head banging my way to achieve this for our game with no luck. I can't seam to find where the sample neighboring pixels setting is in the post process and would love to have more guidance from yeah if you have any :). Still great video ! Thanks for making it !! :D

  • @shenjianb
    @shenjianb 3 года назад

    god!! thank u!!

  • @jacani1152
    @jacani1152 3 года назад

    *A M O G U S*

  • @ArthurGraveto
    @ArthurGraveto Год назад

    Excelent

  • @sajadb_dev
    @sajadb_dev 3 года назад

    Great tutorial, i followed along with the video and did the exact same things but couldn't get it to work, i narrowed down the problem and i think it's because the canvas triangle values are way off and also black triangles get rendered in the render target texture despite the fact that i set it to render white. do you have any suggestion on how to fix that?

    • @Okaricraft
      @Okaricraft  3 года назад

      Potentially check the Alpha value your using for the triangle vertices. The alpha needs to be 1. if you open up the render target you can check the channels individually.

    • @sajadb_dev
      @sajadb_dev 3 года назад +1

      @@Okaricraft thanks for your fast reply, the problem was me accidentally putting the render target texture as the render texture of draw triangle node and one other thing, can this work for a side scroller game or only a top down game?

    • @Okaricraft
      @Okaricraft  3 года назад

      @@sajadb_dev absolutely. No reason it can't work for a side scroller. You would have the same concept of casting out line traces to scan "forward" and create a mask from it.

  • @FunwithBlender
    @FunwithBlender 2 года назад

    amazing tut

  • @itsdimko
    @itsdimko 3 года назад

    Thanks! I have a question, how would i go about making the mask slightly transparent so that the player can still see the map and where he is going, but its quite dark.. you mentioned playing around with A and B inputs for the lerp at material startup but i dont seem to get it right.. i would appreciate if you could help me out a bit!

    • @itsdimko
      @itsdimko 3 года назад +1

      Okay i figured it out all i did was multiply the Masked sceneTexture with the colour parameter itselft and plug that into the A input, now the thing i dont know how to do is setting it up to work for all players in the game. I saw you posted some new code but im pretty new and cannot really wrap my head around it and what it does, what is Personal PP and what does it do. Could someone help me out or point to a tutorial for this please? thanks!

    • @Okaricraft
      @Okaricraft  3 года назад

      @@itsdimko Yep. the final lerp is basically a mask that you can apply whatever to.

    • @itsdimko
      @itsdimko 3 года назад

      @@Okaricraft Thanks! could you point me somewhere to set it up with replication im really clueless here.

    • @Okaricraft
      @Okaricraft  3 года назад +1

      for this project specifically someone (much) earlier asked about that and I gave a, hopefully detailed enough, response as to how to go about changing things up. as far as replication in general I definitely recommend a couple of the epic live training tutorials. ruclips.net/video/hlDWovBcu7E/видео.html is a fantastic place to start as they do have to debug some stuff not working once and awhile and its important to see that process.

    • @itsdimko
      @itsdimko 3 года назад

      @@Okaricraft Thank you very much sir!

  • @blackivy011
    @blackivy011 2 года назад

    Thanks so much for this tutorial! I would LOVE if you could answer this one question though.....
    I need to make the field of view distance farther and don't worry, I know you answered this down below. However, after increasing the float in the multiplication by vector from 700 to 1200 or any other higher number, the distance doesn't change... It works when I make it below 700 though. I can make it shorter but not further. I believe it's because the canvas that the post process is drawing on is a fixed size and 700 or maybe 900 is the max because 1800/2=900? I tried increasing the size of the x and y of the LoSVisionTarget to 3200 but that didn't work either. PLEASE help if you can lol. Thanks so much for your time Sir.

    • @Okaricraft
      @Okaricraft  2 года назад +1

      Thinking back it should only take increasing the length of the line trace. if the line trace gets too long you'll end up with one of two situations: either the vision cone should extend off camera, or you will see it hit the boundary of the the render target its drawing to. if your increasing the size of the render target, make sure you update the texture size in the post process material (the one that's being set up initially at 4:40), as this sizes it relative to the world.

    • @blackivy011
      @blackivy011 2 года назад

      @@Okaricraft thank you so much for this! I’ll try that tonight for sure!

    • @blackivy011
      @blackivy011 2 года назад

      @@Okaricraft So I tried scaling up the LineTraceByChannel by increasing the float in the multiply node again after increasing the size of the render target to 3600x3600 and even 4500x4500 but the view distance of the cone itself always stays the same... I matched the 3 Parameters in the LoSVisionPostProcess with the render target like you said as well but no dice. I even tried changing the Make Vector node to half the x and y values of the render target in the PrepareTrianglesForCanvas function but still, the cone stayed the same size. Any ideas? I'm sure I'm just an idiot and don't understand how this works but I reaaaally want it to work... I just want the view distance to be further lol. I'm willing to even show you on discord if you want lol. I appreciate your time Sir really.

    • @Okaricraft
      @Okaricraft  2 года назад +1

      @@blackivy011 No worries, I had to load up the old tutorial file and look around a bit to find the issue myself, its not obvious. the IF node in the material graph for the post process is using a static value 750 for the B pin to prevent tiling issues. you'll need to increase this value to extend the max distance the cone can extend to. just increasing that value and the length of the line trace alone will be enough to see the issue with the render target getting drawn out to its full edge, so its at that point you'll want to increase its size and a couple other values here and there (TextureSizeValues, OffsetXY in the PostProcess Material, and the Make Vector in the Prepare Triangles function in the TwinStickPawn BP) to their appropriate equivalent values; either the size of the new render target or the offset needed to get to the center of it.

    • @blackivy011
      @blackivy011 2 года назад

      @@Okaricraft WOW THAT FIXED IT!! Thank you so much for your help! It's working awesome now and you're an awesome teacher man.
      The only thing now is that I wanted to make the rendered post process material more transparent so you can see through it a little bit. I couldn't figure that out right away but I'm sure I'm just a material tutorial away from figuring it out. I appreciate you bro! I subscribed obviously lol.

  • @DutchdaveTanktastic
    @DutchdaveTanktastic 4 года назад

    Thank you so much!

  • @binodsarkarIN
    @binodsarkarIN 3 года назад

    is it possible to show this but only on the minimap ?

    • @Okaricraft
      @Okaricraft  3 года назад +2

      Yes, assuming you had a minimap set up, it would be fairly straightforward to do. the Render Target is just a mask so you can use that however you'd like.

    • @binodsarkarIN
      @binodsarkarIN 3 года назад

      @@Okaricraft great. Thanks

  • @Whitewatt
    @Whitewatt 4 года назад

    Tutorial is awesome. Just curious, how could I go about adding a blur to it as well lower it's opacity?

    • @Okaricraft
      @Okaricraft  4 года назад +1

      If you mean just blurring the view or the 'unseen' masked area, you would go about adding that by modifying the A and B inputs of the lerp in the material setup at 2:50. everything else is basically setting up just to create a mask for that lerp. If your talking about making the actual mask edges blur and fade thats a little more complicated, but could be approached either by setting up a convolution filter to sample more shifts around the center pixel that the world aligned texture is looking at, or utilizing the Vertex UV pos pins when writing the UVTri array elements, and having it sample off a prepared conic texture that had the desired falloff. The convolution setup would be more straightforward, but a bit more performance intensive, the UVTri changes would be more complex to set up, but be more performant.

    • @Okaricraft
      @Okaricraft  4 года назад

      There is potentially a third way that I can think of off the top of my head, but it would be a bit math heavy to create. but basically you would use the RGB color value that the render target is being created in to store the calculated opacity. Based on a curve, you would set the Vertex Color in the UVTri, but since the current triangles are only 3 points, you would see a linear falloff. there are some hacky ways I can think of to get around this, but I'm not sold on it.

  • @WhatIsMyPorpoise
    @WhatIsMyPorpoise 7 месяцев назад

    holy cow ok yeah this could be massive helpful for my teams project idea