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.

Program Announcements / Anisotropic Filtering DLL

Author
Message
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 17th Oct 2009 20:27 Edited at: 22nd Jul 2011 02:03
Heres my latest DLL.

This DLL improves texture filtering quality in Dark Basic pro by using Anisotropic Texture Filtering. [Screenshot attached]

DBPro currently uses Bilinear Texture Filtering which goes very blurry when viewed at an angle, Anisotropic Filtering corrects this. Heres some more info on anisotropic Filtering: http://en.wikipedia.org/wiki/Anisotropic_filtering


The DLL contains just 3 commands. They are:

KD SetAnisotropy Value

Use this to set the Anisotropy. I reccomend a value of 8 (which sets the anisotropy to 8x). But if you want super high quality results, set it to 16. This command is very low complexity, which means that you can hold a good FPS even if you call it lots of times every loop.


KD SetObjectAnisotropicFilteringOn ObjectID

This turns anisotropic filtering on for an object. As soon as this command is called, the object will immediately start using Anisotropic Texture filtering on all its texture stages. This command is also very low complexity.

KD SetObjectAnisotropicFilteringOff ObjectID

This turns off anisotropic filtering.


Screenshot:
Special thanks to roka. Screen shots from Rush Team (FPS)






The below file includes:
Plugin Binary
Keywords File
Readme
Textured plane demo
Terrain demo (requires BlitzTerrain)


Download Version 1.02 (05/2/2011):

DOWNLOAD

TORRENT:



Source code:

DOWNLOAD


Dark GDK code. Posted by Prasoc



This plugin and source code is released into the Public Domain.

Plugin and source code may be used in any project. Commercial or non commercial. No credit required. No royalties.

Your signature has been erased by a mod please reduce it to no larger than 600 x 120.

Attachments

Login to view attachments
jeffhuys
14
Years of Service
User Offline
Joined: 24th May 2006
Location: No cheesy line here.
Posted: 17th Oct 2009 21:04
Awesome! It will really improve graphics of DBPro apps!

You're the 'th to view this signature!
Van B
Moderator
17
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Oct 2009 21:06
WOW!, what a difference, will make terrains look so much better.


Health, Ammo, and bacon and eggs!
Outscape
12
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 17th Oct 2009 21:09
sweeet



Lucifer
14
Years of Service
User Offline
Joined: 26th Dec 2005
Location:
Posted: 18th Oct 2009 00:09
Awesome! Thanks for sharing

Olby
17
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 18th Oct 2009 03:38
Cool plugin, but is there a possibility to turn off the anisotropic filtering once turned on?

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.4 + PureGDK
QuothTheRaven
17
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 18th Oct 2009 04:04
This looks excellent, I can't wait to try it out

Darth Vader
15
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 18th Oct 2009 04:05
Just what the doctor ordered!

Mistrel
Retired Moderator
14
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Oct 2009 06:13
Would you mind posting your source code for this as well?

Libervurto
14
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Oct 2009 07:26
That's brilliant!
Is it compatible with DBC?

TGC Forum - converting error messages into sarcasm since 2002.
Olby
17
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 18th Oct 2009 08:37
Umm, actually I just found out that the same filtering effect is achieved by calling:



in the help file it is described as linear filtering but when compared side to side with kaedroho's anisotropic filtering plugin then there is no difference.

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.4 + PureGDK
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 18th Oct 2009 15:27 Edited at: 5th Jun 2011 13:44
Quote: "Umm, actually I just found out that the same filtering effect is achieved by calling:"


There are 3 types of filtering. Point, Linear and Anisotropic

Point renders the point on the texture which is nearest to the point which needs to be rendered. (used by very old games, like DOOM 1, etc)

Linear blends all the points together but this makes it blurry when viewed at an angle. (DBPro uses this)

Anisotropic is similar to linear but it corrects the blurryness caused by linear filtering.


Quote: "Is it compatible with DBC?"


Sorry, but no. This plugin uses DirectX 9 and DBC uses DirectX 8.


Quote: "Cool plugin, but is there a possibility to turn off the anisotropic filtering once turned on?"


Either use set object filter or 'KD SetAnisotropy 0'.



Thanks for all the other comments that have been posted!

Your signature has been erased by a mod please reduce it to no larger than 600 x 120.

Attachments

Login to view attachments
Olby
17
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 18th Oct 2009 20:46 Edited at: 18th Oct 2009 20:59
Quote: "There are 3 types of filtering. Point, Linear and Anisotropic

Point renders the point on the texture which is nearest to the point which needs to be rendered. (used by very old games, like DOOM 1, etc)

Linear blends all the points together but this makes it blurry when viewed at an angle. (DBPro uses this)

Anisotropic is similar to linear but it corrects the blurryness caused by linear filtering."


Try to compare your plugin command with the internal filter mode 2. I made two shortcuts in your demo to switch between the linear and anisotropic and there was no difference at all (both your and internal filter with mode 2 looked sharp and not blurry). I just want to know which one is better to use, because if the internal command has the same effect then it beats down the purpose of the plugin. Non the less good job, it's great that people investigate such things.



Here is all those 3 modes compared, as you can see there is no difference between linear and anisotropic mode, at least on my computer. This might mean that internally mode 2 (linear) might be actually a real anisotropic filter?

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.4 + PureGDK

Attachments

Login to view attachments
thenerd
11
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 18th Oct 2009 23:48 Edited at: 18th Oct 2009 23:49
do you mean using set display mode ? because even if it is the same, it has advantages using his version. for example, with dbpro in that mode, get image doesn't work. and his is able to be turned on and off for objects, not just the whole scene.

edit: actually, he needs a command to turn it off.


forever loading...
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 19th Oct 2009 00:19 Edited at: 19th Oct 2009 01:00
That image is wrong, I have attached an image of what point filtering looks like. This effect can be achieved by using my anisotropic filtering dll and setting the anisotropy to 0.

As you can see, it looks very grainy and horrible. This method was used in very early 3D games (pre 1995).

I tried your code, and it gives linear filtering, just like the help files say. Have you remembered to comment out the anisotropic filtering commands? I have just discovered that they override the DBPro commands and the DBPro commands cant override them back. I'm working on a command which puts it back right.


Quote: "This might mean that internally mode 2 (linear) might be actually a real anisotropic filter?"


As I just said, I just checked it and its not.


EDIT: New dll is done. It can now disable the anisotropy. Give me time to update the ini and readme then ill upload.

Attachments

Login to view attachments
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 19th Oct 2009 01:29
New dll is up! Improvements are:

Added a command to disable anisotropic filtering.
Demos now toggle through all 3 filter modes (point, linear and anisotropic).

Download it from first post.

tiresius
17
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 19th Oct 2009 03:18
Where was this a couple years ago when I was fighting with mipmap hell on my level texture? I'll definitely check this out.

I'm not a real programmer but I play one with DBPro!
Olby
17
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 19th Oct 2009 04:18
Quote: "I have just discovered that they override the DBPro commands and the DBPro commands cant override them back. I'm working on a command which puts it back right."


Yes, that must have been the problem. Now it works as described, thanks for the update.

ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP1, DBPro 7.4 + PureGDK
cyril
13
Years of Service
User Offline
Joined: 6th Aug 2007
Location: 7 miles away from big ben
Posted: 19th Oct 2009 22:50 Edited at: 19th Oct 2009 22:51
Nice DLL, a must have for DBpro users. Can shaders be used in conjunction with this. In a way it might look very cool
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 20th Oct 2009 01:37 Edited at: 5th Jun 2011 13:45
Yep, shaders can be used.

Your signature has been erased by a mod please reduce it to no larger than 600 x 120.

Attachments

Login to view attachments
Jeff Miller
15
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 20th Oct 2009 02:45
Thank you for this dll.

My eyeballs may be getting old, but in your demo it looks like the point filtering actually looks better from a head-on direction to the textured plain, while the anisotropic 8 (or 16) looks much better when you are viewing at an low angle relative to the plane. (I'm using a 1920 x 1200 monitor resolution, if that helps.) Is there an established viewing angle to the plane at which you should switch from one to the other? I might want to toy around with making an automatic switch from anisotropy 8 to 0 and back again based upon this angle.
Duke E
11
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 20th Oct 2009 05:26
This is a gem, many thanks!

Crispy clear textures on my scenery objects. No performance loss what so ever, though i have a pretty modern gfx card on my coding rig.

Regards
Mistrel
Retired Moderator
14
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 20th Oct 2009 08:06
Anisotropic filtering has been a requested in DBP for a very long time and has only been provided once through empty's Styx plugin, a feature which I think no longer works. It's frustrating that something so fundamental is kept so secret.

It's really a great thing that you'r providing it for free. However, it would be a real boon to everyone if you would also provide your source code. That way DBP users can proactively fix future compatibility issues and GDK users can write their own solution.

kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 20th Oct 2009 11:21
Hey Misterel,

Wasn't planning on making this open source, but I'll think about it right after I port to GDK.

I'm working on a few more DLLs now, I have another 2 which are nearly ready for release, they just need a bit of testing and demos.

Mistrel
Retired Moderator
14
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 20th Oct 2009 11:31
But if you're releasing them for free then why not provide the source code as well? What's the big secret?

kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 20th Oct 2009 11:49 Edited at: 20th Oct 2009 11:49
They will be open source. I'm not so keen on releasing the AF DLL as the code is really simple (its 82 lines long). This makes it easy for people to copy and paste into their own plugins, which will pretty much kill this one. I will release it eventually, I just want to get my other 2 dlls released first.

Mistrel
Retired Moderator
14
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 20th Oct 2009 14:37
I still don't see the point. There's nothing wrong people people copying and pasting useful snippets.

I've gone ahead and converted it to a PureGDK example. I guessed for the most part but I think this is the same thing you're doing.

http://forum.thegamecreators.com/?m=forum_view&t=158901&b=38&p=0



kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 20th Oct 2009 15:04 Edited at: 20th Oct 2009 15:14
Quote: "There's nothing wrong people people copying and pasting useful snippets."


I think that I decide that.


And yes, that is alot like what I'm doing. I set the render states of Mip, Mag and Min all to Anisotropic, you seem to be setting them to point. (I might be wrong by this though, PB looks very messy to me).



I dont get why whenever someone releases something for free, they get the right to keep it closed source. I release something for free and I must make it open source. I said ages ago that this is the first DLL of a whole pack of DLLs. And I WILL Get around to releasing the source code. Just let me finnish a few DLLs first.

I have told you this 3 times now, I dont want to release individual source codes. I want to upload them altogether, but the other 2 that are completed still have bugs!!!

Just give me a chance, please...


EDIT: Mistrel, press this link on friday.
http://www.devstorm.co.uk/viewtopic.php?f=36&t=106

Mistrel
Retired Moderator
14
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 20th Oct 2009 15:45 Edited at: 20th Oct 2009 16:03
Quote: "And yes, that is alot like what I'm doing. I set the render states of Mip, Mag and Min all to Anisotropic, you seem to be setting them to point."


I tried doing this as well but I found that they don't actually have any effect. SET OBJECT FILTER is the only way I could figure out how to set those modes. The only method I'm calling is IDirect3DDevice9::SetSamplerState with D3DSAMP_MAXANISOTROPY.

I noticed that you're also calling ?GetObjectA@@YAPAUsObject@@H@Z but I couldn't guess at what that was for.

As far as providing source code, my intention wasn't to undermine you. You were pretty clear earlier about not releasing it:

Quote: "Wasn't planning on making this open source, but I'll think about it right after I port to GDK."


This is something I wanted to see the source to and I imagined it wouldn't be done. So I found my own solution.

Jeff032
13
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 20th Oct 2009 19:48 Edited at: 20th Oct 2009 19:51
I believe Anisotropic is only a valid/useful value for the MinFilter. Also, I believe you need a MaxAnisotropy > 1 for it to be enabled.

So these should be valid sampler states to enable anisotropic filtering:

MinFilter = Anisotropic
MagFilter = Linear
MipFilter = Linear
MaxAnisotropy = 4

-Jeff

French gui
16
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 20th Oct 2009 21:04
@kaedroho: thanks a lot for releasing this for free. Very useful! I totally understand why you aren't giving the code source, it's your own creation. Are we going to ask code source to every people posting a dll or a game or whatever?
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 20th Oct 2009 22:07
Quote: "I tried doing this as well but I found that they don't actually have any effect."


Try looking at object properties in DBOData.


French gui. Thanks, I have decided to release the source code for all my dlls. There is nothing really worth hiding from any of them and I think it will make them more popular if people are able to edit them.

Releasing the source code is up to the developer. Noone is allowed to make you release source code.

Duke E
11
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 21st Oct 2009 19:47
Found a little snag after running a test on my bare minimum test rig.
It requires "Microsoft Visual C++ 2008 Redistributable Package (x86)" probably the manifest.
Maybe it compiled with /MD as /LD implies not needing externals?
Or the runtimes are needed all the time? I'm not familiar with M$ C. However it may be a deliberate decision to keep the dll small.

Regards
Alfa x
14
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 22nd Oct 2009 17:00
@ Kaehedro.

Thanks for this Dll, it's very useful. I will use it in UA.
Is it fully optimized?

AlfaX.
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 22nd Oct 2009 18:34
Yep, thats about as optimised as it can get!

Every command in the dll is very low complexity. Meaning that you can call them loads of times a loop with little effect to FPS.

kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 22nd Oct 2009 19:59 Edited at: 22nd Oct 2009 20:35
Just hit 100 Downloads!

Thanks everyone who downloaded!

Uploading source code now...

kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 22nd Oct 2009 20:38
Alfa x
14
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 22nd Oct 2009 23:47
Thanks for releasing the source.
Jeff032
13
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 23rd Oct 2009 03:02 Edited at: 23rd Oct 2009 03:05
@kaedroho - 3 things

1) thanks for the source

2) you can change it to:

(Remove the setting of magstate and mipstate from SetObjectAnisotropicFilteringOn and SetObjectAnisotropicFilteringOff, since they don't actually do anything anisotropic-wise.

3) My DBOData.h file contains #include "..\global.h", which I can't seem to find. Where/what is the file? I got around it by defining MAX_STRING to some number so I could compile and test.

[EDIT]
woops, one more thing
Do you ever plan on releasing the source to your terrain plugin? I would find it very useful to look at/study. I'm guessing no, but I thought I'd ask anyway

Thanks
-Jeff

kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 23rd Oct 2009 11:10
No, sorry. I cant release the source to my terrain plugin.

I will change that when i get home . I'm guessing it will save a bit of FPS.

prasoc
11
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 24th Oct 2009 12:28 Edited at: 24th Oct 2009 12:31
DGDK code (very little changed, just encased in a function)




Your signature has been erased by a mod
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 24th Oct 2009 13:04
Thanks prasoc!

I put that in the first post if you don't mind.

prasoc
11
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 24th Oct 2009 16:31
It works a treat I've been wanting to get AT filtering for ages now my game (especially the gun which had a blurry texture along the side) looks much better


Your signature has been erased by a mod
roka
12
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 1st Nov 2009 19:24 Edited at: 19th May 2010 09:41
i have add it to my game , and the result is perfect , very good work , my game is perfect with this

Without :



With !!!!!! :



Roka The French Boy Rush Team (FPS) Click Here
http://forum.thegamecreators.com/?m=forum_view&t=157916&b=8
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 1st Nov 2009 19:52
Wow! They're some great screenshots!

Could I put those up in the first post? as I need some proper screen shots of this dll working.

roka
12
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 1st Nov 2009 20:45
no problem

Roka The French Boy
Grandma
14
Years of Service
User Offline
Joined: 26th Dec 2005
Location: Norway, Guiding the New World Order
Posted: 2nd Nov 2009 11:58
I tried the included demo but I get the same results Olby presented. No difference from DBP's Linear mode.

This message was brought to you by Grandma industries.

Making yesterdays games, today!
roka
12
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 2nd Nov 2009 16:40 Edited at: 19th May 2010 09:40
A new screen :

Without 1 :



With 1 :



Without 2 :



With 2 :



Without 3 :



With 3 :



Without 4 :



With 4 :



Roka The French Boy Rush Team (FPS) Click Here
http://forum.thegamecreators.com/?m=forum_view&t=157916&b=8
tiresius
17
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 2nd Nov 2009 16:49
Why isn't this standardly supported in DBPro? I thought my level texture issues were due to stupid MIPMAPS but it appears it is mainly due to the filtering used.

Does this filter have any overhead for FPS?

Just trying to think why it's not included in DBPro proper.

Thanks for the DLL Kaedroho !!!

I'm not a real programmer but I play one with DBPro!
kaedroho
13
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 2nd Nov 2009 17:01 Edited at: 2nd Nov 2009 17:03
Quote: "Does this filter have any overhead for FPS?"


Yes it does. It changes per graphics card but mostly takes off around 10% of performance. Its worth it though!

Quote: "Thanks for the DLL Kaedroho !!!"


No problem


Grandma, make sure you test without anisotropic filtering with all anisotropic filtering commands commented out. My commands overide DBPro and DBPro cant override it back. So it stays stuck in anisotropic mode until you disable it.


roka, thanks for posting more screenshots

If anyone else has screenshots of this DLL at work then please feel free to post them!

Login to post a reply

Server time is: 2020-09-18 09:42:46
Your offset time is: 2020-09-18 09:42:46