[beta] kLazer - 3d laser beam

Sprites, textures, sounds, code, and other resources belong here. Share and share-alike!
Forum rules
Before posting your Resource, please make sure you can answer YES to any of the following questions:
  • Is the resource ENTIRELY my own work?
  • If no to the previous one, do I have permission from the original author?
  • If no to the previous one, did I put a reasonable amount of work into the resource myself, such that the changes are noticeably different from the source that I could take credit for them?
If you answered no to all three, maybe you should consider taking your stuff somewhere other than the Resources forum.

Consult the Resource/Request Posting Guidelines for more information.

Please don't put requests here! They have their own forum --> here. Thank you!
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Re: [beta] kLazer - 3d laser beam

Post by Reactor »

Well, apart from making the laser beam a bit more '"funky", I'd also make two types of them. One which is constant as long as the player keeps the "attack" key pressed, akin to the "Plasma Blast" in Quake 2 Ground Zero, and another, which behaves more like a shotgun (or a railgun) and activates the beam only for a flash, similar how Railgun works.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: [beta] kLazer - 3d laser beam

Post by Nash »

Very nice and very clever.

In case anyone is wondering about the jerkiness and stutter while the laser is continuously fired and you turn your player's angle:

This cannot be fixed. I ran into a similar problem a long time ago when I was trying to get a 3D model (first person legs for the player) to sync perfectly with the player's turn angle, and after some investigation and some help from Major Cooke, we have deduced that it's an engine limitation. Technically, what's going on is your view is interpolated (and predicted while in multiplayer), while the game is internally ticking at only 35 Hz. This creates a disconnection between the actor actually turning its angle VS your player/view camera turning. Technically, the actor is turning as fast as it could already - but the camera gets updated more often than the actor's angle.

This problem is even evident in a completely different game with a completely different game engine - I was playing EDuke32 and Duke Megaton Edition, turned on third person camera, then wildly swiped the mouse to turn the player - you can actually see Duke's sprite actually not switching between the different rotations as fast as the camera itself!

Sorry for the sidetrack. We now return you to your regular scheduled awesome lasers. :D
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: [beta] kLazer - 3d laser beam

Post by kodi »

Reactor wrote:Well, apart from making the laser beam a bit more '"funky", I'd also make two types of them. One which is constant as long as the player keeps the "attack" key pressed, akin to the "Plasma Blast" in Quake 2 Ground Zero, and another, which behaves more like a shotgun (or a railgun) and activates the beam only for a flash, similar how Railgun works.
"Funky" beams are possible, but they'll look odd because the whole model is stretched by distances. So for example a lightning bolt model would look like a stupid mess if you fired at something very close and like wiggly spaghetti if at something very far away. A shotgun type attack (or perhaps better support for angle arguments in general) is a good idea though, and I've added it to the to-do list. A bouncing laser could be pretty amusing as well.
nash wrote:[...]This cannot be fixed. I ran into a similar problem a long time ago when I was trying to get a 3D model (first person legs for the player) to sync perfectly with the player's turn angle[...]
I actually got the idea for how to do the downward-pointing-model-pitched-90-degrees trick due to doing just that. I was trying to make a 3d model gun that warps with the player while also applying angle and pitch adjustment to make it track an ACS mouse cursor (crosshair) goldeneye-style. The only way to tilt the model from side to side when the player was looking upwards was to offset the pitch 90 degrees in modeldef, which meant that it's actor was in fact pointing straight forward when the model was pointing up - allowing me to tilt it by changing it's Roll, which normally does the same thing visually as changing the angle for an upward-pointing 3d model actor. Would have eventually got the math right, but the interpolation issues you mentioned made me realize it was all futile anyway. I hoped there was just something I was missing, but it's clear to me now that it's just how things are.

Anyway, one thing that might make both dynamically angled 3d guns and perfectly smooth laser beam weapons possible would be if it ever becomes possible to scale, move and rotate 3d models used as weapons in view space. I think Q3A does that by default for the lightning gun actually.
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Re: [beta] kLazer - 3d laser beam

Post by Reactor »

For the shotgun-mechanism laser, I've seen the idea in Raptor: Call of the Shadows. The Deathray and Twin-Laser weapons do this kind of thing, and it looks very cool, plus the animation is also easy to make (basically you just make the beam larger-narrower and use more/less transparency). If you take a look on Youtube videos, you'll see what I mean. Yep, it behaves akin to a Railgun, however it reloads MUCH quicker, and it does not sneer thru targets. The firepower is more or less the same.
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: [beta] kLazer - 3d laser beam

Post by AFADoomer »

Nash wrote:Very nice and very clever.

In case anyone is wondering about the jerkiness and stutter while the laser is continuously fired and you turn your player's angle:

This cannot be fixed. I ran into a similar problem a long time ago when I was trying to get a 3D model (first person legs for the player) to sync perfectly with the player's turn angle, and after some investigation and some help from Major Cooke, we have deduced that it's an engine limitation. Technically, what's going on is your view is interpolated (and predicted while in multiplayer), while the game is internally ticking at only 35 Hz. This creates a disconnection between the actor actually turning its angle VS your player/view camera turning. Technically, the actor is turning as fast as it could already - but the camera gets updated more often than the actor's angle.

This problem is even evident in a completely different game with a completely different game engine - I was playing EDuke32 and Duke Megaton Edition, turned on third person camera, then wildly swiped the mouse to turn the player - you can actually see Duke's sprite actually not switching between the different rotations as fast as the camera itself!

Sorry for the sidetrack. We now return you to your regular scheduled awesome lasers. :D
Technically, if you play with cl_capfps set to true, the stutter goes away... So it *can* be fixed... Sort of. In an undesirable way. The player model in my Star Trek mod looks awful on chasecam at uncapped FPS because of this same issue.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: [beta] kLazer - 3d laser beam

Post by Nash »

AFADoomer: True, but no sane user would play modern ZDoom mods on modern systems capped at 35 frames per second... =P
User avatar
Ozymandias81
Posts: 2063
Joined: Thu Jul 04, 2013 8:01 am
Graphics Processor: nVidia with Vulkan support
Location: Mount Olympus, Mars
Contact:

Re: [beta] kLazer - 3d laser beam

Post by Ozymandias81 »

@kodi and lulz here
I am re-working a bit this awezoeam lazerbeam in order to turn it as a switchable decoration... what do you think so far of thiz ding? :lol:
Any suggestions to how to improve it? Also how can I control the x/y/z hitscan? I mean I want it to cover only the space occupied by the beam.
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: [beta] kLazer - 3d laser beam

Post by kodi »

Nice work! I'm not sure it's all that important to be able to set the range, unless you want beams that stop in mid-air. Having an argument for setting the width [A_SetScale(1,(GetDistance(1,AAPTR_MASTER)/33.25),AAPTR_TRACER) ] of the beam sems like a higher priority. If you want lasers that stop mid air I'm not sure if it's possible to make a bullet puff appear in mid air, but it might just work if you make A crash and melee state that do nothing except Goto Spawn (probably a good thing to do anyway).

For the color it might be possible to use translations instead of actual different textures. Unless I'm missing something you could have a grayscale texture for the laser and just translate it to whatever color you wish. Maybe even a rainbow beam lol.

One thing I don't quite get myself is why the spinning emitter in the demo seems to autoaim at the player a little bit on the Z axis.
User avatar
Ozymandias81
Posts: 2063
Joined: Thu Jul 04, 2013 8:01 am
Graphics Processor: nVidia with Vulkan support
Location: Mount Olympus, Mars
Contact:

Re: [beta] kLazer - 3d laser beam

Post by Ozymandias81 »

kodi wrote:Nice work! I'm not sure it's all that important to be able to set the range, unless you want beams that stop in mid-air.
I need it just to take in consideration several behaviors such as non-solid sectors or anything related to models/actors without an hitbox system.
kodi wrote:Having an argument for setting the width [A_SetScale(1,(GetDistance(1,AAPTR_MASTER)/33.25),AAPTR_TRACER) ] of the beam sems like a higher priority. If you want lasers that stop mid air I'm not sure if it's possible to make a bullet puff appear in mid air, but it might just work if you make A crash and melee state that do nothing except Goto Spawn (probably a good thing to do anyway).
This is something I need to play with surely, thanks for the hint.:cool:
kodi wrote:For the color it might be possible to use translations instead of actual different textures. Unless I'm missing something you could have a grayscale texture for the laser and just translate it to whatever color you wish. Maybe even a rainbow beam lol.
Not sure of this because this way I don't need colored brightmaps though (yes I use colored ones usually), also because the skin couldn't be so shaped in colors when translated... I guess. Ahaha rainbow beam, please no bronies :tongue:!
kodi wrote:One thing I don't quite get myself is why the spinning emitter in the demo seems to autoaim at the player a little bit on the Z axis.
That's the thing I need to fix because I need that it acts the way it's meant to hit like a "real laser from movies" lol
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: [beta] kLazer - 3d laser beam

Post by kodi »

I'll test if the puff can be produced by an invisible railgun shot instead of A_CustomBulletAttack. I wonder if it's a limitation or a bug that causes this anyway.
User avatar
Ozymandias81
Posts: 2063
Joined: Thu Jul 04, 2013 8:01 am
Graphics Processor: nVidia with Vulkan support
Location: Mount Olympus, Mars
Contact:

Re: [beta] kLazer - 3d laser beam

Post by Ozymandias81 »

kodi wrote:I'll test if the puff can be produced by an invisible railgun shot instead of A_CustomBulletAttack. I wonder if it's a limitation or a bug that causes this anyway.
Sounds legit to me.I had also this in mind before, so I'll give it a try to now that you say this to me. Could be it a limitation? Not sure if it's a bug anyway.
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Re: [beta] kLazer - 3d laser beam

Post by Reactor »

Whew!!! So far so good!
Tell me, kodi; can you make a version of these kLazor beams which would work like the ones in Quake 2? You know...those barriers which I could use to make the course harder (or easier, if enemies walk into them & get fried to delicate brown). There were constant, flickering (sequential and random), and even diagonal ones, albeit only at one occassion (Grid Control level). It would be truly awesome if these kLazor beams could also be used as hazards for levels (or even decorations - they look gorgeous!)
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: [beta] kLazer - 3d laser beam

Post by AFADoomer »

kodi wrote:I'll test if the puff can be produced by an invisible railgun shot instead of A_CustomBulletAttack. I wonder if it's a limitation or a bug that causes this anyway.
I ran into this problem while making the moving spotlights in BOA. The rail attack still occasionally will jump to autoaim at the player, but nowhere near as often as the bullet attack does.

In this case, using the rail attack has the added benefit of being able to spawn actors along the path of the trail, so can give the beam some additional effects if desired...
User avatar
Ozymandias81
Posts: 2063
Joined: Thu Jul 04, 2013 8:01 am
Graphics Processor: nVidia with Vulkan support
Location: Mount Olympus, Mars
Contact:

Re: [beta] kLazer - 3d laser beam

Post by Ozymandias81 »

Very small spoiler... I've managed to add spark flares & decals in conjuntion with Tormentor's white particles and smoke...
Screenshot_Doom_20160408_032450.jpg
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: [beta] kLazer - 3d laser beam

Post by AFADoomer »

An additional small tweak that might be useful:

Code: Select all

				A_SetScale(FRandom(0.95, 1.05), GetDistance(1, AAPTR_MASTER) / 33.25, AAPTR_TRACER);
This makes the beam scale to varying 'diameters', and gives it a kind of shimmering effect instead of being a fully static.
Post Reply

Return to “Resources”