[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!

Re: [beta] kLazer - 3d laser beam

Postby Reactor » Mon Apr 04, 2016 9:51 am

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
Reactor
The militarist
 
Joined: 03 Feb 2011
Location: Island's Beauty, Hungary

Re: [beta] kLazer - 3d laser beam

Postby Nash » Mon Apr 04, 2016 10:37 am

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
Nash
Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: [beta] kLazer - 3d laser beam

Postby kodi » Mon Apr 04, 2016 12:02 pm

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
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: [beta] kLazer - 3d laser beam

Postby Reactor » Mon Apr 04, 2016 12:06 pm

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
Reactor
The militarist
 
Joined: 03 Feb 2011
Location: Island's Beauty, Hungary

Re: [beta] kLazer - 3d laser beam

Postby AFADoomer » Mon Apr 04, 2016 7:38 pm

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
AFADoomer
 
Joined: 15 Jul 2003

Re: [beta] kLazer - 3d laser beam

Postby Nash » Tue Apr 05, 2016 12:50 am

AFADoomer: True, but no sane user would play modern ZDoom mods on modern systems capped at 35 frames per second... =P
User avatar
Nash
Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: [beta] kLazer - 3d laser beam

Postby Ozymandias81 » Tue Apr 05, 2016 5:16 am

@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
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [beta] kLazer - 3d laser beam

Postby kodi » Tue Apr 05, 2016 8:35 am

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
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: [beta] kLazer - 3d laser beam

Postby Ozymandias81 » Tue Apr 05, 2016 10:50 am

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
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [beta] kLazer - 3d laser beam

Postby kodi » Tue Apr 05, 2016 11:08 am

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
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: [beta] kLazer - 3d laser beam

Postby Ozymandias81 » Wed Apr 06, 2016 3:19 am

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
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [beta] kLazer - 3d laser beam

Postby Reactor » Thu Apr 07, 2016 2:50 pm

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
Reactor
The militarist
 
Joined: 03 Feb 2011
Location: Island's Beauty, Hungary

Re: [beta] kLazer - 3d laser beam

Postby AFADoomer » Thu Apr 07, 2016 6:01 pm

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
AFADoomer
 
Joined: 15 Jul 2003

Re: [beta] kLazer - 3d laser beam

Postby Ozymandias81 » Thu Apr 07, 2016 7:25 pm

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
You do not have the required permissions to view the files attached to this post.
User avatar
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [beta] kLazer - 3d laser beam

Postby AFADoomer » Thu Apr 07, 2016 8:08 pm

An additional small tweak that might be useful:
Code: Select allExpand view
            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.
User avatar
AFADoomer
 
Joined: 15 Jul 2003

PreviousNext

Return to Resources

Who is online

Users browsing this forum: No registered users and 3 guests