Glowing Effect |
Orkl | In a game (for example Helbreath or Dungeon Siege) sometimes an Item will "Glow", I was wondering how you could do that? If anyone has any suggestions... Post 'em :[:I] |
Eric Coleman | For a glowing effect, you would render a slightly larger copy of the model using special textures and alpha values depending on the normal. To make the model "grow", not the same as scale, you need to add a small percent of a vertex's normal to itself. This makes each piece of geometry grow outward as though its expanding like a balloon. The next step is to take this modified geometry and alter the alpha value per vertex relative to the camera viewport. I think a nice glow would be a cosine curve of the dot product between the "lookat" vector and the vertex normal. Of course, you can use a different curve if you would like. If you do a search for my name at http://www.planetsourcecode.com/ you'll fine a transparency sample that I uploaded. The vertex alpha is the opposite of what you would want. The effect that I was trying to create was a membrane effect, like a jellyfish, where the surface is transparent when you look at it in a straight line, and then becomes less transparent when you look at it from an angle. A glow effect would the opposite I think. I think I use a sin^10 function for the alpha values. You could easily change the sin to cos in the source code to see what I'm talking about. Of course, its been so long since I looked at that code, I may have my sin and cos mixed up. Its either one or the other. |
Orkl | ok, i have no idea what: Vector, Vertex or Alpha values mean.. lol
or how you would use sine and cosine in programming =S |
Eric Coleman | Well, to do any advanced game programming, you'll need to be fairly proficient with math. Also, you never said if this was for a 3D game or for a 2D game. For a 2D game its a bit easier. You would simply use Adobe Photoshop or Gimp or whatever your favorite image editing program might be, and then apply a glow filter/effect to the sprite. Then just blt the "glowing" sprite instead of the normal sprite whenever you want it to glow. |
Orkl | ahhh ok, well it was for a 2d Isometric game :D
i know I need to be proficient at maths, but hey, only s**t they teach us in year 10 is "Indicies" and "Square Root"... Like i'll EVER need that... |
AT | That trig might come in handy ...
What do you think you need to use for distance calculations ? |
Bonez2044 | I just wanted to know if i can make my sprites glow that only i wear? |