Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: DXDraw.Options: do3D Problems

  1. #1

    DXDraw.Options: do3D Problems

    Hi

    I have some problems adding do3D to the DXDraw options. The problems are that the function Picture.TransparentColor doesn't return the right color, when I turn an sprite or image into transparent then the borders are bad cut, and I'm not allowed to use backgroundsprites of more than 4096 pixels wide. Detailing:

    1)PICTURE.TRANSPARENTCOLOR doesn't work

    To turn the sprites and images transparent I used the next function:

    Code:
    DXImageList.Items[8].TransparentColor := DXImageList.Items[8].Picture.TransparentColor;
    DXImageList.Items[8].Transparent      := True;
    But when I add DXDraw.Options := DXDraw.Options + [do3D] it stops working and all sprites and images are viewed into a square. I solved with the following change:

    Code:
    DXImageList.Items[8].TransparentColor := DXImageList.Items[8].Picture.Bitmap.Canvas.Pixels[0,DXImageList.Items[8].Height-1];
    DXImageList.Items[8].Transparent      := True;


    2)BORDERS CUT

    Now that I have solved the transparency I realise that images and sprites doesn't cut the edges correctly, and some parts of the paint not transparent are not shown. In the case of images I tried with DXImageList.Items[62].Draw(...) and with DXImageList.Items[62].DrawAlpha(...) and the effect is the same. I don't know how to solve this error, it's just like the TransparentColor would be a set of similar colors and not only one, like it has a % of margin for similar colors.



    3) BACKGROUNDSPRITE.WIDTH > 4095
    Another big problem is when I load the sprite for the background, if it's minor than 4096 it works well, but when it reaches 4095 or more pixels the image keeps its size (by example 6700 pixels) but only shows the first 4096 first pixels of the image stretching to the real size (6700 in the example).



    The game admits images up to 8192x4096, so the height is not a problem, but the circuits with a width of more than 4096 pixels are bad shown. All this is with the 1.06c version of unDelphiX, with the 1.07f version the problem is bigger, the problem then is thar a background of more than 4095 pixels the background is all black with some random parts of graphics all around. But with the 1.07f is about 40fps faster.









    I have some other random problems that alters the security options in the game, like CRC of files and clock cycle control, and some other times changing to full screen causes an AccesViolation.

    The positive part of using do3D is that the FPS raise and I can use Alpha without lowering fps too much, if you use Alpha without do3D the performance is very very low.

    Any idea about how to solve these problems??

    Thanks in advance.
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  2. #2

    DXDraw.Options: do3D Problems

    pictures don't showing here
    From brazil (:

    Pascal pownz!

  3. #3

    DXDraw.Options: do3D Problems

    My web :x don't load images first time.

    Rigth mouse button and show image to see.

    I think I have solved random problems like CRC of files and clock cycle control solved with SetPrecisionMode(pmDouble);

    Thanks in advance. :twisted:
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  4. #4

    DXDraw.Options: do3D Problems

    Hi, there is any problem with picture size. Limit for texture was setup to 2048x2048 px. When is picture bigger (like 4096x4096) picture is shows but mesh recount isn't good. In version 1.07f this was corrected to limit up texture size, but no shown.

    But this is not perfect still. Now I preparing version 1.08 and there will be new texture manager with mirroring etc.

    Solution for this can be - use texture size max 2048x2048 px, transparent color use balck or alphachannel in DIB32.
    Ijcro.

  5. #5

    DXDraw.Options: do3D Problems

    .
    Ijcro.

  6. #6

    DXDraw.Options: do3D Problems

    The textures are shown in the right way until 4096x4096, when they pass that size is the problem. I tried with textures higher than 2048 and work right.

    The problem of the transparent color and the edges of the images happen in sprites or little images. I tried with a black background and other colors but are always bad cut. All images and sprites are loaded in run-time from bmp files of 256 colours.

    I load the images in the next way:

    [pascal]DXImageList.Items.Find('Rev').Picture.LoadFromFile (ExtractFilePath(ParamStr(0)) + 'graficos\Revoluciones.bmp');
    DXImageList.Items.Find('Rev').PatternHeight := DXImageList.Items.Find('Rev').Picture.Bitmap.Heigh t;
    DXImageList.Items.Find('Rev').PatternWidth := DXImageList.Items.Find('Rev').Picture.Bitmap.Width ;
    DXImageList.Items.Find('Rev').TransparentColor := DXImageList.Items.Find('Rev').Picture.Bitmap.Canva s.Pixels[0,DXImageList.Items.Find('Rev').PatternHeight-1];
    DXImageList.Items.Find('Rev').Transparent := True;
    DXImageList.Items.Find('Rev').Restore;[/pascal]

    and show them on the screen like this:

    [pascal]DXDraw.BeginScene;
    DXImageList.Items.Find('Rev').Draw(DXDraw.Surface, RevX,RevY,0);
    DXDraw.EndScene;[/pascal]

    but are bad cut:



    Is there any other way to make it work?

    ijcro thanks in advance for new version 1.08

    Kotai
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  7. #7

    DXDraw.Options: do3D Problems

    Please send me pure picture for test. Thanks.
    Ijcro.

  8. #8

    DXDraw.Options: do3D Problems

    You can download complete game in http://www.miniracingonline.com/descargar.php?Id=1 (13MB)

    All images (bug it happens in every image and sprites) are in MiniRacingOnline/Graficos/ and all sprites are in MiniRacingOnline/Coches

    This version is compiled with unDelphiX 1.06. You can change do3D options in MiniRacingOnline.ini, in section [Pantalla] add do3D=1 (default or not present is do3D=0)

    Code:
    [Pantalla]
    doSelectDriver=1
    doAllowReboot=1
    do3D=0
    doWaitVBlank=0
    doAllowPalette256=0
    doRetainedMode=0
    doZBuffer=0

    I upload EXE compiled with unDelphiX 1.07f : http://www.miniracingonline.com/desc...s/mro097c3.zip

    Default circuit in game is Montmelo 6700x2400 pixels, when do3D=1 you can see the bug.
    You can downlod a circuit minor than 4096 at http://www.miniracingonline.com/desc...p?Id=GPHUNGRIA 3600 x 3800 pixels, in this case the bug in the background is not shown, but in sprites and images the bug still remains. You can download a circuit minor than 2048 at http://www.miniracingonline.com/desc...p?Id=MINIIMOLA 1024 x 248 pixels in this casethe test limit texture was setup to 2048x2048 pixels

    Thanks :roll:
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  9. #9

    DXDraw.Options: do3D Problems

    Hello,

    solution for this is very simply, mu must get out lines
    Code:
    DXImageList.Items.Find('Rev').PatternHeight    := DXImageList.Items.Find('Rev').Picture.Bitmap.Height; 
    DXImageList.Items.Find('Rev').PatternWidth     := DXImageList.Items.Find('Rev').Picture.Bitmap.Width;
    Why?

    Because image is not meshed, it contain one image only! When you set up the PatternHeight and the PatternWidth property, the texture will be proceed as meshed and subimages can be stretched like code remaping subtexture via subpatterns.

    And for code clearing is better like this
    Code:
    procedure TForm1.FormCreate(Sender: TObject);
    var
      Q: TPictureCollectionItem;
    begin
      {be sure color table}
      DXImageList.Items.MakeColorTable;
      DXDraw.ColorTable := DXImageList.Items.ColorTable;
      DXDraw.DefColorTable := DXImageList.Items.ColorTable;
      DXDraw.UpdatePalette;
      {switch for easy change mode}
      HardwareSwitch := False; {initialize, start in software mode}
      {when changed can be call FormKeyDown with 'space' parameter}
    //*******************
      Q := TPictureCollectionItem(DXImageList.Items.Add);
      Q.Name := 'montmelo';
      Q.Picture.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'montmelo.dib');
      Q.Transparent := False;
      Q := TPictureCollectionItem(DXImageList.Items.Add);
      Q.Name := 'Rev';
      Q.Picture.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'Revoluciones.bmp');
      Q.TransparentColor := DXDraw.Surface.ColorMatch(Q.Picture.Bitmap.Canvas.Pixels[0,Q.PatternHeight-1]);
      Q.Transparent      := True;
      DXImageList.Items.Restore;
    //*****************
    end;
    Regards
    Ijcro.

  10. #10

    DXDraw.Options: do3D Problems

    Hi

    Deleting the lines to adjust the PatternHeight and PatternWidth doesn't solve the problem, it continues cuttin bad the edges.

    In the image 'revoluciones.bmp' I can quit the pattern but in other images there are different patterns and I have to put the size of every pattern.

    I will try tonight the ColorMatch, and I'll tell you how it goes.

    Thanks
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •