ZDepht in DrawFlipBookImage() not working?

Topics regarding Scripting with Reality Factory
Post Reply
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

ZDepht in DrawFlipBookImage() not working?

Post by Jay » Tue Aug 19, 2008 11:30 am

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?
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: ZDepht in DrawFlipBookImage() not working?

Post by Juutis » Wed Aug 20, 2008 8:58 am

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.
Pain is only psychological.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: ZDepht in DrawFlipBookImage() not working?

Post by Jay » Wed Aug 20, 2008 10:11 am

From which values to which values did you change them?
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: ZDepht in DrawFlipBookImage() not working?

Post by Juutis » Wed Aug 20, 2008 10:17 am

I had them all on 0 or 1 I think. I changed them to cursor: 0, icons: 1 and background: 2.
Pain is only psychological.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: ZDepht in DrawFlipBookImage() not working?

Post by Jay » Wed Aug 20, 2008 12:14 pm

interesting....wait, i'll take a look at the source code
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: ZDepht in DrawFlipBookImage() not working?

Post by Juutis » Wed Aug 20, 2008 12:23 pm

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.
Pain is only psychological.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: ZDepht in DrawFlipBookImage() not working?

Post by Jay » Wed Aug 20, 2008 12:33 pm

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.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: ZDepht in DrawFlipBookImage() not working?

Post by Juutis » Wed Aug 20, 2008 12:53 pm

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.
Pain is only psychological.

Post Reply