Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Weird drawing in 3D when sprites are used

Author
Message
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 19th Feb 2009 22:05
This is sort of a continuation on my post yesterday, but it's a completely different problem so I'm making a new post. I just got it so that a sprite can show up in the corner of the screen of a 3D game, and now I'm noticing that when I do this, the 3D objects are displayed really weirdly. Most notably, I'm using terrain, and all of the terrain that is more than a certain distance away is displayed with holes in it and random colors on top of it. I narrowed down the cause to this function call:



The image is a valid image, as it appears exactly the way I want it to at the top left of the screen. It looks like the act of having a sprite around though is causing the problem, since I called the function to not display the sprite after it is created and the problem is still there even though the sprite isn't visible. I also tried playing around with values of transparency and backsave, but they did nothing. I even tried the set image function followed by the paste sprite function to see if I could work around calling dbSprite, but then the sprite just didn't show up. Does anyone have any idea why this would be happening? Thanks.
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 19th Feb 2009 23:19
Here's some pictures to show what I mean. If you look off in the distance in the one with the item in the corner, it looks all weird, whereas when there's no item it looks fine.


By scott1686 at 2009-02-19


By scott1686 at 2009-02-19
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 19th Feb 2009 23:29
Do you have anti aliasing on? Its hard to tell in the screenies. If you draw sprites when anti aliasing is enabled, it disables it.
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 19th Feb 2009 23:38
Quote: "Do you have anti aliasing on? Its hard to tell in the screenies. If you draw sprites when anti aliasing is enabled, it disables it."


I'm actually not sure. How do you turn anti aliasing on or off, and what exactly does it do? Thanks.
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 19th Feb 2009 23:42 Edited at: 19th Feb 2009 23:44
anti aliasing in essence, removes all jagged edges and makes them smooth. Without it, the scene has edges that are sharp. Wikipedia explains it, for a simple explanation: look at the 3 checker board images on the page and they get more anti aliased. The one on the left is what would cause the level to "disappear" like that.
http://en.wikipedia.org/wiki/Anti-aliasing

Edit: to enable it, you would use dbSetDisplayModeAntiAlias(...), but it doesn't work if you have sprites on the screen (i wish they would fix it!)
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 19th Feb 2009 23:46
Oh ok, that makes sense. Do you know how to switch it on or off then? I've been looking through the documentation but I couldn't find any references, unless I'm just not looking in the right places.
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 20th Feb 2009 00:19
I don't think it is in the documentation (it is a new command), but you wouldn't be able to turn it on anyway due to sprites being drawn.
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 20th Feb 2009 01:16
Quote: "I don't think it is in the documentation (it is a new command), but you wouldn't be able to turn it on anyway due to sprites being drawn."


So there's no way to use anti-aliasing for the 3D objects while not using it for the sprites? Is there any other work-around to make this work? The only thing I can think of off the top of my head would be to make a cube that is glued to that area of the screen and texture it with whatever images I want to use, but that seems like a hack.
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 20th Feb 2009 11:06
Yes that would work, and there are no workarounds (yet) for it, apart from not using sprites
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 21st Feb 2009 03:15
What are the settings for your camera?

IE: what is the value for the near plane and far plane for the camera.

I am just wondering if maybe you are suffering from Z fighting when the sprite is enabled.
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 21st Feb 2009 19:01
I actually just have the default camera settings. The only thing I call that affects the camera is dbSetCameraToFollow. I changed the game around a little so that now I have a small plane that's glued to the screen in the corner, and I texture it with the images I want, so that seems to be working even though it's basically a hack. Thanks for the help everyone though.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 22nd Feb 2009 01:48
It is hard to tell from the picture, but it looks like your sky background is showing through that corrupted area of the terrain.
If that is really the case then you could make your sky dome larger in size to create a greater Z distance between the sky and that part of the terrain.

Another approach would be to use the "void dbPasteImage ( int iImage, int iX, int iY, int iTransparency )" to put the required image directly to the screen, without requiring sprites or small planes or anything. This would probably be the easiest approach of them all, and well worth a look into.
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 22nd Feb 2009 20:29
I just tried the paste image function, but it still had the weird drawing effect. I'll look into the sky box thing though, thanks.

Login to post a reply

Server time is: 2024-09-30 19:14:21
Your offset time is: 2024-09-30 19:14:21