Let's just assume that the ground is white and that the shadow texture has no gradient and that its alpha is either 1 or 0. But unfortunately this setup doesn't work and I think I understand why (I may be wrong though). Everywhere it's 0.0 won't.Ĭlick to expand.You really helped further understand this whole alpha blending thing. Anywhere the destination alpha is 1.0 will show the shadow. OutColor = DstColor * One - SrcColor * DstAlpha Īnd there you go. One step further, you can add in the destination alpha: OutColor = DstColor * One - SrcColor * One OutColor = DstColor - shadow texture alpha ╗ So how can you recreate the above, or at least get close? Unfortunately, there's no multiply blend op (well, there can be in OpenGL, but it's not that useful), but you can get close with: OutColor = DstColor * (1 - shadow texture alpha) So the important portion can be simplified down to just: The first part of that cancels itself out 0 * anything = 0, and 0 + something = something. OutColor = (0,0,0,0) * (shadow texture alpha) + DstColor * (1 - shadow texture alpha) ![]() In the case of a black shadow and your shader, you're really doing this: ![]() You can change what you're multiplying the SrcColor and DstColor by, and how they're being combined to be either add, subtract, reverse subtract (dst - src), min and max.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |