I don't need to test my programs. I have an error-correcting modem.
Legacy:Jarronis, The Vampiric Unicorn
About Me
Hobby UScript-Coder, Oldsk00l-UT-Combat-Monster & UT2003-N00b...
Bloom
Well, after playing some game-demos, i wondered if it is possible to implement a Bloom-Effect in UT. I thought on using a scripted texture with drawportal, then filtering the bright parts of the rendered frame.
Unfortunately, i discovered that the Canvas - Class is not capable to render a ScriptedTexture directly, so i had to use DrawActor with a rectangle mesh instead.
My Results are quite good, but still needs some tweaks.
Because of the restrictions of the Drawportal - Routine of a scripted Texture, this Bloom-Effect is best used with Third-Person-View Gametypes(namely Chaos Duel).
See Bloom
Progress
I just figured out that it is much easier get texture names form the level than i thought. If you look in the definition of the trace function, you'll see one interresting thing:
native(277) final function Actor Trace ( out vector HitLocation, out vector HitNormal, vector TraceEnd, optional vector TraceStart, optional bool bTraceActors, optional vector Extent, optional out material Material );
The very last parameter allows to store the material from the actor, hit by the trace. This is pretty cool for the Chameleon-Mod. I've experimented with it, and it works great.
This, of course, is not all, because this has to be a kind of client-side effect to determine what wall we should trace. I think i could hack this into an interaction.
So here is a Screenshot, showing an similiar effect like the one that is planned. In fact it is actually the chameleon effect, but still picking the texture from the ground.
<img/ src="http://home.arcor.de/jarronis/ch1.jpg">
He's to shy to show his face because this isn't camouflaged :P
Technically spoken: I still replaced only the first entry in the Skins-Array.
Here is the code of the Mini-Mutator (seen in Action in the screenshot).
//================================================== // ChameleonFX <-J-VU // This class changes skin of the assigned pawn, // according to the material of the ground //================================================== class ChameleonFX extends Actor; var pawn AttachedTo; var vector loc, norm, target; var material Tmat; event postbeginplay() { Settimer(0.2,true); } event timer() { if (AttachedTo != None) { AttachedTo.Trace(loc,norm,vect(0,0,-1)*256+attachedTo.location,attachedTo.location,true,,tmat); if (TMat!=None) AttachedTo.Skins[0]=Tmat; } else destroy(); }
This class dynamically changes the pawn's skin. As you see, the trace is still constant, and "scans" the ground for his material. I'm going to code this into an (hopefully) complete client side Interaction-Class, so every player determines the direction for the trace for himself.
//============================================================= // MutCham < J-VU // This mutator is responsible for spawning a ChameleonFX-Actor // for each pawn that logs in. //============================================================= class MutCham extends Mutator; function ModifyPlayer(Pawn Other) { local ChameleonFX cfx; cfx = spawn(class'Chameleon.ChameleonFX',self); cfx.AttachedTo=Other; if ( NextMutator != None ) NextMutator.ModifyPlayer(Other); } defaultproperties { FriendlyName="Chameleon Arena" Description="Chameleon" }
Well, that is the Mutator...
This one was pretty easy, as you see.
After a long time of inactivity, i continued coding on this issue.
So here's the Code of the Interaction-Class Version:
//=========================================================== // ChamInter <- J-VU // This (hopefully) client-sided class is responsible for // detecting the proper texture for the Chameleon effect // from the view of the player. // A lot stuff is taken from the UnrealWiki - Documentations // so do not wonder if there're 'common' things //=========================================================== class ChamInter extends Interaction; var GameReplicationInfo GRI; var Font UsedFont; event Initialized() { log("Chameleon Interaction Initialized"); foreach ViewportOwner.Actor.DynamicActors(class'GameReplicationInfo', GRI) If (GRI != None) Break; } event tick(float DeltaTime) { local Pawn ChP, Selfpawn; local vector loc, norm, target; local material Tmat; if (ViewportOwner.Actor.Pawn == None) return; Selfpawn = ViewportOwner.Actor.Pawn; foreach ViewportOwner.Actor.DynamicActors(class'Pawn', ChP) { ViewportOwner.Actor.Trace(loc, norm, (normal(ChP.location-Selfpawn.location)*8192)+ChP.location,ChP.location,true,,tmat); if (TMat!=None) ChP.Skins[0]=Tmat; if (TMat!=None) ChP.Skins[1]=Tmat; } } simulated function PostRender( canvas Canvas ) { If (UsedFont == None) UsedFont = Font(DynamicLoadObject("UT2003Fonts.FontEurostile12", class'Font')); Canvas.Font = UsedFont; Canvas.FontScaleX = 1; Canvas.FontScaleY = 1; Canvas.SetPos(10,200); Canvas.drawcolor.r=200; Canvas.drawcolor.g=200; Canvas.drawcolor.b=255; Canvas.DrawText("Chameleon Activ");//debugging... } defaultproperties { bActive=true bRequiresTick=true bvisible=true; }
You'll still need a mutator to spawn these interactions. This of course is a very basic version, so it hasn't any gameplay tweaks.
Comments
CH3Z: Wow! I'm excited! This is for UT Classic then?
Jarronis, The Vampiric Unicorn I'm sorry, but this is still for UT2003. I haven't coded for UT Classic for awhile. But if picked up my UT Classic Installation form my HDD, i can go for it :)
Mosquito: I'm interested to know what you're going to do with the code once you finished. It adds a whole new type of gameplay. As I mentioned before, I wanted to do this in my HL mod and my UT2003 mod. I'm a beginning scripter.
CH3Z: I just took a look at UT code and the very param that you mentioned, "optional out material Material" turns out to be the only line that is different in UT>>Actor/native(277) final function Actor Trace. The diff is that it's just not there in the UT engine like it is in UT2003. =( oh well.
Mr.Mitchell: For the old UT you can use a Decal to get a texture. Just spawn one and use the AttachDecal function to attach it to a surface. The attachDecal function returns the texture of the surface it is attached to.
Jarronis, The Vampiric Unicorn Cool! Thanks for this advice.
Ch3z: Looks like your having all kinds of fun Jarronis. =) I wanted to let you know that I added a page to the Wiki that you might find usefull. The Testing Lab might have been nice when you wanted to have someone test the Chameleon Mutator online.
I would love to see new models you make or any work you do. But remember I'm still only running UT. And yes, I still still wear army jackets around town from the surplus stores heheh I'm not dated, I'm just seasoned =P Keep havin' fun with the engine.
Jarronis, The Vampiric Unicorn Oldsk00l-UT, hm? Well... i think there's a whole UT-Weapon-Arsenal haunting around on my HDD. If i dig it out, you probably have something to frag around with, but be prepared: As you might guess i have "slight" tendence to overkill weaponery (more BOOOOM for ya' money). There's even a complete War-Suite, including adaptiv Armor, Invisibility, LifeSens-Wallhack... ehm, okay... so much 'bout my Definition of "Overkill" :eek:
Foxpaw: A bloom effect, eh? What exact is a "bloom effect." I did a search and found some pictures of something called a bloom effect but I'm not confident that what I found is the same thing that you have implemented.
Jarronis, The Vampiric Unicorn: Well, theoretical, bloom means halos around bright reflections. A similar effects is used Tron 2.0 for producing the glows. It also should blur bright surfaces in general. Well, admit, i'm still experimenting, and it is not quite easy to implement effects like this in UT. In the current state, the effect is quite subtil, and the screenshot isn't very good as demonstration. I'll put up some more.
SuperApe: I was intrigued by the Bloom page, which led me here. It looks like the latest generation lighting effects seen in all the XBox360 launch titles. (Call of Duty2, Killzone, etc.) The Bloom download link is broken unfortunately. I came here in an attempt to find out more about what the BloomMesh was, and I see it says above it's a rectangular (plane?) mesh and what does the DreamTex look like? It would be nice to see the latest version as a download. I like the Cameleon-FX too. :) Neat stuff. It appears you have the Replication working, but I may be able to help.
A Lamer: I know this is a miserable and selfish thing to ask, but how hard would it be to make changes for it so it could fit the Unreal 2 runtime architecture. You know, that you can download from the actual site? I wouldn't be inquiring, honestly, but my father has a death-grip on my money and refuses to let me buy things. Hence no UT2003, etc. If it's too hard or complicated, you really don't need to bother, btw. I'd just like to know.