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.

Author
Message
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Dec 2014 07:15
If i try to move a water plane slowly up and down to simulate the water moving on the shore, the water plane and the beach mesh have some z fighting that looks really bad instead of looking "smooth", is this normal in darkbasic pro or there s a way to fix it?
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 12th Dec 2014 07:22
Try playing around with your camera range. There is a sweet spot in the values for near and far ranges depending on the scale of your world and objects.

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Dec 2014 07:51
I use "set camera range 1,1000000", that because if i lower the maximum value the skysphere will not be rendered, also is an Island the main space so its not a problem being that high (for lower graphic settings i use to lower it and to shrink the skysphere though)
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 12th Dec 2014 08:17
that's a pretty crazy max range, the default is something like 3000 I think, though I usually use 1, 64000 as this is what AL is configured around.

Try reducing the max range and see if the z-fighting stops, if so, just use the lower value and scale down the sky-sphere as needed.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Dec 2014 12:24
Yes, such a large camera range is bound to cause significant loss of accuracy when trying to compare two z values which are close together as in your shoreline example. Ortu's suggestion should work.



Powered by Free Banners
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 12th Dec 2014 15:08 Edited at: 12th Dec 2014 15:10
I find my skyboxes/skyspheres look a lot crisper when I disable the objects zwrite and make the object size around 10 units. This way you don't need to set the cameras range so far.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Dec 2014 17:50
The problem is that my game is already in a good point of development, i am working on it since 4 months ago, scaling the Whole thing down it's an unduable thing because i need to recalculate the position of too many objects, also recalculate all the collisions i have made so far (static collisions).
When i started to build the game i ve chosen long sizes for everything to avoid the artifact when you are too close to an object, not rendering it completely (even with minimum range camera set to 1), i didn't know about the problem of making everything so big, otherwise i would started to use medium sizes for everything.

The main Island is aproximately big 12000 points wide and 24000 points long (for example from coordinate x -6000 to 6000 wide), but i have made the water very big to make it more realistic, otherwise it would seem too "curvy" (don't know how to explain), i mean making the water very big when you look at the end of the sea it is almost straight, like in real life, while if your water and skysphere is too small it will be not straight at all making you to feel inside a sphere instead of a world
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 12th Dec 2014 18:23
I'm not saying scale everything down. By disabling the skyspheres zwrite it will look the same if not better at a lower scale. It will show even though other objects are larger. Since you say this is the reason for making the camera range so large, you can now lower it.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Dec 2014 19:01
I don't know what zwrite command do, by the way i think you have not understood why i use such a large skysphere, i use it so large to make the world more realistic, the bigger the skysphere, the more straight is the horizon line where sea and sky meet, if the skysphere is not that big, you will notice that that horizon is not straight, so unrealistic
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 12th Dec 2014 20:49
Hate to say it but sometimes compromises have to be made. You may have to decide which is worse, z fighting or a curved horizon. If you are not willing to make the changes needed to fix a problem, you may have to live with the problem.

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Dec 2014 21:24
I have made some test, changing the maximum range will not affect in any way the problem, having it to 1 million or to 10k it's the same, i ve noticed that the problem get fixed by raising the minimum value, which i had to 1, and now i set to 5 (setting to 10 was not showing me some polygons when i was close to some objects).
By the way i think i ve reached a good compromise now, i am not having problems when coming closer to some objects, and the water issue is almost gone. I have also lowered the maximum value from 1 million to 300k because i see that more than than it's just useless.
Thank you by the way one of my problems has been fixed, but be aware, many others are coming lol
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 12th Dec 2014 22:20
I'm no trying to twist your arm. I think if you would just try it you'll notice what I’m getting at. Maybe this little demo will illustrate the affect of disabling zwrite better. Here I’m using a 10x10x10 skybox and a plane 1000x1000. The camera height is set at 30. Without disabling the zwrite on the skybox the plane would not be visible. Try it, media attached.

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Dec 2014 23:11
ok i tried it but i do not know how could that be usefull in my case, in my game it s not the ground the problem but the skybox being too far (however it's not even a problem as i see that the maximum range does not affect the water issue at all)
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 13th Dec 2014 00:04 Edited at: 13th Dec 2014 00:05
Quote: "in my game it s not the ground the problem but the skybox being too far"


That is what i'm trying to convey. The skybox does not need to be so large.
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 13th Dec 2014 00:05
The idea is that you can render your skybox / skysphere / what-have-you as much smaller and closer to the camera; by disabling it's z-read it will overwrite anything that should really be drawn in front of it (things that are drawn in front of it after the sky object will still be drawn on top of it however), and by disabling z-write it will not register its own depth in screen space for other objects to read, thus making any other objects draw on top of the sky no matter its actual size and position.

I don't know if it is particularly safe to use with DBPro though since you cannot really guarantee what object will be drawn first if I recall correctly.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Dec 2014 12:32
Quote: "I don't know if it is particularly safe to use with DBPro though since you cannot really guarantee what object will be drawn first if I recall correctly."


That would be my concern too. I have seen a set of guidelines to follow somewhere here - but they are not intuitive and I'd need to check them every time which is a pain. Simpler to avoid that solution in DBPro I suspect.

But it's a nice idea if you have the energy to search for the guidance rules about rendering order.



Powered by Free Banners
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 13th Dec 2014 17:45
Thanks, Green Gandalf and Rudolpho. Looks like what I suggested here could cause one to loose their hair if not prepared to deal with the consequences. I have modified a few old source examples and found two issues so far. When doing this with instanced objects with transparencies, the transparency needs to be set for each individual object. If using a matrix terrain it will not show. I will continue to use this for skyboxes, it looks so much crisper. But thanks to you guys, I’m more aware of what I’m dealing with.
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 14th Dec 2014 22:07
The 1,1000000 camera range issue has been raised; and indeed

Quote: "such a large camera range is bound to cause significant loss of accuracy"


It would be a shame if it were too difficult to reduce the unit size of your game world...

With DBP's use of single precision floating point math, that is 7 points of precision (be it 9.999999 or 9999999); your camera range is 7 digits long, any coordinates using a decimal point is going to be inaccurate for rendering and other aspects of your game such as the physics.

Quote: "When i started to build the game i ve chosen long sizes for everything to avoid the artifact when you are too close to an object"


What was the camera range setting you used? Have you tried lowering the near parameter to something below 1.0?

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 14th Dec 2014 22:39
I thought minimum value would be 1, by the way now that problem has almost been fixed for me is fine how it is, maybe for next project i will start with smaller objects but for this one definitely it's not Worth rebuild everything which have taken 4 months of my time (time is precious, better don't waste time for useless details or the project will never be released, i am at 11k lines of code right now and i think i am not even at 50% of the game built)
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 14th Dec 2014 23:44
Quote: "definitely it's not Worth rebuild everything which have taken 4 months of my time"

All you need to do is reduce the size and distances of your 3d models accordingly.
You can even do this directly from DBPro using the scale object function, eliminating the need to re-export your resized meshes. As said you would have to also update any positional data as well as movement velocities etc.

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 14th Dec 2014 23:57
Shrinking every object will need a reposition of all of them, plus recalculating all the static collision of the entire game, and other things such as events that happens in specific positions, for example automatic doors, belive me, its a huge load of work, you made it simple but it's not, also, i have no reason at all to waste time for that as I have already fixed the "water issue" problem, which wasn't even a big problem but a little detail, having these objects so big now are not giving me any kind of problem, so no reason to waste precious time, i want to release my game before summer or at least before next Christmas, I am willing to sale it on steam (if they accept it, but as games such as grass simulator has been released, i don't think will be a problem).

I work several hours a day on this game, almost every day of the week, it's in a good point of development, but i still have a lot to do, time isn't unlimited, if you make a medium-big project Optimizing your time is the most important thing, otherwise you will give it up after some time, as most people who start them actually do
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 15th Dec 2014 05:48
Sounds like you are a good ways into it now, why not post a thread in the Work in Progress board?

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 15th Dec 2014 06:29 Edited at: 15th Dec 2014 06:37
hehe you know nowdays the risk that someone copies your idea it's huge, maybe i will make a post when it will be completed.

PS:

By the way some people could think i am noob because they see the registration date that is just 3 months ago, but i started to work with the basic Language around 12 years ago (don't remember exactly) when i bought the cd of dark basic classic, at that time i was very Young (like 13 years), but i ve made some decent games, which i have lost because i changed computer and didn't made any backup, but i still have a 3d chess game 10x10 grid which i completed only for the single player, didn't made the multiplayer because of the server costs and the further Language to know for the server side code.
The game i am developing now is single player too but maybe in the future i could implement the multiplayer mode, who knows, another thing that keep me away from making multiplayer games are the cheaters, if even AAA titles like battlefield 4 can't take them away, how can i think of doing that? impossible, cheaters will ruin completely the multiplayer mode making any effort and server costs useless

Login to post a reply

Server time is: 2026-07-05 16:49:53
Your offset time is: 2026-07-05 16:49:53