Page 1 of 1

TransformSprite3D() - How to flip a Sprite3D ?

Posted: Tue Jul 21, 2009 11:45 pm
by va!n
I have read the docs and tried to get a flipped version of the original sprite... sadly without success... Maybe someone of you can help me how to flip a Sprite3D:

Original looks like:

AAAA
BBBB
CCCC
DDDD

The transformed (flipped) version should look like:

DDDD
CCCC
BBBB
AAAA

Many thanks in advance!

Posted: Wed Jul 22, 2009 12:08 am
by Kaeru Gaman
seems you can't flip it but only rotate it by 180°

flipping will show the back side of the quad and this isn't defined.
when the normal of the texture points away from the cam it isn't visible.

Posted: Wed Jul 22, 2009 12:19 am
by va!n
mhhhh.... that are sadly bad news... still wonder, why there is/are no flip sprite2d/3d commands available...

Is there really no way to flip a sprite using TransformSprite3D() without using extra own function code?

Posted: Wed Jul 22, 2009 12:32 am
by Kaeru Gaman
I just tried to flip it, and it showed nothing until I kept an eye on the normal of the texture.
when rotating it 180°, it showed properly.

this leaded me to the conclusion, that Sprie3D is a standard quad wich has a normal and an invisible backside.

according to this there would be no way to flip a Sprite3D, since this would always show the backside.
maybe there are textures in 3D that can be flipped, but not this type.


funny enough, I can't remember I ever needed a function to flip a sprite upside down, thus i didn't miss it yet.

would it be acceptable for you to prerender the flipped image?
flip the 2D sprite on startup into a second sprite and use both for seperated sprite3D.

Posted: Wed Jul 22, 2009 12:57 am
by va!n
yes i ithink u are right about the normal quad and its invisible backside. However afaik their are ways that even the backside is visible but afaik this may shut down the rendering performance a bit.

I know about the prerendering... but a) for my actually tiny project this is not acceptable and b) why prerendering when it coule be done using DX and accelated? ^^

I am sure i can tell you examples where it would be nice to flip spites... just think about a walking animation tileset of a guy, walking to the left direction... you can simple flip the sprite and have the guy walking to the right too (with just only one original sprite, we just have to mirror/flip ^^)

Posted: Wed Jul 22, 2009 3:41 am
by chris_b
With DirectX7 subsystem you can disable backface culling with the following:

Code: Select all

Global D3Ddevice_interface7.IDirect3DDevice7

Start3D()
   !extrn _PB_Direct3D_Device
   !MOV dword EAX, [_PB_Direct3D_Device]
   !MOV dword [v_D3Ddevice_interface7],EAX
   D3Ddevice_interface7\SetRenderState(22,1)   ;(D3DRENDERSTATE_CULLMODE,D3DCULL_NONE)
Stop3D()
For DirectX9 subsystem use:

Code: Select all

Global D3Ddevice_interface9.IDirect3DDevice9

Start3D()
   !extrn _PB_Screen_Direct3DDevice
   !MOV dword EAX, [_PB_Screen_Direct3DDevice]
   !MOV dword [v_D3Ddevice_interface9],EAX
   D3Ddevice_interface9\SetRenderState(22,1)
Stop3D()
This doesn't need to be in your main loop, you only need to do it once after OpenScreen().

Re: TransformSprite3D() - How to flip a Sprite3D ?

Posted: Sun Oct 13, 2013 9:19 pm
by thyphoon
do you know how to disable backface culling with PB 5.20 ?

Thanks

Re: TransformSprite3D() - How to flip a Sprite3D ?

Posted: Mon Apr 27, 2020 7:16 pm
by superadnim
is there no way to flip the uv coordinates instead of the entire quad?

Re: TransformSprite3D() - How to flip a Sprite3D ?

Posted: Tue Apr 28, 2020 4:30 am
by Olliv
Use OGL gadget or Screen 3D render which allows you to diskort/skew/rotate/flip/scale and scroll texture.