Home Unreal Engine

Flash Light : Volumic effect

Hey guys,

I am trying to achieve a flash light effect, exactly like the one which is in the Alan Wake game :
383006alanwakepc0001.jpg


Currently, I was trying to achieve this effect with a simple volumetric shader, applied on a cone geometry which is driving with a socket on my character, like this :
894309001.jpg

So i could be happy with this, the only problem is when my effect is passing through an object, it just goes outside of it, and if the character view is not well placed, then we can see it and that's really anoying :

956428002.jpg

So i was thinking about a new system that allow me to have a nice effect without the constrainst like this, but I can't find any other solutions, and I know that I can not calculate a volumetric effect dynamicly because it is just to heavy.
Maybe the UDK is not designed to achieve that kind of things, but if anyone have any idea, you're welcome ! :p

Thanks !

Replies

  • ambershee
    Options
    Offline / Send Message
    ambershee polycounter lvl 17
    UDK is just plain missing the kind of features required to get this kind of thing working. I've personally never managed to come up with a decent solution, although I suspect it may be possible to attempt such a thing using post process.
  • craze
    Options
    Offline / Send Message
    Hi there,

    What do you mean by post process ? because post process effect are only meant to be used as a layer that comes over all effects that are already in the game, or maybe it is possible to use it to hide some things ?
  • KazeoHin
    Options
    Offline / Send Message
    KazeoHin polycounter lvl 8
    You could use kismet to do a line trace from the origin of the light outward, returning the distance to nearest object and adjusting the scale of the mesh accordingly. I'm guessing this could be done more efficiently in code...
  • JamesWild
    Options
    Offline / Send Message
    JamesWild polycounter lvl 8
    Might be able to make it more convincing by having the collision point passed as a parameter to a material so you can do the right kind of falloff rather than what'll be quite obviously a scaled down flashlight mesh.
  • ImSlightlyBored
    Options
    Offline / Send Message
    ImSlightlyBored polycounter lvl 13
    I'll chime in and give a solution too.
    I've had good results with this, by creating a small Render to Texture actor placed at the same position/rotation as the flashlight, and then giving it a process to return the Z-Depth.
    So basically you've got a small texture that now shows rays from the flashlight point outwards.
    You do need to do alot of processing to this in the shader, but that is a fundamental that ultimately, should work and give you some good intersections.

    Cost, is a little high as you're not only doing a costly RTT, but also you'll be left with a slightly more expensive transparent material for your flashlight. So unless it's a hero function, or something your project is fully based around, may I recommend using the standard solution for this and just using Depth Bias Alpha?
  • Minato
    Options
    Offline / Send Message
    Minato polycounter lvl 5
    Am so confused...so you(correct me if i'm wrong) attach a SceneCaptureReflection(?)Actor to the flashlight and then process it?...what does processing mean here?...'^^
  • JamesWild
    Options
    Offline / Send Message
    JamesWild polycounter lvl 8
    He's basically talking about doing a depth buffer shadow manually.
  • Minato
    Options
    Offline / Send Message
    Minato polycounter lvl 5
    James,your responses usually raise more questions for me than answering one,but i very much appreciate them nonetheless,lol...
  • ambershee
    Options
    Offline / Send Message
    ambershee polycounter lvl 17
    Actually, using an RTT sounds like a very viable solution the way he's describing it. It won't be fantastically accurate, but it should occlude moderately well. It shouldn't need to be massively high res.
Sign In or Register to comment.