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 / Anisotropic filtering problem

Author
Message
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2015 04:58 Edited at: 3rd Apr 2015 04:59
Hi, I am testing this anisotropic filtering:

http://forum.thegamecreators.com/?m=forum_view&t=159383&b=5

I see no difference when i try to change the filter value with the command KD SetAnisotropy (2,4,8 or 16), it is Always the same and eat A LOT of fps, any workaround?
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Apr 2015 05:54
Have you made sure that in your graphics control panel the anisotropic option is not off? I have nvidia card and if I have it set to off in control panel the dll did not work for me(last tested probably more than 2 or 3 years ago - maybe even when it was made available). Neither did it work if I set the option to 2x, 4x etc but only when I set the option to application controlled did it work from what I can remember.
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2015 06:28
it works but i can't change the multiplier, 2x up to 16x i got the same, also there would not be a huge framedrop if wasn't available.
I found that using set object filter ObjectNum,2 does the same effect without a huge framedrop, how is that possible?
WickedX
16
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 3rd Apr 2015 06:59
DarkBasic Professional dll’s and Dark GDK libraries are built from the same source. With that said, I dealt with the issue of Anisotropic Filtering in my Dark GDK update. You can read the discussion concerning this here; http://forum.thegamecreators.com/?m=forum_view&t=209827&b=22&p=2. Basically the multiplier is being set to the maximum allowed internally before rendering.
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2015 07:05
I ve readed the last page but didn't find a fix, how can I set it to not be the maximum value (x16) of anisotropic filtering?
also, set object filter ObjectNum,2 does an anisotropic filtering? if yes, with how many multipliers?
WickedX
16
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 3rd Apr 2015 07:15 Edited at: 3rd Apr 2015 07:19
Even if you changed the maximum anisotropic filtering level DarkBasic will internally change it back to the maximum allowed.

Quote: "set object filter ObjectNum,2 does an anisotropic filtering? if yes, with how many multipliers?"


Yes, it does the same. The maximum allowed by your video card.

Edit: To change this behavior would require a modification to the DarkBasic dll source.
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Apr 2015 07:23 Edited at: 3rd Apr 2015 07:40
Ok, have you read the entire thread linked in your first post? I ask this because your question about set object filter was raised and explained in full in that thread. Did you check your control panel? You should go through that thread in detail, its only 2 pages, do everything methodically then provide the code in your next post of each case you are witnessing with screenshots, ie no AF applied - screenshot plus code, 2x AF applied, screenshot plus code - also detail what graphics card/integrated graphics you have. The issues you experience sound very similar to some of those raised in that thread.

Edit: Didnt realise WickedX posted;
Quote: "set object filter ObjectNum,2 does an anisotropic filtering? if yes, with how many multipliers?"

Quote: "Yes, it does the same. The maximum allowed by your video card"

Yet from the thread the dll is made available;
Quote: "This might mean that internally mode 2 (linear) might be actually a real anisotropic filter?"

Yet, after some explanation kaedroho states;
Quote: "As I just said, I just checked it and its not"

So which one is correct? I suspect kaedroho purely because a) dbp help files, although not always up to scratch, makes no mention of AF and I feel that even the help files would make a mention of something this significant b)the explanation already given on that thread and c) kaedroho was the one who made it
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2015 07:33
On my control panel the anisotropic filter is handled by the application (looking on the nvidia panel control), I have a nvidia gt635m, although i have also a intel hd4000, that for some reasons performs better than the gt635m in some games, like the one I am making (not in some like battlefield where the nvidia card performs way better)

if set object filter ObjectNum,2 does the maximum anisotropic filtering, may I know why it has a very low impact compared to the plugin i linked?

For example in the demo i tried it goes down from 276 fps to 216 using set object filter, but using the plugin it goes down to 56 frames, that is a huge difference and the result is exactly the same.

I have also tried to change the anisotropic filter amount using keyboard Keys to change them directly ingame so that i can see the differences, there is absolutely no difference setting it to 2x or 16x, it simply doesn't work
WickedX
16
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 3rd Apr 2015 08:17 Edited at: 3rd Apr 2015 08:23
Internally DBPro adds 1 to the filter value passed to Set Object Filter ObjectNum, 2. 2+1=3: as you can see passing a filter value of 2 is a anisotropic filter. Have you read the help on this function, nothing makes sense there.

D3DTEXTUREFILTERTYPE:
D3DTEXF_NONE = 0
D3DTEXF_POINT = 1
D3DTEXF_LINEAR = 2
D3DTEXF_ANISOTROPIC = 3
D3DTEXF_PYRAMIDALQUAD = 6
D3DTEXF_GAUSSIANQUAD = 7
D3DTEXF_CONVOLUTIONMONO = 8
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2015 08:20
is there no way to chose between 2x,4x,8x,16x?
WickedX
16
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 3rd Apr 2015 08:35 Edited at: 3rd Apr 2015 08:37
I have been working on the Dark GDK update for quite a while and have become very familiar with the source. I know exactly what the function Set Object Filter does. Unfortunately, without modifying the source as I've done in Dark GDK, there is no way to set the anisotropic level.
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Apr 2015 09:57 Edited at: 3rd Apr 2015 09:57
WickedX What you state appears to be true on first look of the demo code along with some minor testing; my response was prior to running the demo and was based on the information presented; having read through the linked thread in the first post and of course my memory of when I last used it as stated.

Indeed it looks like mode 2 is in fact mode 3 and whether you use the filter command or the plugin they do appear to be using the maximum available level on the graphics card. Will give this more thought as a simple plain at a fixed distance with whatever resolution used for either texture or screen may hold some bearing here?(ie not a suitable test) I am somewhat tired right now so to progress any further would be foolish of me!

I have read the help on msdn and have almost always found the help confusing as I only know dbp, I use it sometimes to work out some settings in shaders like specifying the maxmiplevel in sampler state for example as I couldn't find it in dark shader help and didnt want to produce textures of different sizes if I wanted to lower the quality for performance, but still have the option to go as high as was needed based on users making a choice. In fact having looked again (as you prompted me to!) I noticed that there is a maxanisotropy for the sampler state so perhaps control in dbp for changing anisotropic levels would be through setting the sampler state in shaders, although it would have been nice if this dll had worked. Having said that I am looking at how old it is and wondering if it works for a specific upgrade of dbp. It came out not long after U7.7 release candidates so theres every chance it works on 7.61 or 7.62 - when the patch for blitzwerks was introduced or maybe 1 or more of the u7 releases(there are a few) - or even earlier, I only think it will be around that time because blitzwerks is also a plugin by kaedroho if I'm not mistaken. I`m currently using 7.7rc7.

I only think along these lines as to me its absurd that in all the time that thread was not locked and given a good number of users reported it working(some who I feel would have tested it thoroughly) that nobody came with any solid proof, I just can't see that at no point did it not work. I get the feeling different users were perhaps using different upgrades as that seems very feasible to me hence why the odd 1 or 2 could not get it to work. When I get more time I will test every upgrade from around the time and also I will see and look to see if shaders would be the workaround needed outside of any possible upgrade working with the plugin. Looks simple and straight forward enough to me, its a matter of 1 line in the shader and I already have most of the upgrades set in different folders but right now I have had no sleep and its already 7.50 am here!!
WickedX
16
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 3rd Apr 2015 10:26 Edited at: 3rd Apr 2015 10:27
The fact that it may have worked on an older version of the time the plug-in was released, was my thought as well. Anyway, I think I'm going to get some sleep myself.
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Apr 2015 11:16 Edited at: 3rd Apr 2015 11:32
Could not sleep!! So I just checked to see if 7.62 worked with the plugin, all I have done to check is not use object filter at all, changed the start AF level from 8 to 16 to match the starting point of the 3 options in main loop, set AF on the object prior to main loop, remmed out the contents of the three main loop options and added the command to change the AF level for each of those options - 16x, 2x and 0x respectively. (So I have altered 1 line, added 4 lines and remmed out 4 lines);


Using u7.62 the plugin does appear to be working Cescano perhaps you could give it a try using this upgrade and report back, not going to do anything else at this point, will look at shader option later so anyone with later upgrades have the option to use, as now I do feel like I can actually drop off to sleep

Edit 2 : Well I don't think I am going to get any sleep any time soon, workmen have decided to set up shop outside with drills! Anyway took me less than a minute to sort shader out, I was going to look for a basic shader and post that with the alteration but then its so easy to do theres not much point, so near the start of whatever shader is being used, in the sampler simply write the following:


I hope this wraps things up for you, be sure to let us know
WickedX
16
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 3rd Apr 2015 19:03
Thanks James H for clearing this up. I have never attempted to use this plug-in. Just tested in version update 7.4 and it works great.

I based my answer on the Google source code. The way it's written I assumed it has always been this way. It would be nice if the source reflected the current official version update - 7.62.
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Apr 2015 19:49
Agreed, if a mod sees this I would like to request for you to please amend the title of the link from the first post to include U7.62 if thats ok(as its kaedroho's thread); so that folk don't dismiss it as not working. That said a simple forum google search should bring this thread up, I guess though it will depend on how much folk are willing to read.
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2015 20:14
Made a test, no difference at all using all the 3 options, not in quality not in fps.
I am using dbrpo 7.7 latest update, RC7 i think.
I am not gonna risk to broke something going back to 7.62 to make a test, also, even if this will still work, there is still a huge problem which is that this plugin eats a lot of fps, while doing the same exact thing with set object filter ObjectNum,2 do the same thing without the huge FPS drop.

As I said before, without filters i got 276 frames, with set object filter i got Anisotropic filtering to the max and have 216 fps, if i try the plugin I got the same exact result but with only 56 fps! I think I will stuck with the set object filter then
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Apr 2015 20:35 Edited at: 3rd Apr 2015 20:37
You realize you can make as many copies as you want of your dbp installation and install different upgrades to each. All you have to do then is rename the folders appropriately so that whichever update your testing on is named Dark Basic Professional Online which also means of course you can simply revert back to whichever upgrade you feel suits your needs. 7.7 is still beta so many consider 7.62 to be the last solid working update. Whichever upgrade you use will have bugs and/or lack some form of functionality from all those Ive tried which I would say is pretty much all of them.
If you insist on using 7.7rc7(which is what I primarily use) and want AF then you really should consider the shader route as your graphics should't suffer that much, just use a very basic shader to start with. I havent tried but if you can run evolveds advanced lighting project, tweak the settings down, I don't see any reason why you couldn't alter the object shaders to include AF with the line I posted earlier. Might mean you have to have 1 instance of each object shader for each AF level available for loading but its better than nothing. All depends on your target hardware and if the need to have option to change AF level is sufficient enough for you to make the effort. Will try this myself later I think.
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2015 20:46
For the shader yes I will make a test later, for the test on 7.62, as I want to keep using 7.7 to develop my game, would be useless a test because even if it works on 7.62 it will not on 7.7.

For the advanced lighting, it is a really a bounch of mess up code, too many useless lines I don't need which will higher my complining time (which is already damn high, 1 minute and 20 seconds to compile every time), and most important thing, PERFORMANCE! I really don't need all the stuff that is inside advanced lighting, I want my game to be able to run on older computers too.

For the anisotropic filtering I will just add it to one of the tweakable options on the graphics setting on my game, I already know how to set different multipliers for the antialiasing for example, which is pretty easy and fast to manage, I will make options to tweak almost everything, textures size, relief/normal maps enabled or disabled, mesh quality, water reflect quality, water updates, screen resolution, etc
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Apr 2015 22:04 Edited at: 3rd Apr 2015 22:21
Advanced lighting appears complex and yes compile times are awful but there isnt a better option when it comes to performance for what it is and it gives your users the option to tweak the settings if you match up various parameters to whatever layout menu you choose.

I don't feel the code is messed up, it can be difficult to follow any complex code but his I've grown to be familiar with to some degree, there's no easy way round this, which you will steadily learn when delving into shaders. I just get a sheet of paper and write sort of psuedo code type notes that I refer to because he does keep updating his code at least every few months so I have to keep up with his changes. Its not complete for what he is aiming for, but I and I presume a good number of others, find it very useful indeed.

I simply code a lot of stuff separately, then read my pseudo style notes and work out how I'm going to implement it with his code in various stages, this reduces the amount of times I have to compile. Its a big step for beginners when it comes to understanding how shaders are implemented, you see you don't actually need to understand the shaders themselves but you do need to understand how they are implemented.

I know very little about shaders but I do pick up on bits here and there which slowly fills the void of lack of shader knowledge. IMO knowing what each shader does and how each one is implemented is half of understanding what goes on in his code.

But the choice is yours, you know what your capable of and what your aiming for but I believe that older hardware these days (and taking into consideration the time it takes for you to complete your game) is going to mean the target machines for the game will easily perform well with full shader implementation. Having it run on older machines as described limits your audience is my view, but as mentioned you know whats best suits your needs based on your knowledge and aim. I am just aware that iirc pc's are only supposed to last around 5 years, gamer machines much less but yes a fair number last a whole lot longer. My machine is 7 years old and the only upgrade its recieved are graphics cards(I have had 3 so far) my newest just £100 and I get 180 to 200 fps with all settings as they are in the currently available download and much higher when settings are all at their lowest(I forget but its closer to 500 from what I recall).

So good luck with this, I hope you get to the stage you want.

Edit: oops meant 300 fps not 500!!
Edit2: er my machine has also had new hard drives due to a coffee spillage and been through a couple of psu's, forgot to mention that!
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 3rd Apr 2015 23:08
Yes I think that set object filter would be the best option in terms of performance and time to implement it, I only have a question, is it Worth applying the anisotropic filter to every object or would be better just use it for things who need them more? (like pavements, grass, large objects)
For example, will be just a waste of resources using it on the characters? isn't it?
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Apr 2015 23:52
Perhaps, not given AF much thought until you posted this thread. Not sure about characters, I guess some trial and error would be in order, see what the appearance is, check out the performance. One thing worth some thought is what the differences might be in terms of appearance with regards to switching between LOD levels as using it on one level and not another for any particular object might make the transition very noticeable. Others may well provide a better answer than I can. The one thing with AF is that the effect it has is more noticeable when viewing a flat polygon from an angle in that demo so definitely give it a whirl and play around to see what you think.
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Apr 2015 01:08
There is already a problem when switching LODs, close to the LOD changing range the character flickers (like it doens't know which one to use), but is just a problem when you are very close to the changing distance.
This problem is surely way more noticeable than the AF difference on the character
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 4th Apr 2015 21:25
Apologies for the delay in response. You will need to post some code up for folk to figure out what your doing wrong as to me the issue lies in your code - I would say it could be your distance calculation as what you say seems to be 1 object or the other which only change based on distance, but that's a guess. If its a lot of code then see if you can replicate the problem using a lot less code and then post that instead. It might be wise to open a new thread so that if someone finds they have same issue it will be easier to find using forum google search
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Apr 2015 23:48 Edited at: 4th Apr 2015 23:49
Quote: "There is already a problem when switching LODs, close to the LOD changing range the character flickers (like it doens't know which one to use), but is just a problem when you are very close to the changing distance."


Sounds like a standard control system switching problem to me. What you probably need to do is add a slight delay before switching LODs. So, for instance, instead of switching at a nominal camera distance of say 100 units, switch to a lower LOD at 105 units when the distance is increasing and switch back to a higher LOD at a distance of 95 when the distance is decreasing. In some real world applications (such as the well pump providing our domestic water supply, and possibly some thermostatically controlled systems as well) this is implemented as two switches, one for ON and another for OFF. This stops a switch being continually triggered ON or OFF just because the actual level happens to be hovering around the target level.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 5th Apr 2015 01:51
The problem is that the lod distance is declared when you create the lod, so you can't switch the distances, unless you write your own LOD system, which I could do, but will waste some of my time for something that is barely noticeable even by me that I am aware of it, so I think I will stick with the built in lod system
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Apr 2015 02:22
Fair enough. That's the problem with pre-made systems - they usually have some awkward features you'd like to tweak but can't.

Have you tried to change the LOD distances (assuming that's possible of course)? Perhaps they are too short/close to the camera for your application?



Powered by Free Banners
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Apr 2015 03:24
Try this - it has a near and far parameter for each LOD level - I hope it works as intended for the upgrade your using, have used it in the distant past so not sure what upgrade it was with but it was around the same time as the AF plugin of his I think but it may not necessarily be affected the same way the AF plugin was, you will simply have to try it, if the demo works you should be fine
http://forum.thegamecreators.com/?m=forum_view&t=159658&b=5
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 5th Apr 2015 10:45
Yes gandalf, the problem is more noticeable when you set a lower distance value, for that reason I am setting it for all the LOD characters to 500 dbpro units, the difference in mesh is noticeable probably when you come close to around 300 units, so the reason why I am using it to 500 is for this flickering problem.
I am using just 1 LOD for each character though, whith a huge difference in polygons from the main mesh (like 30-35k tris for the main mesh down to around 1k for the LOD), I will also set an option on my game to change mesh quality, where medium mesh will have the polygons reduced to 50% and low mesh detail to 20%)

I am also Optimizing the characters rendering by excluding characters too far, like 1500-2000 units far, and I have noticed a good fps boost by doing that, even if the polygons to render are not so many due to the LOD used, there is something slowing down the system, I don't know if is something related to the animation of the characters, but more probably by the number of limbs (most bones), which are a total of around 80-90 (mesh + bones) for each characters.

Login to post a reply

Server time is: 2025-05-11 11:03:02
Your offset time is: 2025-05-11 11:03:02