Page 1 of 1

ZDepht in DrawFlipBookImage() not working?

Posted: Tue Aug 19, 2008 11:30 am
by Jay
From the docs:
DrawFlipBookImage(char *FlipBookName, int ImageIndex, int XPos, int YPos, float Alpha, int R, int G, int B, float ZDepth );

Draws the image with index ImageIndex of the FlipBook entity FlipBookName parallel to the screen at position (XPos, YPos), ZDepth in front of the camera.
XPos and YPos are clear to me. I think ZDepth refers to the value of the poly in the ZBuffer, so it might be possible to for example set it into the middle range, or to use it as a background image.

But it does not seem to have any effect if i change this value. Is the feature broken? Or what does it do?

Re: ZDepht in DrawFlipBookImage() not working?

Posted: Wed Aug 20, 2008 8:58 am
by Juutis
Dunno what it is for exactly but when I released my demo some PCs had problems with the inventory. I had the same ZDepth in every command and the background was drawn on top of the other elements. Then I changed the background, the icons and the cursor to have different values and it worked fine. On my own PC it worked fine all the time, though.

Re: ZDepht in DrawFlipBookImage() not working?

Posted: Wed Aug 20, 2008 10:11 am
by Jay
From which values to which values did you change them?

Re: ZDepht in DrawFlipBookImage() not working?

Posted: Wed Aug 20, 2008 10:17 am
by Juutis
I had them all on 0 or 1 I think. I changed them to cursor: 0, icons: 1 and background: 2.

Re: ZDepht in DrawFlipBookImage() not working?

Posted: Wed Aug 20, 2008 12:14 pm
by Jay
interesting....wait, i'll take a look at the source code

Re: ZDepht in DrawFlipBookImage() not working?

Posted: Wed Aug 20, 2008 12:23 pm
by Juutis
The thing that makes me wonder is why it works on certain PCs only. I have two computers and the parameter doesn't have any effect on both of them. On my friend's old PC it however worked, kinda, resulting in the inventory being totally messed up.

Re: ZDepht in DrawFlipBookImage() not working?

Posted: Wed Aug 20, 2008 12:33 pm
by Jay
I think it has to do with autamtic DirectX culling that takes place when thinghs are very near to the camera, like when you type 0 in the zdepth.

The zdepth should vary from 0.001 (minimum distance) to 0.999 (maximum distance) when i manage to turn on the zbuffer for flipbooks.



EDIT: AHA, flipbooks are seen as images which are rendered without a zmask and without zwrite. That actually makes zdepth useless. You should not make it 0, because then it could be that the image gets culled.

With the zbuffer, one could make pretty neat thinghs with flipbookimages. Like using it as a background for the sky (Is drawn behind evryting), or using it for fog (Is drawn in the middle with alpha channel on) or even move them around in the depht (sandstorms a la morrowind).

I'll try to add 2 new features to the DrawFlipBookImage: first, that it can be stretched to any size you want it, and second that it can use the zbuffer.

Re: ZDepht in DrawFlipBookImage() not working?

Posted: Wed Aug 20, 2008 12:53 pm
by Juutis
Nice! By stretching do you mean you could scale a 64x64 image for example to fullscreen size? That'd be really sweet.

Also the zbuffer thing sounds awesome. Could produce some really neat effects. :D


**EDIT**
And if what you say is true then the value must've been 0 in my demo. I can't say if the background was on top of everything or were the other things just culled.