Advanced C++/Graphics Tutorial 24: Basic Transparency!

preview_player
Показать описание
A whole tutorial for two lines of code :P. In the next video we learn how to get the world location of a click!

Рекомендации по теме
Комментарии
Автор

Great tutorials! Been at it since the your cout tutorials and I can say that I am much better at coding due to your tutorials.

CJ-ptdy
Автор

I'm pretty familiar with Alpha outside of OpenGL... so I was pretty frustrated it wasn't working after doing the earlier tutorial :P Glad I looked ahead and checked this out before banging my head against the wall trying to debug too long.

zvxcvxcz
Автор

You're awesome Ben! I'm still learning from this tutorial, but I really love it!!!
Thank you!

P.S. I still have a problem with understanding some GL function, but it's not your fault of course! :D I've never before use it!

P.S.S   Sorry, my English isn't good:P (Cheers from Poland!)

bartomiejkunikowski
Автор

Wow.. that was easy. I tried doing transparency by myself, and only got color keying done in fragment shader with:

if (color.rgb == vec3(1.0, 1.0, 1.0))
    discard;

But this is much better. Thanks Ben!

murkula
Автор

Hey Ben! Thanks for the tutorial!
I noticed something during this tutorial that was wrong in mine:
The 2 little men's color did NOT change through time like yours was doing today before removing it!!!
Can you tell me what the problem might have been? i can see the weird lines just like yours which show how much the quality sucks :p but at least yours moved horizontally while mine stood still even though i had the time variable and everything!

Lesterberne
Автор

Hello there Ben! you are not just the best OpenGL teacher out there, you
are an inspiration. :) Anyways I was having this awkward result, the textures were opaque (normal) on the topleft corner but as we move diagonally to the bottom right corner the texture got more transparent. After hours of looking around nothing worked, and then I opened my fragmentShader file and replaced " color = fragmentColor * textureColor" with "color = textureColor" and now it works great! Any ideas why this is happening with me? Thank you!

lennylinus
Автор

Thanks for the awesome tutorials. But i can't get rid of the black background around the image. Source code is same like your's but i render another image. I would really aprreciate your help.

wolverine
Автор

After I add alpha blending in the Window class the textures wont even render! Does anyone know what the problem could be?

XboxGamersAndMore
Автор

Input:

DestinationColor = (1.0f, 0.0f, 0.0f, 0.0f) // Red

SourceColor = (0.0f, 0.0f, 1.0f, 0.6f) // Blue, source alpha= 0.6f

One Minus Source Alpha = 1.0 – 0.6 = 0.4

Resolving final color:

// Blended color = (source color * source alpha) + (destination color * one_minus_source_alpha)
BlendedColor = (SourceColor * 0.6) + (DestinationColor * 0.4)
BlendedColor = (0.4f, 0.0f, 0.6f)

My doubt is: Is blended color's alpha value also multiplied? Would it become 0.36?

paulocbbf
Автор

Too bad I still need to fix my spritebatch code! D:
Funny thought, just two lines of code... xD
Good explanation thought.

DJoppiesaus
Автор

if {
* (1 + SCALE_SPEED));
}
if {
* (1 - SCALE_SPEED));
}
//For smooth, proportional scaling

MadCodex
Автор

For some reason the parts that should be shadows are just black. It isn't a square of black around the character, but just the part that is shading in the png

michaelskalecki
visit shbcf.ru