Home Unreal Engine

Material - Dynamic Shield anyone (Turtles Included)?

polycounter lvl 12
Offline / Send Message
Ace-Angel polycounter lvl 12
Hey to all,

I have been racking my magnificent manly brain for the past few days, trying to create a dynamic shader which has a small 'hotzone' when interacted with something, but no matter what I do, non of it applies into something workable.

Here is the first example of what I mean of sorts:
http://www.youtube.com/watch?v=Y6k1uk6jl64

And now, here is EXACTLY what I'm talking about - KILLER TURTLES FROM SPACE:
[ame]http://www.youtube.com/watch?v=MMFfVfzthP0&feature=related[/ame]
http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=38544&postdays=0&postorder=asc&start=30

The only idea I had as my last resort was opening up UDK, and taking a peek at the HUD-Damage Material and how it worked, hoping to apply it to a 3RD person invisible mesh and have it interact as the buffer for the final mesh.

However, the material is pretty simple, doesn't have a Custom HLSL, and is just a bunch of Alphas and Rotations nodes stacked under a simple scheme, which didn't help me in understanding how damage in relation to position works since I can't find the offset base that indicates or tells me from which direction the damage is coming in the first place (they might be using Cascade? Wouldn't make sense for resource management however).

Anyone has tips in that regard?

EDIT: Anyone knows where the 'Shield' effect for the vehicles in the games are? I would like analyze how the structure is setup.

Other Links:
http://forums.epicgames.com/showthread.php?t=794150
http://forums.epicgames.com/showthread.php?t=794750

Replies

  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Best guess would be to make a holographic material (tonnes of stuff on here and on the webz) and then through kismet, figure out the x,y,z of where the player got shot (There is a projectile landed event and seems to give reference to the projectile) feed that into a mesh and play a matinee sequence.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Best guess would be to make a holographic material (tonnes of stuff on here and on the webz) and then through kismet, figure out the x,y,z of where the player got shot (There is a projectile landed event and seems to give reference to the projectile) feed that into a mesh and play a matinee sequence.

    Nice, thank you for the information, this should come in handy!
    Hboybowen wrote: »
    did you try to contact the creator of that material. If not try the UDk forums. Alot of UDK guys over there too. I see you made a thread over there but didnt add these videos and pics add this stuff to your thread if suggestions here dont help you.

    Thanks for the tip, but the author for some reason is MIA, even the author for the second video is MIA. I guess they don't bother with dirty peasants like me after they achieve the status of Elite (aka, Developers who don't sleep).

    Other then that, still hoping for the best, going to test Haid's idea.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    If your using a sphere for collisions and can get the hit position of the projectile, you may be able to spawn a textured sphere at the same coords as the collision shape and make it 'look at' the hit point. providing the textured effect is mapped to the correct part of the mesh it will look like what you want. Overlaps could be problematic though.

    (I dont really know Kismet, but if you can spawn meshes and get the hit point it should be possible.)
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    I'll try and get something maybe working this week or by tommorow. Check out the kismet reference, saw a bunch of nodes that would help/lead somewhere.

    http://udn.epicgames.com/Three/KismetReference.html
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    This isn't going to be just a material solution. Its a combination of material and the hit detection portion of the game.

    Using UDK as a base look in the "takeDamage" function of the actor class. Included in that is a vector for hit location.
    So for your player class using this material you're creating you can have a hook in the takeDamage portion that specifies something like
    //outside takedamage
    var ShieldMat; //pointer to the shield material.. could be the base skin, or a secondary material for the bubble shield type.
    
    
    ShieldMat.SetVectorParameterValue("hitdirection", HitLocation);
    

    You'll also some sort of timeout value like the damage amount or some other basic value for how long the effect stays on.

    In the shader you can transform the incoming world vector from hit location to a tangent or UV vector with the Transform node. You can use the x and y position as the incoming coordinates for a texture coordinate node linked to an alpha for your shield hit effect, or even an entire sub-set of the material that defines shield behaviour. The caveat with that texture is it will need to have a small area in the center of the map that is active while the rest is black. This way when it is offset by the hit behaviour it won't look strange when the texture tiles.

    You can then alter the value of that texture by say subtracting the value of a sine node with a time input clamped between 0 and 1.

    A simpler method would be to create a shield hit effect in cascade, that looks like the bubble shield hotspot you want, then hook in the spawn code using the previously mentioned hitvector from the takedamage routine.
    I did something somewhat similar for projectile reflection in this mod:
    video here
    TURN OFF SOUND.. really bad capture

    [ame]http://www.youtube.com/watch?v=2i0qhG8Pux0[/ame]

    You can see the rocket bouncebacks leave a little pulse ring. Its a super simple cascade effect

    heres the code behind that bit
    simulated function playHitEffects(vector HitLocation, vector HitNormal)//snagged from projectile.uc  simpleImplementation
    {
    
    	local ParticleSystemComponent PSC;
            if (WorldInfo.NetMode != NM_DedicatedServer)
    	{
             if (bReflect) //if the projectile reflects, then spawn a reflect effect, else spawn the hit effect for the incoming projectile.
             {
             PSC = WorldInfo.MyEmitterPool.SpawnEmitter(ReflectTemplate, HitLocation, rotator(HitNormal), none);
                 if(ReflectSound != none)
                 {
                 WeaponPlaySound(ReflectSound);
                 }
             }
             else
             {
             PSC = WorldInfo.MyEmitterPool.SpawnEmitter(HitTemplate, HitLocation, rotator(HitNormal), none);
             }
            }
    
           //toDo add sound here
    
    }
    

    The fun part is that last bit of SpawnEmitter where I have "none" you can put a variable pointing to the actor that took the damage, so the shield hit travels with them.

    Hope thats all followable and makes sense.
    The particle method I KNOW will work, while the material method I THINK will work.. ::)

    Edit: BTW the "shield" effects on the vehicles are a simple overlay when they're being hit with the specific damagetype of the altfire linkgun.

    code is in UTVehicle.UC at around line 3540.
    The material area in question is in M_VH_ALL_Axon_Base. Look in the Emissive section for Veh_OverlayColor.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Further addition on more reading: Looks like decals can project on skeletal meshes. So you may want to look into decal creation via Material Instance Time Varying.

    Still going to need some script hooks for the full effect though.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    r_fletch_r wrote: »
    If your using a sphere for collisions and can get the hit position of the projectile, you may be able to spawn a textured sphere at the same coords as the collision shape and make it 'look at' the hit point. providing the textured effect is mapped to the correct part of the mesh it will look like what you want. Overlaps could be problematic though.

    (I dont really know Kismet, but if you can spawn meshes and get the hit point it should be possible.)

    Actually, that could be problematic, but that also could be useful for other ideas I have, thanks mate!
    I'll try and get something maybe working this week or by tommorow. Check out the kismet reference, saw a bunch of nodes that would help/lead somewhere.

    http://udn.epicgames.com/Three/KismetReference.html

    Haha, most likely you WILL get it before me, I'm swamped in work and was hoping to learn a quick shader effect or two for gameplay, emphsis on 'Quick' here, but considering on how bad I am in Kismet, I most likely will not getting that anytime soon.

    Thanks for the help though, much appreciated.
    Hboybowen wrote: »
    oh check out the meat cube that epic did along time ago. It had something like that

    I actually did, but couldn't see anything special other then it being softbody and everything about it was 'automatic', any tips on what I should be looking out for?
    Vailias wrote: »
    This isn't going to be just a material solution. Its a combination of material and the hit detection portion of the game.

    Using UDK as a base look in the "takeDamage" function of the actor class. Included in that is a vector for hit location.
    So for your player class using this material you're creating you can have a hook in the takeDamage portion that specifies something like
    //outside takedamage
    var ShieldMat; //pointer to the shield material.. could be the base skin, or a secondary material for the bubble shield type.
    
    
    ShieldMat.SetVectorParameterValue("hitdirection", HitLocation);
    
    You'll also some sort of timeout value like the damage amount or some other basic value for how long the effect stays on.

    In the shader you can transform the incoming world vector from hit location to a tangent or UV vector with the Transform node. You can use the x and y position as the incoming coordinates for a texture coordinate node linked to an alpha for your shield hit effect, or even an entire sub-set of the material that defines shield behaviour. The caveat with that texture is it will need to have a small area in the center of the map that is active while the rest is black. This way when it is offset by the hit behaviour it won't look strange when the texture tiles.

    You can then alter the value of that texture by say subtracting the value of a sine node with a time input clamped between 0 and 1.

    A simpler method would be to create a shield hit effect in cascade, that looks like the bubble shield hotspot you want, then hook in the spawn code using the previously mentioned hitvector from the takedamage routine.
    I did something somewhat similar for projectile reflection in this mod:
    video here
    TURN OFF SOUND.. really bad capture

    http://www.youtube.com/watch?v=2i0qhG8Pux0

    You can see the rocket bouncebacks leave a little pulse ring. Its a super simple cascade effect

    heres the code behind that bit
    simulated function playHitEffects(vector HitLocation, vector HitNormal)//snagged from projectile.uc  simpleImplementation
    {
    
        local ParticleSystemComponent PSC;
            if (WorldInfo.NetMode != NM_DedicatedServer)
        {
             if (bReflect) //if the projectile reflects, then spawn a  reflect effect, else spawn the hit effect for the incoming projectile.
             {
             PSC = WorldInfo.MyEmitterPool.SpawnEmitter(ReflectTemplate, HitLocation, rotator(HitNormal), none);
                 if(ReflectSound != none)
                 {
                 WeaponPlaySound(ReflectSound);
                 }
             }
             else
             {
             PSC = WorldInfo.MyEmitterPool.SpawnEmitter(HitTemplate, HitLocation, rotator(HitNormal), none);
             }
            }
    
           //toDo add sound here
    
    }
    
    The fun part is that last bit of SpawnEmitter where I have "none" you can put a variable pointing to the actor that took the damage, so the shield hit travels with them.

    Hope thats all followable and makes sense.
    The particle method I KNOW will work, while the material method I THINK will work.. ::)

    Edit: BTW the "shield" effects on the vehicles are a simple overlay when they're being hit with the specific damagetype of the altfire linkgun.

    code is in UTVehicle.UC at around line 3540.
    The material area in question is in M_VH_ALL_Axon_Base. Look in the Emissive section for Veh_OverlayColor.

    Further addition on more reading: Looks like decals can project on skeletal meshes. So you may want to look into decal creation via Material Instance Time Varying.

    Still going to need some script hooks for the full effect though.

    Wow, thanks alot for all the input there, mind you, I'm really crap at anything else other then shaders and particles, but this is gold, should help me get started on the right path!

    Abit of a general question, but did they change the names for half of the stuff in the damage and projectile area for the Kismet? I just tried a dry-run and nothing comes up, also, the stuff which I think should be working isn't accepting 'stuff' such as materials any tips about that?
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    um.. yeah Kismet is nice, but its not a substitute for uscript. Its more like a "lite" version for whats most used in level design and machinima.

    If you want to go the particle effect route, which might be the easiest and potentially only way to go without coding something, you can use kismet to spawn a particle of your shield hit type, then use the attach to actor kismet node to attach said spawned particle to the target. Basically machinima it up, but to use dynamic hit detection and response you very well may have to get your hands dirty and learn some Uscript.

    Also the meat cube, if I remember right, is handled by physical material definitions. Also a code linked to art thing.

    You are in the technical realm now. ;) not everything is GUI based here.

    Ihe good news is its not that hard of a language. Its like Java or C#.. actually its rediculously close to C#, so much so that I wondered if MS patterend that language on Uscript.
Sign In or Register to comment.