XNA Creators Club Online
Page 1 of 1 (12 items)
Sort Posts: Previous Next

Simple laser

Last post 10-22-2008 6:11 PM by Byron Nelson. 11 replies.
  • 07-19-2008 11:41 PM

    Simple laser

    How should i go about making a laser?

    i know i need a shader of some sort but how do i calculate everything like how to let laser be any variable distance long with out obvious tiling or how to make the texture allways face towards the screen and how to angle it

  • 07-21-2008 4:26 PM In reply to

    Re: Simple laser

    2-D or 3-D and what program are you using to create this laser?

    In blender there is a section for using python scripting for animations, i would probably create a small section of the laser and use the scripting to "extend" it out by creating duplicates of each drawn section and connecting them end to end.  Alot of it would depend on you drawing of it to be able to connect each section without looking like tiling.  You could probably also use a scale type function, i dont know if there is one, but as an idea try scaling it in the direction that you want it to be extended, but then you face image quality issues.  I think the best way would be to create several sections, a beginning, middle and end and jsut peice them together in either python scripting or in the actual coding of your draw method.

  • 07-21-2008 9:18 PM In reply to

    Re: Simple laser

    oh srry, i want 3D

     

    and ya, that sounds good

     my plan is to make a texture in something like GIMP and draw it in with code

  • 07-21-2008 9:28 PM In reply to

    Re: Simple laser

    Perhaps you could find how to transfer this effect into 3D: http://www.catalinzima.com/?page_id=142. Since he's using vertex buffers and things for rendering, I would imagine you could then make it billboarded so it always faces the camera and it would give you quite a range of effects you could do.
  • 07-21-2008 11:30 PM In reply to

    Re: Simple laser

    I've some lasers/particle weapon effects.  I've some early pictures on my spaces

    http://drjbn.spaces.live.com/

    and some of them show up somewhat in some of my youtube vids www.youtube.com/DrJBN

    If you're interested in either the laserbolts or the raybeam let me know.  They were pretty simple.   I used cylinders or capped cylinders and a shader.  I simply scale them by Z to move between a "ray" and a laserbolt.

    Best,

    Byron

    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
  • 07-22-2008 4:11 AM In reply to

    Re: Simple laser

    Hi Byron

     

    Do you have the kind of laser beam which was fired by The Clone Trooper from Star Wars ? Do you mind sharing the codes with me ?
    It's suppose to be something like this. http://images.wikia.com/starwars/images/5/5e/Phaze_I_Clone_Armor.jpg

     Thank You.

  • 07-22-2008 3:20 PM In reply to

    Re: Simple laser

    I don't have one quite like that, but I could probably help put one together. 

    For full 3d, I'd start with a cylinder for a core, shaded so it had the desired color.  Then, I'd work out a way to add a glow to it without post processing.  I've some ideas, and steve hazen developed a neat technique in this thread http://forums.xna.com/forums/t/13655.aspx?PageIndex=2 .that might work too.

     Drop me an email    drjbn  at hotmail, & we'll see what we can do if you wish

    Best,

    Byron

    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
  • 07-22-2008 4:06 PM In reply to

    Re: Simple laser

    Wow some of that stuff is really cool looking , I think I might try to emulate it in the 2d realm with my game ><

    I still dont understand 3d orthographics projection yet...


  • 07-22-2008 4:24 PM In reply to

    Re: Simple laser

    Hi Byron

    I have dropped you an email. Do take alook.

    Thank you.

  • 10-22-2008 4:44 PM In reply to

    Re: Simple laser

    My live account gets a lot of hits from this particular forum topic.  Since I am guessing they check my space looking for a laser, I thought I'd make the class available to everyone.

    http://cid-87267ddeebe4f390.skydrive.live.com/self.aspx/XNA/Laserbolts.zip

    Its pretty easy & straighforward.  Hope is of use to someone.

    [EDIT if you build & run the demo, the "L" key fires the lasers across the view frustum ]

    Best,

     Byron

     

    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
  • 10-22-2008 5:31 PM In reply to

    Re: Simple laser

    My idea follows the line similar to how I do lightsabers in photoshop.

    You start with a white object, can be a box or cylinder, then in your shader, perform a guasian blur perpendicular to the angle it's pointed toward (would have to play with the blur distance to get it right). To color the laser, you additively blend the color (asuming a black background with just the laser beam/bolt on it), so that only the outside edges of it are colored while the inside looks closer to white. I think the effect could be done entirely with index/vertex buffers and a relatively simple pixel shader.


  • 10-22-2008 6:11 PM In reply to

    Re: Simple laser

    That sounds sorta like what my lasers shader does.  Imagine the cylinder setting out in space with and its UP vector adjusted so that a plane with laser UP as its normal would pass through the camera.  I then blend white with an exponential falloff as the angle between the pixel and that plane increases, so it is white in the middle, fades to color on the edge, then to black (alpha-ed out).  Its all in the shader.

    Best,

    Byron


    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
Page 1 of 1 (12 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG