How Do I Get A Black Shadow Texture...
Miscellaneous Forums/General Discussion/How Do I Get A Black Shadow Texture...
from a masked image...
i can get a white shadow easily, the black area surrounding it is alphaed out... but how do i get that white area darkened...
i'm searching through all the code archives now with lil luck... some quick help from someone, please...
--Mike
Make the main RGB channel completely black, make the alpha channel white where you want your shadow to be.
thx Lib... Blitz still tries to hide the 000 parts of the image... RossC and jFK have some ointment in the code archives that should cure these ills...
very much appreciative to all...
--Mike
red - the easiest way for Alpha textures (flag 2, not 4) is as Lberator said, use black for rgb and draw the shadow on the alpha channel using grey or white. Then (and that's important) save it as 32 bit TGA, with the alpha channel. This way blitz will use the alpha channel and won't try to create the alpha information by its own.
For masked textures (flag 4) it is (unfort.) not so easy. Blitz will use black nomatter what. A quick workaround is to use readpixelfast and writepixelfast after loading and replace the black texels with any color you want while leaving the alpha channel intact.
This is also required when you have eg. a grass texture that should be masked. when you replace the masked texels (intially: $00 00 00 00 ) by $00 00 FF 00 (green) then it will be embeded in the landscape much softer and it also won't give you black contours due to texture filtering.
Halo even used to write a function that was calculating the average object color that would then replace the black texles. I think it can be found in the archives as well.
Basicly, with Masking (flag 4) you need to set RGB and Alpha manually after loading, to get anything other than "masked nonblack thing on transparent/black background".
got it... thx j... i'm indebted to you again :)
will post a quick pic in a sec...
*** added ***
ok, take a look here-->
http://www.blitzbasic.com/Community/posts.php?topic=59860it seems like i'm getting a new feature in each day... terrain collisions day before yesterday... ship to ship/sub collisions in yesterday... and underwater shadows in today...
it's finally starting to look like something...
--Mike
The way I do it is I set the object's color to be black, then render it over a white background with a second camera. Then I use multiply blending to make the shadow darken what is behind it, not alpha.
You can set any colour texel to be masked. A masked texel has an alpha value of 128 or below... Or is it 128 or above. :o) Anyway, you can easily set which pixels to be masked :o)
[EDIT] Jfk said the same as me... sorry ^_^