Easy Transparancy Quesion

rifter1818

Junior Contributor
Joined
Sep 11, 2003
Messages
255
Location
A cold dark place
How can i make a certain color (for instance Black) transparant in an allready loaded Texture (or surface). So far the only means by which i can think of is
SufaceLoader.FromSurface(Surf,Surf,SomeFilter,color.black.toargb) this works however the framerate drops from 60 to 3 which a bit too much, ive tried filter.point,.linear,.none all end up with the same wonderfull 3 fps so i dont think its the filter.... Does anyone know of an actually usefull way to do this? Actually Thinking about it its probably because the surface is so large, so i guess next question asside from is there a more efficiant way to apply a transparancy, is what is the best way to scale a texture or surface down?
 
I think the best way is a rectangle with texture. Load it with color key and use
alphatestenable=true
use alphafunc to determine what show and how.
 
Sorry

RobyDx said:
I think the best way is a rectangle with texture. Load it with color key and use
alphatestenable=true
use alphafunc to determine what show and how.
Could you include a qiuck code snipit please, and thanks once again for all your help.
 
rifter1818 said:
Could you include a qiuck code snipit please, and thanks once again for all your help.

device.RenderState.AlphaTestEnable = True
device.RenderState.ReferenceAlpha=0 (or 255)
device.RenderState.AlphaFunction=Compare.equal (or notEqual)

With this set you altern show of part that has colorkey or not.
load a texture with color key and apply it to a models.
 
Ohh

RobyDx said:
device.RenderState.AlphaTestEnable = True
device.RenderState.ReferenceAlpha=0 (or 255)
device.RenderState.AlphaFunction=Compare.equal (or notEqual)

With this set you altern show of part that has colorkey or not.
load a texture with color key and apply it to a models.
What i want to do is apply the transparancy to an allready loaded texture.
(like for instance a texture i created by rendering to its surface....)
 
rifter1818 said:
What i want to do is apply the transparancy to an allready loaded texture.
(like for instance a texture i created by rendering to its surface....)
just load a texture with colorkey. In the instruction for creating pass a color.toargb value
for renderToSurface use a A8R8G8B format and render on this surface image that has color key.
Then apply to a square and you 'll have trasparencties
 
Back
Top