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 / Beware of the Set Display Mode command!

Author
Message
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 31st Mar 2013 20:31
Please people, watch out!! Something fishy is up with this command. I've spotted some strange, strange things with this command over the past year. Most of us know that its multi-sampling parameter doesn't work, and using this command will wipe away all your objects and textures; which isn't bad for level unloading ; but it also screws up full screen shaders and it slows down Spark particles according to tests in my game engine.

It became the least suspected cause for a series fuzzy shader glitches and slow particle performance; but eventually the cause was found.

Anyone else spotted anything suspicious with it?

Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 1st Apr 2013 05:34
Hmm didn't know it does this.

Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 1st Apr 2013 06:04 Edited at: 1st Apr 2013 06:05
Quote: " Most of us know that its multi-sampling parameter doesn't work"


I've always found it to work just fine, I can't speak to the shaders/particles conflict, though I have used it with some admittedly limited testing of evolved's shaders and haven't noticed any issues. As far as antialiasing, you can see a noticeable difference between multisample 0 and multisample 4. Not a lot of difference beyond that though and no real reason to ever set it higher than x8 that I've seen. I typically use x4 as a good balance between cost/result.



Attachments

Login to view attachments
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 1st Apr 2013 12:01 Edited at: 1st Apr 2013 12:03
Yeah I see your point but it's all well and good if you do not want to use screen shaders and release a game with display mode changes and anti-aliasing as well...

Something is conflicting with it. Even with a minimal Dark Shader source export; setting the display mode shows this:



I don't think I'm allowed to upload the media for this project, but here is the source which reproduces the problem I experience in my game engine.



This issue is the same one two seperate PCs.

Dark Shader can set its display resolution and apply the shader with no issue, but I can't do the same thing in the engine. This problem is the same with all screen shaders; pasted by image or drawn with the quad.

Quel
15
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 1st Apr 2013 13:22
Isn't the case is that multisampling only works with NVidia cards or something? Because i tried it on multiple, non NVidia, machines, and there wasn't any antialiasing.

Whatever the case is, If there is going to be a DB Elite, they should drop this NVidia love TGC seem to have.

Beware, beware... what if a game needs resolution settings for it?... (what game doesn't?)
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 1st Apr 2013 13:55 Edited at: 1st Apr 2013 13:56
Lol; and ironically both my GPU's are NVidia based; (which gave me the idea to test it on my AMD GPU on my laptop.)

I forgot to mention; even without the multisampling setting with the vanilla display command it still conflicts with screen shaders.

Duke E
15
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 1st Apr 2013 13:58 Edited at: 1st Apr 2013 14:06
Supersampling is an internal screen resolution enhancement.



The picture shows the normal "blue" screen, and the "red" the supersampled internal screen resolution.
The red supersampeled area is then shrunk down to the normal screen resolution when the frame is drawn. The effect is less jagged edges similar to antialiasing.

It can be done in fullscreen shaders without altering the "Set Display Mode" parameters, by enlarging the shaders rendertarget size.

(From a popular bloomshader by Mark Blosser)


Edit: It can be costly performance wise, I have not looked in to the techniques used for "real" antialiasing but i suspect those methods are less costly.

Regards

Attachments

Login to view attachments
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 1st Apr 2013 17:41 Edited at: 1st Apr 2013 17:45
Your right; I'm already using that method in my bloom shader. Thanks for that idea; I doubt it will be laggy, resolution size isn't much of an issue for modern hardware.

I might also try using the quad again, and play around with filtering.

I will still need to find a better way of switching display modes without having to compile an EXE for each and every display format.

Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 1st Apr 2013 21:46
you could save user selection to a config.ini file to load up when the program starts, when they change it which typically isnt often, save it out and relaunch

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 1st Apr 2013 23:31
You mean relaunch the same EXE? Still won't work; Set Display Mode would still have to be executed which will screw up screen shaders and certain particles.

If you mean launch a selected EXE in the INI file with a fixed display mode; that would have to do for now, but that means 100mb worth of exe files.

thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 2nd Apr 2013 03:18 Edited at: 2nd Apr 2013 03:19
This is slightly off-topic; but if anyone wants a relatively simple way to "fake" anti-aliasing, you can accomplish this with one camera and Image Kit. This is the process I use:
-Set the camera to an image that is larger than the screen by a set factor (for example 1.5x, 2x the screen, 4x the screen)
-Use the Ik Set Filters command to turn on Linear interpolation
-Paste the image to the screen size with IK Paste Image

Results:


This has a small performance hit on my computer, drops a 320 fps program down to 280 so roughly 40 fps but it's an interesting trick.

Attachments

Login to view attachments
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 2nd Apr 2013 03:55
Quote: "Set Display Mode would still have to be executed which will screw up screen shaders and certain particles."


well i was talking about

Quote: "I will still need to find a better way of switching display modes without having to compile an EXE for each and every display format."


which is a separate issue from any performance conflicts in the command.

yes, i meant relaunch the same exe where the display values are variable read from the config

Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 2nd Apr 2013 05:39
Quote: "I don't think I'm allowed to upload the media for this project, but here is the source which reproduces the problem I experience in my game engine.
"


Try adding "Reload Display Pointer" after your "Set Display Mode".


Sean

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 2nd Apr 2013 12:42
Quote: "Try adding "Reload Display Pointer" after your "Set Display Mode"."


You're great Hockeykid. I've not used this command before, one of those undocumented commands. It fixes the display mode function, but I cannot use multisampling. So as long as I leave anti-aliasing off it all works, and the particles do not slow down either.

Quote: "a relatively simple way to "fake" anti-aliasing, you can accomplish this with one camera and Image Kit"


Sounds like the easiest way, thanks. I will give it a go.

Quote: "Quote: "Set Display Mode would still have to be executed which will screw up screen shaders and certain particles."

well i was talking about

Quote: "I will still need to find a better way of switching display modes without having to compile an EXE for each and every display format."

which is a separate issue from any performance conflicts in the command.

yes, i meant relaunch the same exe where the display values are variable read from the config"


Huh?? OK I didn't know that.

Login to post a reply

Server time is: 2024-05-17 09:58:04
Your offset time is: 2024-05-17 09:58:04