PixelRod
04-23-2005, 01:04 AM
You may want to look into shaders. There are many effects like glows that can be achieved with this. I'm sorry I don't have any links or examples to give you but it should be easy to find.
sswift
04-23-2005, 09:50 AM
It depends on what you want to do, and it helps to understand what the hardware is doing and what the engine you're using is capable of so you know which tricks you can use.
Take your headlamps for example. If you just want the headlights to glow in dark areas, then what you really want is for them not to be affected by light.
There's more than one way to do this.
One way would be to make a seperate surface for the headlamps and apply a material to it which isn't affected by light. On the 3D card that would mean vertex lighting is disabled for that surface. Vertex lighting darkens the texture around vertices which aren't bein hit by light.
Another way would be to use multitexturing. A modern 3D card can render between 4 and 8 textures in a single pass on a single polygon without a speed penalty.
Let's say you want to render a model normally with a texture vertex lighting. That setup might look like so:
mesh color * texture1
Note that multiply blending on a 3D card, presented above with the *, means divide the color by 255 to get it in the range 0..1, and then multiply the color beneath by that value. So it darkens pixels only.
Mesh color here is actually the color of the untextured mesh after the vertex colors have been affected by both ambient lighting and vertex lighting. Most meshes are just white, and then multiplied by the color of the light hitting each vertex, before being multiplied by the texture.
Now, if you want to make parts of your model glow, then what you'd do is add another texture layer but set it to add blend, which would give you this:
mesh color * texture1 + texture2
Your add blend texture would be black where you don't want any additional light added to your model, and brighter where you want parts of the model to have color but not be affected much by the lighting underneath.
For example, if you have a brown texture and you want glowing crystals on it, then you would multiply the brown texture by the underlying mesh color after it has been affected by lighting, and then you would apply another texture layer on top with some green and cyan speckles on a black background. Then the green and cyan color will be added to the brown color no matter how dark the brown has become because of lack of lighting, and those pixels will always be at least as bright as they are in your add blend texture.
As for your thruster example, in that case, it is most likely the thrusters are a seperate surface with a seperate material, and that material is set to fullbright... unaffected by vertex lighting, and just has a bright texture on it. The model ITSELF though may be set to add blend. Once you do all the math I showed you above, you then have to combine that final color with the scene. Normally the final color just overwrites everything in the scene. But if you want thrusters that are both bright and see through, and brighten whatever is behind them, then add blend on the mesh itself will add that final color to whatever is behind the thrusters.
It would be more realistic to use an alpha map to set the transparency of each pixel instead of using add blend, but an alpha map is another texture, and sometimes comes at a speed penalty, and the add blend generally looks good, though it is a bit overused, and looks cheesy when used for fire or spell effects, imo.
CGTalk Moderation
04-23-2005, 09:50 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.