Hello,
There is a very cool effect used in many video games these days. The effect is, when you have a reflective object (e.g. car body) exposed to a lamp, the most shiny part of the car has a nice glow around it. This picture explains it well
And if you rotate the camera around the car, then another very shiny spot will also give a nice glare/glow. How can I translate this in the game engine? Is there a method in which you can make part of an object glow based on how shiny it is?
I hope I have explained my point clearly. If not, please post and tell me.
Thanks!
Raco
(Raco)
2
I think such affect could be achieved with a shader. Unfortunately that’s not my cup of tea, yet. I plan to study it more in the future.
Ah, thanks!
I’ve heard that shaders slow down the game engine. So using glare alpha textures is what is used in games to achieve this effect, I think. The thing is, I don’t know how to tell the BGE to show the glare texture at the point which shows most specularity.
Raco
(Raco)
4
Shaders can slow down the game, but I don’t think such a shader would be so expensive that it would. Using alpha textures for such an effect seems unimaginable to me, to be honest.
Using alpha textures gives you a lot more control, and that’s what game companies want. But if you use shaders, then everything that is specular with glow. So if I have a scene which contains a building with shiny windows and shiny walls, then everything will have a glow around it.
Raco
(Raco)
6
I couldn’t really say since shaders are not my cup of tea. Do you know how shaders work?
I am not quite sure. The only shader I can think of is the ‘bloom’ shader in blender. That basically duplicates an object, scales it up, then makes it quite opaque, hence you get that blur effect going. I can send you a .blend if you want
?
Raco
(Raco)
8
Maybe you need a custom 2D filter.
The bloom filter is a custom 2D filter. It has a short script. Here is the script:
uniform sampler2D ngl_RenderedTexture;
void man(){
vec4 color = texture2D(bgl_RenderedTexture, gl_TexCoord[0]);
int i, j;
vec4 sum = vec4(0);
for (i = -2; i <= 2; i++){
for (j = -2; j <= 2; j++){
vec2 offset = vec2(i, j) * 0.005;
sum += texture2D(bgl_RenderedTexture, gl_TexCoord[0] + offset);
{
{
gl_FragColor = (sum / 25) + color;
}
I am no expert in scripting in the BGE, so I cannot take credit for this script.
(The bloom filter is the closest I can get to make shiny objects glow. Yet I don’t have much control over the parts which recieve the most/least glow. Hence I don’t really recommend it for shiny objects in sunny scenes.)
Akira_San
(Akira_San)
10
When u paste a code use the forum code tags, its much clear that way.
isyedcg
(isyedcg)
12
i think you can use other game engines if you need glare effect if it comes to BGE…then its good…