PDA

View Full Version : make bullet marks transparent? or?



enjoycrf
02-22-2011, 03:16 PM
why is GLSL so complicated?
why cant i just do include glsl_shading_garbage.h or whatever
and all the wrappers already be prewritten?
i am doing some simple bullet holes
and i got the black and white bullet mark image
so i looked at quake3 code and did the putting the quad on the wall w that texture rather quickly
but the rest of the code dives into a syscall to draw the quad and shading it is in there too
and obviosly even my nifty linux find functions in files searching skills didnt help me find the dam syscall of the quad drawing function
so i was able to place and texture the dam quad on my own
now i am stuck w a dam black and white bullet hole lol
but it should be transparent w depth hahaha
so i am looking at the bump mapping tutorial on nehe
and he is dragging all sorts of shading functions which i realy want to keep out of my lil game
i managed to get his code in and to compile with out the extra shading stuff
but now when my bullet holes appear my entire level goes to monochrome and looks like frikken legos
does anyone kno wats up here
is parallax easier to do, less code?
which way do they do it in quake3? HL2?
also i was not able to find anything regarding parallax and opengl online in terms of tutorials only in directX i think
plz helpp!!!!

enjoycrf
02-22-2011, 03:25 PM
i guess now that i have been messing with bump mapping
it leads to another question
bump mapping lessons all have a color texture and a bump map of that texture for the cube or what ever they are mapping
where in my case
i only have a black and white bullet mark image which im guessing is the bump map
and the wall that i place the bullet mark poly on would be the color texture?
so at this point i would just be happy with making the black color or the bullet mark transparent and teh white color black

enjoycrf
02-23-2011, 03:45 AM
what are my options here?
if this was photoshop
id make black transparent
and invert the image
:p
scratch head?
and now feeling like carl pokenton lol

mbentrup
02-23-2011, 07:56 AM
You have to use the right blend func, from your description I think this should work:



glBlendFunc(GL_ONE, GL_ZERO);
wall->draw();
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
mark->draw();


Where you have to replace the draw() calls by whatever you do to draw the wall resp. bullet mark.

That should darken the wall texture proportionally to the brightness of the bullet mark pixels.

nickels
02-23-2011, 12:54 PM
Is the bullet texture meant to be additive?

I spent several days trying to figure out how fire in quake3 was transparent (no alpha channel, no alpha shader) and finally figured out you just add the texture (the black pixels contribute nothing).
Light cones too.
??