Welcome, Guest. Please login or register.

Author Topic: WritePixelArray VS Warp3d textures ?  (Read 9523 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #14 on: March 08, 2005, 02:59:34 PM »
Alpha channel need it for me.. Actually, my problem is it:
i want to do alpha fade/out with 24bit picture. If i can't
to do it directly on voodoo3, maybe here is way like:

1. creating 'black screen as textures'
2. draw picture by WritePixelArray.
3. draw black screen with alpha 0, and change alpha in loop
   to 1. and we have alpha fade out.

but what about alpha fade in ? i mean it must be like this:

user run programm, and watch black screen. And 24bit picture fade in. Some delay, and picture fade out.

any idea ?:)
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: WritePixelArray VS Warp3d textures ?
« Reply #15 on: March 08, 2005, 03:19:57 PM »
Just use the vertex colours to perform the fade.

Let's assume you can get a nice RGB565 format texture made in an art package and properly dithered to that depth.

Use that texture on a white polygon with W3D_MODUALTE as your texture environment. The vertex colour is then multiplied by the texture colour. Since the vertex colour is white, you get your original texture colour unmodified.

However, the vertex alpha colour is also included in the process if you have W3D_BLENDING enabled. For basic alpha blending, set the blend mode source and destination factors to W3D_SOURCE_ALPHA, W3D_ONE_MINUS_SOURCE_ALPHA respectively.

Now, you can render your rectangle each frame and progressively increase the alpha component to make your image more and more opaque.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: WritePixelArray VS Warp3d textures ?
« Reply #16 on: March 08, 2005, 03:22:46 PM »
Alternatively, to make a simple fade to any colour from the picture:

Draw the picture with the OS routines to get it on screen. To fade the image out, you can render a 75% transparent (using the vertex alpha again) polygon on top (no texture needed this time, just the vertex colour).

In this case, you don't clear the frame each time, just put another almost transparent layer of colour on it each time and over successive frames they will completely replace the image.
int p; // A
 

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #17 on: March 08, 2005, 04:09:34 PM »
"Let's assume you can get a nice RGB565 format texture made in an art package"

what name of art package which can allow to me create R5G6B5 picts ?


btw, if i will using OS function (WritePixelArray) to draw pict on screen, i will see as slow draw my pict. So, for fade-out is ok, but not for fade-in ..
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: WritePixelArray VS Warp3d textures ?
« Reply #18 on: March 08, 2005, 04:17:46 PM »
The fade I was talking about in the second post was fading from the image to a colour (so yes, a fade out).

For creating your images there are a few ways. One of them is to simply view your image in multiview with the maximum dithering and stuff turned on for a 16-bit screen and then simply grab the window with cybergrab or something. Make sure you save your grab as iff or png (something lossless) and then load it into any old 24-bit package, crop as needed (if needed) and save it off. Of course it will be saved directly as 24-bit data even though there are only 16 meaningful bits for each pixel.

Another way is to use PaintShop Pro (or whatever) on the PC which has the option to dither from 32/24-bit to 15 or 16 bit colour. It will still save as 24-bit in the same way.

Ideally you should write a small tool to then convert this 24-bit data to raw 16-bit data for your application (dropping the extra unused bits) but even if you load the data as 24 bit and it gets converted to 16-bits again, it only contained 16-bit colour resolution anyway; it's just a bit less efficient than being able to load the 16-bit data directly as a source for your texture.
int p; // A
 

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #19 on: November 08, 2005, 10:25:41 PM »
Hi all agayn :) I try to write some stuff with bvision and voodoo3 support, and have some problems with it .. On bvision i _CAN'T_ do
Code: [Select]

W3D_SetBlendMode(context, W3D_SRC_ALPHA, W3D_DST_ALPHA);

I check all W3D_QUEREs and ENV_BLEND for bvision do not work, as MIPMAPPING. But mipmapping is not problem, but ENV_BLEND it is big problem ..

Under voodoo3 it works fine. So..I do not have bvision for tests, and do not know where is a problem and how i can do it the same as on voodoo3 .. So, i must write here and talk about it with peoples, and try to write virtual stuff :)


Btw, maybe here is any way for emulate by warp3d library unsupported blend_modes states ? I mean use hardware drivers, use all states which can be doit by hardware driver, and for unsupported states use software driver ?



 
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: WritePixelArray VS Warp3d textures ?
« Reply #20 on: November 08, 2005, 11:08:21 PM »
Quote

kas1e wrote:


Btw, maybe here is any way for emulate by warp3d library unsupported blend_modes states ? I mean use hardware drivers, use all states which can be doit by hardware driver, and for unsupported states use software driver ?


Not easy and likely a very big performance hit.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: WritePixelArray VS Warp3d textures ?
« Reply #21 on: November 08, 2005, 11:11:08 PM »
Permedia2 only offers normal alpha blending (W3D_SRC_ALPHA, W3D_ONE_MINUS_SRC_ALPHA). There is another blending mode based on some apple model, sort of an additive blend but it doesn't actually conform to any GL ones and ergo is not really supported.
int p; // A
 

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #22 on: November 08, 2005, 11:37:07 PM »
Thanks Karlos, will try to rewrite all with W3D_SRC_ALPHA, W3D_ONE_MINUS_SRC_ALPHA.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: WritePixelArray VS Warp3d textures ?
« Reply #23 on: November 08, 2005, 11:39:38 PM »
@Kas1e

Only do that it if it makes sense for your application, of course. This mode gives you basic alpha channel based transparency. However it is also about the lowest common denominator - pretty much all supported cards on W3D offer it.

If this is not whant you need, you might find you can change your texture data in some way to achieve the effect you are after.
int p; // A
 

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #24 on: November 09, 2005, 03:52:30 AM »
@Karlos
I am already rewrite my little code with only 2 poor scenes with W3D_SRC_ALPHA, W3D_ONE_MINUS_SRC_ALPHA, for first scene (fade in/out of picture) it just work as for my voodoo3 settings, so 2 minuts of change, for second scene i was little tired with photoshop, but in end i create normal bitmap with no colors in background and can use one_minus_src_alpha. Also i remove mipmapping seetings . Well, will try to test it today/tommorow, hope no more new differens :)
 

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #25 on: November 09, 2005, 05:33:01 PM »
hi karlos.

tests give to me strange result :) i handled all return values of all w3d funcs (except drawtriangles and lock/unlock hardware), and .. all is good. All states setup correctly, textures loading is good too. But! I have only this:

15 bit = black screen, music (but here is 2 scene)
16/24 = black color of my textures!

Well .. maybe bvision do not support A8R8G8B8 texture modes ?
Or work bad with auto_tex mapping ? Or must be set mipmapping
option to 0xffff (but bvision can't mipmapping as i know).
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: WritePixelArray VS Warp3d textures ?
« Reply #26 on: November 09, 2005, 05:43:23 PM »
For the BVision:

Dont use MIP maps at all when you allocate the texture objects. It shouldn't hurt but it doesnt do anything anyway.

Make sure that your vertex colours are set up correctly too.

As for textures, it definately supports A8R8G8B8 (and A4R4G4B4), it's the voodoo3000 that has to convert this into A4R4G4B4.

Ensure that all your blending modes etc are set up in advance of any rendering too. Make sure you aren't blending your texture with a black polygon too (for W3D_MODULATE)!

If you want me to examine your code, email it to me and I'll try to check the problem out.
int p; // A
 

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #27 on: November 09, 2005, 06:24:19 PM »
Hm .. i little fear about 'black polygon'. I hope black screen it is only black screen, and alpha will work with it too ? And yes, i use W3D_SetTexEnv(context, tex, W3D_MODULATE, NULL)..
So, my steps is it:

1. I fill screen with black color by ClearDrawRegion.
2. I set MODULATE and BLEND(with mode).
3. Try to draw pict .. and .. it's sad but i think bvision think that black color of screen it is black texture and just can't blend with it ? but why ?

Anyway, i send code to you, check it plz, maybe you can found somethink here .. Thanks.

edit: hm, it works on voodoo3 without MODULATE too. Maybe W3D_DECAL best way ? or just unused W3D_SetTexEnv .. (it is not very need it for me anyway, and i think mostly stuff can be done without it).

edit2: btw, if i disable GOURAUD state, i have on voodoo3 the same as for bvision (but with gouraud and modulate) - black color of textures.

edit3: i remove MODULATE from code, and test on bvision agayn. BLACK COLOR AGAYN :))
 

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #28 on: November 26, 2005, 10:13:34 AM »
Ok, Karlos already help me with this problems. Problems is little buggy permedia2 driver (?). But, anyway, i want to up old question about dithering on voodoo3.

So (Rogue,EntilZha do you here?), voodoo3 chip can only 16bit targets/textures. But, it is possible to use Dithering. So, fitst question:

What ditherting method is used in warp3d 4.2 drivers ?
Average dithering ? Floyd-Steinberg dithering ? ordered dithering or random dithering ?  or somethink other ?

Second question:

What do it warp3d voodoo3 driver with 32bit data to convert it to 16bit ? Just drop older 4 bits or what ?

And third, and also very interesting question:

Why, if i enable W3D_Dithering state in my programm, nothink happened, and image draw with the same ugly color artefacts as with no enabled W3d_dithering state ? Fuction just do not work or i must setup somethink more ?

Thanks all for answers.
 

Offline kas1eTopic starter

Re: WritePixelArray VS Warp3d textures ?
« Reply #29 from previous page: February 11, 2006, 06:08:54 PM »
Ok, time to up warp3d talks ;) Thanks to karlos for lot of help, but i have new question: have warp3d4.2 somethink like 'color-key' in old directx ? I mean i want do somethink like this: i draw texture, but all color which i setup by somethink warp3d fuction just do not draw. For example i have black background with sprite. And want draw all, except black color.
it is possible by w3d 4.2 ?