Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Does anybody know why this looks so screwy?  (Read 1800 times)
0 Members and 1 Guest are viewing this topic.
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Posted 2003-02-11 20:06:32 »



...and hopefully, what to do about it?
(the strange, blocky edges)

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #1 - Posted 2003-02-11 20:34:39 »

You mean the blocky edges of the buildings? It looks like z-fighting to me (although strangely regular). Basically you're lacking precision in your z-buffer.

You can switch from a 16bit depth buffer to a 24 or 32bit one, which will give you more range. On the other hand, that won't help people with voodoo cards etc. So what you need to do is reduce the distance between your near and far clipping planes. Since the z-buffer is logarithmic, most of the precision is used close to the camera - so first try pushing your near plane out a little. Often people will set this to something like 0.1 when 1 is much more useful and nigh-on identical (or worse, your near plane is at 0, but you'd probably have seen weird happenings before now already).

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Online princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2003-02-11 21:14:45 »

The near plane can probably be set much higher than that even - 100 or more. And the far plane can be much closer too - 20000, 30000 perhaps? And stick a little fog in as well to prevent buildings from popping into existence.

And bloody mouse control!!!! I HATE using the keyboard!

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #3 - Posted 2003-02-11 21:21:44 »

Thanks, that was it  Cheesy

My near plane was 0.1 and I put it at 1.
My far plane was at 2500 and I kept it there.

But erm, regarding fog, I thought about that but would I still be able to see the background?

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #4 - Posted 2003-02-11 22:09:42 »

Fog and skyboxes/skydomes etc. don't tend to work well together Sad On the other hand, since you've got a pretty fixed view you can make use of that.. You could add a black skyline to the background image slightly above where the buildings pop-up and put some black fog on the buildings. Or you could put some simple LOD in to reduce buildings to an untextured quad in the distance, and keep drawing them much further.

Theres a 'proper' way of doing good fog+sky, which is something like:
- draw all landscape into just the depth buffer to get the visibility info.
- Draw the background without any depth testing.
- draw all the landscape again, but with the fog setup to affect the transparency instead of a colour.

This way, you get the landscape fading into view from out of the sky Grin Look really good and probably worth it in this case..

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #5 - Posted 2003-02-12 08:39:57 »

Quote
Theres a 'proper' way of doing good fog+sky, which is something like:
- draw all landscape into just the depth buffer to get the visibility info.
- Draw the background without any depth testing.
- draw all the landscape again, but with the fog setup to affect the transparency instead of a colour.



What is the first render run good for? Where is that visibility evaluated?

For 'normal' fog you can

- render the skybox/dome w/o writing z-buffer
- render the fogged scene.

This way the skybox won't be fogged out??

For Java3D btw, the Background node does a pretty good job for skybox rendering.




HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #6 - Posted 2003-02-12 09:05:27 »

Unfortunartly, your method causes ugly poping of the landscape when it becomes visible for the first time - which kinda defeats the point of the fog in the first place Shocked

The first drawing pass is needed to get a perfect depth buffer for use when drawing the landscape for the second time. Because the landscape is drawn with transparency only the visible pixels should be drawn, this correctly fades everything into the background, and you dont get any popup Smiley

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #7 - Posted 2003-02-12 10:20:43 »

Still hard to see, but I have an imagination....

If the scene itself contains transparent things, they still have to be sorted out an rendered regardless of the existing depth info I suppose?

For our case here, the fog itself prohibits anything from popping up into the scene. But it'S white, not alpha.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Online princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2003-02-12 11:15:49 »

Hm, now I think of it I couldn't get fog to write alpha values out. But yes, the way to do it is to actually have your background graphic fade at the bottom to the fog colour. In the terrain demo I had brown mountains on the horizon and my fog was brown, and that worked quite well, although the horizon was rarely visible.

Cas Smiley

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #9 - Posted 2003-02-12 14:59:39 »

Yes, we have white fog and a skybox being white at the horizon.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #10 - Posted 2003-02-12 15:21:24 »

So do you get any visual poping with skyscrapers etc., or is the landscape low enough to avoid that?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #11 - Posted 2003-02-12 16:01:59 »

Ahhhhhhhhhhhh - now I begin to understand where the problem really is ...... a fog-colored object popping in against a dark sky or so....

Yes, I'm sure they would pop in. You're right. Fortunately, no skyscrapers and our fog is >4km away Smiley

You can see the effect e.g. in BF1942 with fog-colored planes in the skies...

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #12 - Posted 2003-02-13 07:05:09 »

But what about things floating in the sky? I don't want them to be fogged. Would look awful I suppose against a clear background.
Maybe height fogged so that only the surface is fogged?

(BTW that low 41fps in the screenshot (it actually got even lower sometimes) is fixed by a quick sort. Just so that you know  Wink. Don't you just hate low framerates?  Grin)

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!