Hi there.
I wanted to reenable the ability to render cubes with transparent textures.
For that I use this renderstate in the Cube demo of Afterwarp 300:
LRenderingState := FDevice.RenderingState;
LRenderingState.CullFace := TTriangleFace.None;
LRenderingState.States := LRenderingState.States or TRenderingState.State.BlendEnable;
LRenderingState.BlendColor.Source := TBlendFactor.SourceAlpha;
LRenderingState.BlendColor.Dest := TBlendFactor.InvSourceAlpha;
LRenderingState.BlendColor.Op := TBlendOp.add;
LRenderingState.BlendAlpha.Source := TBlendFactor.One;
LRenderingState.BlendAlpha.Dest := TBlendFactor.One;
LRenderingState.BlendAlpha.Op := TBlendOp.Add;
LRenderingState.States := LRenderingState.States or TRenderingState.State.BlendEnable or TRenderingState.State.AlphaToCoverage;
FDevice.RenderingState := LRenderingState;
While this does still enable the transparent areas of the texture, the back faces seem to be culled still.
Pic 1: afterwarp 300 cube demo, no renderstate changed
Pic 2: Same demo with above renderstate change
Pic 3: My demo from Afterwarp 205 also with the same renderstate change as above
I wanted to reenable the ability to render cubes with transparent textures.
For that I use this renderstate in the Cube demo of Afterwarp 300:
LRenderingState := FDevice.RenderingState;
LRenderingState.CullFace := TTriangleFace.None;
LRenderingState.States := LRenderingState.States or TRenderingState.State.BlendEnable;
LRenderingState.BlendColor.Source := TBlendFactor.SourceAlpha;
LRenderingState.BlendColor.Dest := TBlendFactor.InvSourceAlpha;
LRenderingState.BlendColor.Op := TBlendOp.add;
LRenderingState.BlendAlpha.Source := TBlendFactor.One;
LRenderingState.BlendAlpha.Dest := TBlendFactor.One;
LRenderingState.BlendAlpha.Op := TBlendOp.Add;
LRenderingState.States := LRenderingState.States or TRenderingState.State.BlendEnable or TRenderingState.State.AlphaToCoverage;
FDevice.RenderingState := LRenderingState;
While this does still enable the transparent areas of the texture, the back faces seem to be culled still.
Pic 1: afterwarp 300 cube demo, no renderstate changed
Pic 2: Same demo with above renderstate change
Pic 3: My demo from Afterwarp 205 also with the same renderstate change as above
Comment