TransparentSpriteColor problem in Sprite3D on Riva TNT2

Everything else that doesn't fall into one of the other PB categories.
newart
User
User
Posts: 34
Joined: Sat Feb 12, 2005 1:59 am
Location: Russia, SPb

TransparentSpriteColor problem in Sprite3D on Riva TNT2

Post 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.: (
Dr. Dri
Enthusiast
Enthusiast
Posts: 243
Joined: Sat Aug 23, 2003 6:45 pm

Post by Dr. Dri »

i don't have any problem, could you give me a sample code and a sprite ?

Dri :)
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Is the sprite size a multiple of 2? eg 32*32, etc?
Last edited by netmaestro on Tue Feb 21, 2006 7:04 pm, edited 2 times in total.
BERESHEIT
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Here, the transparency for Sprite3D doesn't work either. And yes, the size is correct, the standard example doesn't show transparency.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Probably a driver issue then.
newart
User
User
Posts: 34
Joined: Sat Feb 12, 2005 1:59 am
Location: Russia, SPb

Post 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).
S.M.
Enthusiast
Enthusiast
Posts: 118
Joined: Sat Apr 24, 2004 1:11 pm
Contact:

Post 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
Last edited by S.M. on Sat Jan 28, 2006 11:19 pm, edited 3 times in total.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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.
Last edited by netmaestro on Tue Feb 21, 2006 7:08 pm, edited 8 times in total.
BERESHEIT
newart
User
User
Posts: 34
Joined: Sat Feb 12, 2005 1:59 am
Location: Russia, SPb

Post 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.
newart
User
User
Posts: 34
Joined: Sat Feb 12, 2005 1:59 am
Location: Russia, SPb

Post 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
newart
User
User
Posts: 34
Joined: Sat Feb 12, 2005 1:59 am
Location: Russia, SPb

Post 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:
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

If it's not size or compression, I'm at a loss. Fred's probably right, a driver issue.
Last edited by netmaestro on Tue Feb 21, 2006 7:10 pm, edited 3 times in total.
BERESHEIT
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
newart
User
User
Posts: 34
Joined: Sat Feb 12, 2005 1:59 am
Location: Russia, SPb

Post 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?
Post Reply