TransformSprite3D() - How to flip a Sprite3D ?

Just starting out? Need help? Post your questions and find answers here.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

TransformSprite3D() - How to flip a Sprite3D ?

Post 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!
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post 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?
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post 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 ^^)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
chris_b
Enthusiast
Enthusiast
Posts: 103
Joined: Sun Apr 27, 2003 1:54 am

Post 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().
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 345
Joined: Sat Dec 25, 2004 2:37 pm

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

Post by thyphoon »

do you know how to disable backface culling with PB 5.20 ?

Thanks
superadnim
Enthusiast
Enthusiast
Posts: 480
Joined: Thu Jul 27, 2006 4:06 am

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

Post by superadnim »

is there no way to flip the uv coordinates instead of the entire quad?

:lol: should I bash the keyboard and give up?
:?
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

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

Post by Olliv »

Use OGL gadget or Screen 3D render which allows you to diskort/skew/rotate/flip/scale and scroll texture.
Post Reply