PDA

View Full Version : Antialias - strange behavior



Nightmare_82
07-10-2004, 01:21 PM
I tested my game with the new components on two pcs. When running in fullscreen mode in Direct3D it seems that Antialias is turned off.
But when I press "Alt+Tab" to switch back to windows and return to the game antialias works.
Am I doing something wrong or is this a bug ?
Here is the main code of my inititialization:

m_oPowerDraw := TPowerDraw.Create(AOwner);
m_oImageList := TAsphyreImages.Create(AOwner);
m_oPowerDraw.Images:= m_oImageList;
m_oPowerDraw.Width := p_iScreenX;
m_oPowerDraw.Height := p_iScreenY;
m_oPowerDraw.Windowed := p_bWindowed;
m_oPowerDraw.Mode:= rmDirect3D;
m_oPowerDraw.VSync := p_bVSync;
m_oPowerDraw.BitDepth := bd16bit;
if m_oPowerDraw.VSync then
m_oPowerDraw.BackBufferCount:= 2;
Result := m_oPowerDraw.Initialize();
if (Result <> 0) then
begin
Exit;
end;
Result:= m_oPowerDraw.InitDevice();
if (Result <> 0) then
begin
Exit;
end;

But sometimes antialias works when I start the game(1 of 5 times).

Huehnerschaender
07-10-2004, 03:09 PM
High Nightmare,

I don't have such problems (I have others :-) ).
Sounds like a problem with your graphic card, because as you wrote, sometimes it works, sometimes not. What graphic card do you use? Tried it on different PCs? If you don't have any, I can test it for you on about 5 different PCs with different graphic cards if you post a link somewhere.
Have you installed latest drivers?
Maybe you have configured some settings in display-settings-advanced that cause this behaviour?

Just some ideas....

Greetings,
Dirk

LP
07-10-2004, 03:26 PM
Btw, non-related question... is there any specific reason you create the components in run-time?
As for the question, do you set Antialias property?
It can be changed as:
if (m_oPowerDraw.Device is TAsphyreDev3) then TAsphyreDev3(m_oPowerDraw.Device).Antialias:= MyAntialias;

Nightmare_82
07-10-2004, 03:33 PM
I created my own class because I want to wrap all drawing methods. When there's enough time, I want to implement another class with opengl which can be used optional.
@Lifepower: I thought that the Antialias property was removed in the new version.I'll try your code. Maybe that's the solution.

@Huehnerschaender: Both pcs have win2k. One has a geforce4MX, the other one a geforce2TS.

Here (www.cobal-handy.de/Cobal.zip) you can download a demo of my game. In the file "Cobal.ini" you can set properties like Fullscreen, BackbufferCount and VSync.(~36MB)

Huehnerschaender
07-10-2004, 04:17 PM
Hi Nightmare,

I started the game about 15 times and always antialiasing was enabled.
I just took a look at the starting page (intro).

Did you already try the setting lifepower mentioned in the last post?

I have GeForce 4 Ti installed here.
Are you interested in a test on ATI card?
I have also GeForce2 MX 200 and GeForce2 MX 400 (shared memory) PCs available.

Nightmare_82
07-10-2004, 04:31 PM
Thanks for testing. I tried the code from Lifpower, but it doesn't fix the problem.

When I start the game it looks bad:
http://www.cobal-handy.de/Bug2.jpg
When I switch to windows and back to the game you don't see the lines of the iso tiles:
http://www.cobal-handy.de/Bug1.jpg

Could you please try that ? When you push "+" you can zoom.

LP
07-10-2004, 04:49 PM
Did you check Landscape demo that comes with Asphyre? It shows isometric terrain with multiple height. Does the same problems occur there?

The lines that are missing seems to be related to the "last pixel issue" I have been struggling with in Direct3D. Due to my major attempts to make software emulator compatible with Direct3D (that is, to make sure it shows the same thing Direct3D does), there can be slight differences in lines drawn in Software Renderer and Direct3D (in the edges - there could be differences due to rounding errors). However, Direct3D resolves last pixel issue in different way Asphyre does. Did you check the same application in software mode?

Huehnerschaender
07-10-2004, 04:50 PM
You are right.
When zooming the lines appear,
switching to Desktop and back let the lines vanish but then antialiasing is off.

It seems that the settings change. Maybe lifepower can say more about this.

By the way, do you use the Pixels-property anywhere in your game? This has nothing to do with your problem, but with mine :o)

Huehnerschaender
07-10-2004, 04:54 PM
It seems that you are more satisfied with the second screenshot you posted, but in this antialiasing is OFF.
The first screenshot shows antialiasing ON and here I guess the lines appear, because of the reason why lifepower has implemented the REALSIZE property of textures.

Nightmare_82
07-10-2004, 04:55 PM
no, I never needed Pixels-property, but I could test something if you want.

LP
07-10-2004, 04:56 PM
I had no possibility to check the demo you posted (still downloading it at 100 Kb/sec)... The antialiasing seems to be a bug (and I already thought on solution)... I'll release the fix today in several hours...
EDIT 1: noticed that antialiasing "works" (On or Off?) 1 of 5 times when the application starts... THIS problem doesn't seem to be related to Asphyre - antialiasing is set every time you "InitDevice".
EDIT 2: I've checked your demo, noticed some faults with sprites (I think you SHOULD check the RealSize property for this), besides the application switched full-screen and windowed mode several times here - the screen blinked for a while... I'm not sure what you do but it appears that you either initialize the screen several times or switch "Windowed" property in run-time, when PowerDraw is initialized, several times or so... Application took some time to run here but since I could not understand the language well, when I selected first menu - it exited :(

Huehnerschaender
07-10-2004, 05:03 PM
Nightmare,

could you please download this little sample and test if it runs showing the framerate on your PC?

http://www.asigermany.de/works.zip

That would be very kind.

Nightmare_82
07-10-2004, 05:08 PM
It seems that you are more satisfied with the second screenshot you posted, but in this antialiasing is OFF.
The first screenshot shows antialiasing ON and here I guess the lines appear, because of the reason why lifepower has implemented the REALSIZE property of textures.
You're right. Sorry, I thought the screenshot with the lines would be without Antialias.. I only looked at the lines. What does the REALSIZE property ?

I'll test your example now.

@Lifepower: thanks for your hints. I'll take a look at my code. You have to choose the secound point to start the game.

Huehnerschaender
07-10-2004, 05:15 PM
A texture has a size, lets say 256*256.

Realsize means, that if you set it to 254*254 the engine will show/render the image without the left, right, top and bottom line of the picture.
This sounds weird, but when using antialiase the "blurring" of the image reads pixels next to the pixel it is rendering in all directions and calculates middle values. The pixels on the borders have no "neighbours" and so black is assumed as pixel on the concerning side. Thats why you get the black border.

This is only my understanding of Realsize. I guess Lifepower can tell you if I am right or not :lol:

EDIT: Another hint. I examined your vtdb and as I can see you use texture sizes up to 1024*1024.
These are not supported by older graphic cards. So if you want your game as compatible as possible you have to tile your textures in pieces of 256*256 at maximum. I posted a topic here related to this and other users told me that because as I used bigger textures and textures of non power of 2 (eg 800*600) they were not shown on different graphic cards.

Nightmare_82
07-10-2004, 05:25 PM
OK, I'll try that.
I tested your program. It runs well. the color value is : 4026531840 and the caption says "NO ERROR".
I have a gefore4MX and win2k.

Huehnerschaender
07-10-2004, 05:30 PM
Aha, thank you... And the framerate is shown too?
You have NVidia Card installed... which version of driver do you use? Latest Detonator (61.77)?

Nightmare_82
07-10-2004, 05:34 PM
yes 61.77.
But the framerate is always 0.

Huehnerschaender
07-10-2004, 05:36 PM
When framerate is 0 then you have the same problem. The program hang up!!!! You can see it when moving the windows out of screen and bring it back it is not repainted.
Thanks for testing this.

LP
07-10-2004, 05:44 PM
The problem with mentioned example is probably related to Nvidia Hardware. On ATI this example works perfectly. But on Nvidia cards, "Present" method in Direct3D returns "D3DERR_DRIVERINTERNALERROR". Manual explains:
"If D3DERR_DRIVERINTERNALERROR happens during 3-D rendering, the runtime returns it at the IDirect3DDevice9::Present call. The application can do one of the following:
End, with the pop-up window saying that the application cannot continue because of problems in the display adapter and that the user should contact the adapter manufacturer.
Attempt to restart by calling IDirect3DDevice9::Reset, which is essentially the same path as recovering from a lost device. If IDirect3DDevice9::Reset fails with D3DERR_DRIVERINTERNALERROR, the application should end immediately with the message that the user should contact the adapter manufacturer." Oh well... :(

Huehnerschaender
07-10-2004, 05:48 PM
I have ATI card in my laptop and this one creates bluescreen and reboots.
So it works not on all ATI-cards!

Hanging up is one thing, bluescreen should never happen. :(

EDIT: I have a PC with Win2000 and NVidia Card (GeForce 2 MX 400) and this is the only PC I can get it work. The driver is the same as on the other PCs. (61.77 This one is for XP AND 2000)

LP
07-10-2004, 09:37 PM
Well, this issue is probably the most difficult one. "Internal Driver Error" - that's the worst feedback Direct3D can give me!! :( Still checking manuals and stuff...

Huehnerschaender
07-10-2004, 09:49 PM
Yeah, that's really bad. I hope you will find something.
Remember that the Pixels-property worked well in PowerDraw3pre with same hardware and also DirectX 9.0c installed. If you access the Pixels the same way it could be a bug in your coding. If you do it another way maybe it's within drivers or DirectX.

LP
07-10-2004, 10:08 PM
I've updated the sources - it should fix some issues related to antialiasing (now it's updated whetever you change the video device, use Alt+TAB or switch between full-screen and windowed mode).
Check it on http://turbo.gamedev.net/asphyre.asp