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.

DarkBASIC Professional Discussion / Problem when reloading Advanced Lighting Terrain

Author
Message
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2016 03:32
When trying to delete and load a different terrain with the advanced lighting of evolved I have weird artifacts, the terrain is not reflected correctly somehow on the water (you can notice it when you are close to the water level and not on high altitudes).
This is what I call to remove and reload a new terrain:

Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2016 17:00 Edited at: 3rd Apr 2016 17:02
Here I have attached the screeshots that show the problem.

If you want to test the behaviour just add these lines on the advanced lighting default project (after Terrain_SetTexture(25,26,27,28,29))

Attachments

Login to view attachments
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2016 23:01
I have been able to find a workaround by commenting the shader functions on the Terrain_Delete() function:



I don't know if this will break something somewhere but everything seems to be fine even deleting and reloading the terrain like 10 times.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Apr 2016 12:08
Interesting find. Have you posted this on Evolved's site? He might be able to explain what's going on.


Powered by Free Banners
James H
17
Years of Service
Recently Online
Joined: 21st Apr 2007
Location: St Helens
Posted: 4th Apr 2016 12:59
It kind of looks like the same shader info is being reloaded into the same slots, iirc I had issues once undimming stuff unless I called empty array first
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Apr 2016 15:54
Posting that on the Evolved site is just plain useless, nobody is looking there not even Evolved himself.
I have emailed him a few months ago asking for a solution of the black screen problem on resolutions higher than 1024x768, but he never replied, so I think he doesn't care about it and won't make any updates, sadly.
I am still looking for a solution for that problem.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 4th Apr 2016 20:23
Nice find, thanks
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Apr 2016 21:27
You are welcome
James H
17
Years of Service
Recently Online
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Apr 2016 00:52
Hate to be the bearer of bad news but doing as you suggest did not work for me
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 5th Apr 2016 01:17
Did you try with the default project or you have changed something somewhere?
James H
17
Years of Service
Recently Online
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Apr 2016 10:28
The default project with just your changes, the additional four lines after Terrain_SetTexture in the main source and of course remming out the two lines in the Terrain_Delete function
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 5th Apr 2016 14:43
The lines to rem are 3, look better at the code posted above.
James H
17
Years of Service
Recently Online
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Apr 2016 14:50
Ah I see, will check it out later thanks,
Quote: " look better at the code"

You know being sarcastic when folk are looking to help you out really isn't appreciated, that's the kind of attitude that won't get you help in future
James H
17
Years of Service
Recently Online
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Apr 2016 18:27 Edited at: 5th Apr 2016 18:36
Apologies for the double post but it was a number of hours in between so this is for the purpose of those with mail-back enabled - only one of those lines needs remming out, the one relating to deleting shaders. As I recall there was a known bug where a video memory leak occurs when deleting shaders which is what I think this issue relates to.

Edit: as discussed on one of your threads https://forum.thegamecreators.com/thread/214408
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 6th Apr 2016 01:58
I was not sarcastic at all, was just trying to point you on the code as you told me you remmed 2 lines while the lines to rem are 3. (at least in my test, I didn't continue with other tests to see if 1 or 2 rems could be enough as with 3 everything was working fine without any problem)
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Apr 2016 09:16
Do these artifacts move when the camera moves... can you get a camera angle that makes them disappear?

Reason I ask is they look exactly the same as some artifacts I have in my engine, but that is caused by a camera going under the terrain, and the camera render clip commands seem to be ignored. I suggest checking the camera render images, like 1,2,3 on the keyboard to paste the image. Look for the artifacts in the camera renders. Of course, that might be a bit difficult if you're using cube maps, maybe apply the cube map to a standard cube so you can see the pure render. I'd bet that it's caused by a camera rendering under the terrain, most likely the reflection camera.

Of course this doesn't help you fix the problem, I'm still trying to come up with a workaround for weird render issues. Personally, I'm thinking ray cast from camera to first intersection of terrain, and set the near camera range to that - so the camera kinda pushes forward through the terrain, but only with the render range. I think that will work, worth a shot at least if it gets rid of those artifacts.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 6th Apr 2016 17:21
Yes it seemed like the reflection camera was positioned bad, I suspect an height problem, if you are with the camera above a certain level in the sky everything is reflected correctly (or at least it seems to be), if you go down that level you start to see the artifacts, the reflections seems to be darker and with artifacts.
James H
17
Years of Service
Recently Online
Joined: 21st Apr 2007
Location: St Helens
Posted: 7th Apr 2016 22:01
Quote: "I was not sarcastic"

Okay, sorry for saying you was

Quote: "black screen problem on resolutions higher than 1024x768"

I have recently realised I can set the resolution to any that appears available in the drop down list from the properties window, anything else gives me a black screen
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 8th Apr 2016 01:57
I don't know how could be possible but testing a game I have made a few months ago now 1280x720 resolution is working, while before I had a black screen, if I try the default project I have the screen cutted (screenshot attached).

Attachments

Login to view attachments
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 8th Apr 2016 18:05 Edited at: 8th Apr 2016 18:20
I've had that issue before.

It happened at random resolutions and only on certain machines. other machines at the same resolutions had no issues, or had issues at other resolutions. When this happens, it cuts off anything beyond 1023px in screen width.





What resolved it for me was this:

me wrote: "it is the shadow map size parameter of directional light create when set to 1024 I get the error of I drop it to 512 every thing works normally on all resolutions. now at least I have a starting point to go diving through the AL and shader code. to see why some can handle 1024 shadow maps and others can't, seemingly at random."


I have not yet had a chance to dig further into the AL and shader code to determine what goes wrong specifically.

Here are some posts detailing my experience with the isssue, testing done, and the result:

https://forum.thegamecreators.com/thread/211983?page=2#msg2540789 <- your resolution of 1280x720 is in the list of problem resolutions on this post

https://forum.thegamecreators.com/thread/211983?page=2#msg2541880

https://forum.thegamecreators.com/thread/211983?page=2#msg2541914

https://forum.thegamecreators.com/thread/211983?page=2#msg2542017
wattywatts
14
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 8th Apr 2016 18:51
@Ortu I'm pretty sure it has to do with the shadow map size exceeding the screen height.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 8th Apr 2016 18:54 Edited at: 8th Apr 2016 19:05
The shadow map size parameter does not make any difference on my system.
I am still trying to figure out why a game I have made with AL is working fine using both nvidia gt635m or intel hd 4000 (my laptop has 2 graphic cards) while if I try the default project I get or a black screen with the nvidia or the screen cutted (like in the screenshot) using the intel hd 4000. (both tested on 1280x720).
I have also tried to paste the include and shaders directory (just in case I forgot that I have changed something) from the game folder into the default project, but that did not make any difference, the code is the same so is very weird.

Edit: Nevermind, even the game is cutted when I set it to 1024. But with 512 it works fine while the default project is still or black (with nvidia) or cutted (with hd 4000)
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 8th Apr 2016 18:58
Quote: "@Ortu I'm pretty sure it has to do with the shadow map size exceeding the screen height."


That would make sense except that smaller resolutions like 800x600 work fine at 1024 shadow map

Login to post a reply

Server time is: 2024-04-27 05:48:34
Your offset time is: 2024-04-27 05:48:34