Page 1 of 2

TransparentSpriteColor problem in Sprite3D on Riva TNT2

Posted: Sat Jan 28, 2006 7:27 pm
by newart
I selected different colors of a transparency,
but all of them are drawn together with sprite.
However in 16 bit a mode all OK.

Tested on pb3.94 and pb3.90

In 2D sprite all OK in all mode.

I think it serious BUG.: (

Posted: Sat Jan 28, 2006 7:30 pm
by Dr. Dri
i don't have any problem, could you give me a sample code and a sprite ?

Dri :)

Posted: Sat Jan 28, 2006 7:33 pm
by netmaestro
Is the sprite size a multiple of 2? eg 32*32, etc?

Posted: Sat Jan 28, 2006 7:57 pm
by Trond
Here, the transparency for Sprite3D doesn't work either. And yes, the size is correct, the standard example doesn't show transparency.

Posted: Sat Jan 28, 2006 8:28 pm
by Fred
Probably a driver issue then.

Posted: Sat Jan 28, 2006 10:17 pm
by newart
Fred wrote:Probably a driver issue then.
I checked on two different computers with different drivers.
In any case even if business in Driver.
I shall make game and at someone with driver the problem will be same. It is bad.: (

I wish to notice that has put in PureBasic, so-as I started much casual (shareware) games (2d with 3d sprites), there all ok.

p.s. It is an old problem, I am simple again with it have collided on computer sister (with riva tnt2).

Posted: Sat Jan 28, 2006 10:46 pm
by S.M.
@newart
A few GFXCards don't support colorkeying for 3D-Sprites. With this code you can test if your Hardware supports it:

Code: Select all

Structure D3DPrimCaps 
dwSize.l
dwMiscCaps.l
dwRasterCaps.l
dwZCmpCaps.l
dwSrcBlendCaps.l
dwDestBlendCaps.l
dwAlphaCmpCaps.l
dwShadeCaps.l
dwTextureCaps.l
dwTextureFilterCaps.l
dwTextureBlendCaps.l
dwTextureAddressCaps.l
dwStippleWidth.l 
dwStippleHeight.l 
EndStructure

Structure D3DDeviceDesc7
dwDevCaps.l
dpcLineCaps.D3DPrimCaps
dpcTriCaps.D3DPrimCaps
dwDeviceRenderBitDepth.l
dwDeviceZBufferBitDepth.l
dwMinTextureWidth.l
dwMinTextureHeight.l
dwMaxTextureWidth.l
dwMaxTextureHeight.l
dwMaxTextureRepeat.l
dwMaxTextureAspectRatio.l
dwMaxAnisotropy.l
dvGuardBandLeft.f
dvGuardBandTop.f
dvGuardBandRight.f
dvGuardBandBottom.f
dvExtentsAdjust.f
dwStencilCaps.l
dwFVFCaps.l
dwTextureOpCaps.l
wMaxTextureBlendStages.w
wMaxSimultaneousTextures.w
dwMaxActiveLights.l
dvMaxVertexW.f
GUIDdeviceGUID.guid
wMaxUserClipPlanes.w
wMaxVertexBlendMatrices.w
dwVertexProcessingCaps.l
dwReserved1.l
dwReserved2.l
dwReserved3.l
dwReserved4.l
EndStructure

#D3DDEVCAPS_DRAWPRIMTLVERTEX=1024

Procedure GetD3DDevice7()
!extrn _PB_Direct3D_Device
!MOV EAX,[_PB_Direct3D_Device]
ProcedureReturn
EndProcedure

InitSprite()
InitSprite3D()

OpenWindow(1,0,0,320,240,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Test")
OpenWindowedScreen(WindowID(),0,0,320,240,0,0,0)

Start3D()
*Dev.IDirect3DDevice7=GetD3DDevice7()
*Dev\GetCaps(caps.D3DDeviceDesc7)
If caps\dwDevCaps&#D3DDEVCAPS_DRAWPRIMTLVERTEX=0
MessageRequester("Info","Transparent 3DSprites are NOT supported by your 3D-accelerated !",#MB_ICONWARNING)
Else
MessageRequester("Info","Transparent 3DSprites are supported by your 3D-accelerated !",#MB_ICONINFORMATION)

EndIf
Stop3D()
CloseScreen()
[Edit]
NOTE: The test was wrong :!:
[/Edit]

regrads
Stefan

Posted: Sat Jan 28, 2006 10:52 pm
by Trond
---------------------------
Info
---------------------------
Transparent 3DSprites are supported by your 3D-accelerated !
---------------------------
OK
---------------------------
Also, I've seen transparent "3d sprites" (polygons with textures) on this card but not made in PureBasic, with the current driver, using DirectX 8.

Posted: Sat Jan 28, 2006 11:03 pm
by netmaestro
Another common issue is that of compression. If you are making transparent sprites, you can not use jpegs. Only bmps have the needed quality for transparency to work correctly. Here is an example that shows the problem:

Code: Select all

InitSprite() 
UseJPEGImageDecoder() 

OpenWindow(0,0,0,320,240,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"") 
OpenWindowedScreen(WindowID(0),0,0,320,240,0,0,0) 
LoadSprite(0,"geebee3.bmp") 
LoadSprite(1,"geebee3.jpg") 

TransparentSpriteColor(0,RGB(255,0,255)) 
TransparentSpriteColor(1,RGB(255,0,255)) 
  DisplayTransparentSprite(0,30,50) 
  DisplayTransparentSprite(1,180,50) 

Repeat 
  ev=WaitWindowEvent() 
  
Until ev=#PB_Event_CloseWindow
http://www.networkmaestro.com/geebee3.bmp
http://www.networkmaestro.com/geebee3.jpg

PS I cleaned the garbage from around the edges of Fred's geebee2.bmp and so the resulting geebee3.bmp doesn't have the pink border. Little side note: when making images for display with transparency, antialias is not your friend.

Posted: Sat Jan 28, 2006 11:41 pm
by newart
[quote="S.M."]@newart
A few GFXCards don't support colorkeying for 3D-Sprites. With this code you can test if your Hardware supports it:

Code: Select all

Structure D3DPrimCaps 
EndIf
Stop3D()
CloseScreen()
Tested OK.
I have tested many games, there on mine Riva TNT2 there are no problems! Also there are no problems and PureBasic in 16bit mode.

Posted: Sun Jan 29, 2006 12:19 am
by newart
So has got used to use pink (*FF00FF) color key, that has not guessed to check up Black. :oops:
With Black all work with in 16 and 32 bit mode. :D
But there is one more bug. :?
Original sprite has the size 16x16.
And at resize 32x32, it is drawn on a miscellaneous in 16bit and 32bit mode.
16bit it correctly.

16bit:
Image
32bit:
Image
original (16x16):
Image

Posted: Sun Jan 29, 2006 12:28 am
by newart
PS I cleaned the garbage from around the edges of Fred's geebee2.bmp and so the resulting geebee3.bmp doesn't have the pink border. Little side note: when making images for display with transparency, antialias is not your friend.
I know all this. :wink:
Therefore very much I wait PureBasic 4 with Alpha channel. :twisted:

Posted: Sun Jan 29, 2006 4:05 am
by netmaestro
If it's not size or compression, I'm at a loss. Fred's probably right, a driver issue.

Posted: Sun Jan 29, 2006 11:29 am
by Trond
netmaestro wrote:Another common issue is that of compression. If you are making transparent sprites, you can not use jpegs. Only bmps have the needed quality for transparency to work correctly. Here is an example that shows the problem
The example file that comes with purebasic, which I have already checked for this problem, does still not have transparency. Also I tried with black instead of pink (changed the source of course) and the black wasn't transparent either.

Posted: Sun Jan 29, 2006 3:51 pm
by newart
Trond wrote:
netmaestro wrote:Another common issue is that of compression. If you are making transparent sprites, you can not use jpegs. Only bmps have the needed quality for transparency to work correctly. Here is an example that shows the problem
The example file that comes with purebasic, which I have already checked for this problem, does still not have transparency. Also I tried with black instead of pink (changed the source of course) and the black wasn't transparent either.
What you gfx cart?