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

Helmet gleam / shine

Last post 9/26/2009 2:13 PM by Natrion. 7 replies.
  • 9/24/2009 5:53 PM

    Helmet gleam / shine

    Im starting a 3D space game where the main character is an astronaut.
    Now one of the things I plan on making is a shiny space helmet he'll be wearing. I want to create some sort of effect that, from a first person perspective, looks like the person is wearing a piece of round glass or visor in front of his face. Basically what the world would look like wearing a fishbowl over your head, with correct lighting on the glass.

    Now I have no idea how to go about it. Is it a 3D model of glass, with a normal map that reacts to light? Is it a semi transparent texture that is drawn over the game and which is moved and morphed based on light in the area? Will a model with high specular give me what I want? Is it best achieved with a post-process shader which calculates which side of the helmet should have a gleam or light, based on distance to a light? How could I achieve this?

    Thanks for any pointers ;)

    Iv tried loking for pics or video's of games that use it, but I havent really seen one that shows what I mean.

    Regards
    .__.
    (o,0) -- w00t
    (/::\)
  • 9/24/2009 6:19 PM In reply to

    Re: Helmet gleam / shine

    I would try this.

    Make up a semi transparent texture that would be drawn over the entire frame that would represent the glass. Dirty scratches etc. You'd need to draw it on (sprite draw) after all other gameplay items are drawn. Then draw some light sourced highlights (lens flare example will give you pointers). Then use a post processing effect to create a slight convolution of the frame (the goldfish bowl effect). Then draw your heads up items on the frame (score, etc).

    There are examples on how to use post processing effects in XNA. Probably a water drip or crystal ball example somewhere that you could adapt to give you the slight gold fish / glass bowl effect you are after.

    Resplicing some XNA...

    Play: Rail Gun Charlie (2009)

    Play: Tail Gun Charlie (2008)

    Duckocide
  • 9/24/2009 6:42 PM In reply to

    Re: Helmet gleam / shine

    Everything Dukocide said, 'cept you might draw your scene with a wide FOV (e.g., 95 degrees or better) to get a good fishbowl effect rather than as a post process.

    Best,
    Byron
    ..shaders make you feel... powerful, or very very stupid.
    http://drjbn.spaces.live.com/
  • 9/24/2009 9:36 PM In reply to

    Re: Helmet gleam / shine

    Byron Nelson:
    ... 'cept you might draw your scene with a wide FOV (e.g., 95 degrees or better)


    I agree with that. Geometry will go fishbowl effect if you change to Field of View (FOV) amount (It's a feature in my latest game - Rail Gun Charlie - to provide a wider players view. Can be changed in options) .

    Using a post process, would also convolute (real word?) any flat sprites you may be rendering in the scene (frame) as well. That said, if said sprites (billboards) are geometry (quads) and have more than just four corner vertices, FOV will work for most distances. I wondering as well if you can do some glass ripples with a post process (perlin noise may be?).
    Resplicing some XNA...

    Play: Rail Gun Charlie (2009)

    Play: Tail Gun Charlie (2008)

    Duckocide
  • 9/25/2009 7:01 AM In reply to

    Re: Helmet gleam / shine

    OK lovely! That sounds doable, so now what I would need basically is downsized code from the lensflare sample, and a pixel shader that morphes my image in a circular fashion towards the middle of the screen (or does the 95o do that for me?)

    Reducing the lensflare code to just 1 flare per light maybe, and altering the shape of the flare to be more of an elipse that matches the shape of my helmet. Also I would probably have to make the flare bigger depending on how close I am to that light.

    Then for the post-process pixel shader, does anyone have any sample of an image distorted to the center? Thats basically what I want right? I want more of the scene drawn in the center (proportionally) then on the edges. A fish-eye lens if you would.
    like: http://www.jasonwaltman.com/thesis/filter-fisheye.html, but inverted ( look at the image at the bottom of that page);

    I forsee 1 problem though: In the lensflare sample they use culling to see if the flare should be drawn, basically they check if the light(sun) is in the viewport, and if it is, if its behind a mountain or not. Then the flare is drawn. But in a fishbowl type of vision, a light could be directly above the player, out of the viewport, but because the bowl is round, it would have to leave a gleam on the top of the helmet, which would be viewable for the player, even though he cant see the light directly. How can I handle this rather funny culling? ( I am no expert on culling really). Could I just increase the culing based on the viewport, and like a few degrees FOV more outside of it or something?

    Thanks for the fast replies! :)
    .__.
    (o,0) -- w00t
    (/::\)
  • 9/25/2009 8:22 AM In reply to

    Re: Helmet gleam / shine

    I did something like this with a simple post-process per-pixel shift effect. It seems it isnt as advanced as what you are saying but it looked good enough for me
    http://www.fvproductions.org/blog/comments.php?y=09&m=04&entry=entry090428-214612
    Regards,
    Louis Ingenthron
    Fortis Venaliter
    Lead Developer of FV ProductionsFV Productions
  • 9/25/2009 9:08 PM In reply to

    Re: Helmet gleam / shine

    Mmm, doesnt quite cover what im looking for, judging by the screens.
    I think ill have a go at the math behind fish-eye, but then inverted as it were.

    Thanks for all your advice, if you have any more tips, im always open for suggestions :)
    .__.
    (o,0) -- w00t
    (/::\)
  • 9/26/2009 2:13 PM In reply to

    Re: Helmet gleam / shine

    Alrighty! Iv had some progress with fiddling around with the Distortion sample.

    I made my own model, a Sphere cut in Half, and after tweaking some vars I came out with this:

    screenie

    Which is pretty much bang on target. It has a problem though. If I scale up the circle the amount of displacement I can use goes down. Which is perfectly logical since the sphere uses the texture the size of the viewport. The smaller the Sphere is the more texture the Displacer has to sample from and the higher quality the result will be. Full screen the Sphere looks truelly horrible.

    Now, I guess the best way to tackle this it to render a much larger texture then the actual viewport, apply the Sphere + displacement on that, then scale them down and pass that result to the viewport. This way I can have a large Sphere (a bit larger then fullscreen, so I dont get weird corners), and the Sphere can have a large texture to sample from. This will give me better quality, since I scale the result down to the actuall viewport size I want.

    Is this a correct approach?

    Secondly, if it is, I have no idea how to get a texture that is larger then what the viewport can see, can anyone show me some (Pseudo) code?


    (EDIT: Reposting this Question, as it is no longer at home in the artist forums)
    .__.
    (o,0) -- w00t
    (/::\)
Page 1 of 1 (8 items) Previous Next