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 / ID3DXEffect Wrapper Plugin for DBPro

Author
Message
revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 5th Mar 2017 18:25 Edited at: 18th Mar 2017 19:11
Hi everyone, During development of a recent project I found the need for a faster alternative to Dark Shader's Set Effect Constant Vector Element command. Although use of this plugin is a bit clunkier than the existing solutions it does come with a few advantages:

1) Does not require referencing constants by name each time they are manipulated
2) Set vector and matrix constants without needing to use DBPro's math resources
3) Can retrieve shader constant values
4) Matrix Array Support

The download comes with a few bare-bones examples to demonstrate basic usage, but because the plugin is merely a wrapper (and I'm not sure how many people will actually use this) I didn't bother to write any help files. You can find microsoft's documentation at ID3DXBaseEffect interface and ID3DXEffect interface.

Update 2/7/2017:
-Included two new examples showing usage of this plugin in conjunction with MatBit's eXtendet Rotation plugin.


Update 2/18/2017:
-Updated Poke Vector4 to be slightly faster
-Added Poke Vector2/Poke Vector3 commands
-Added examples demonstrating batch rendering of up to 80 dynamic objects using vector arrays (with and without the eXtendet Rotation plugin)

Command List (35 total):
+ Code Snippet

This plugin only provides wrapper commands for members I thought people might find useful. If I've missed anything important let me know.

Attachments

Login to view attachments
Chris Tate
8
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 7th Mar 2017 00:07
I've subscribed to this thread and downloaded a copy to play around with later. Thanks for sharing.
revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 7th Mar 2017 21:17
You're welcome, let me know if you find any issues or have suggestions for improvement.
revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 7th Mar 2017 23:47
Updated download in first post; corrected error in the matrix pointer array example, two new examples using MatBit's eXtendet Rotation plugin as a replacement for dbpro's native vector/matrix commands.
Kuper
9
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 15th Mar 2017 23:18
Will it be faster than darkShader's when setting effect Vector Element?
revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 16th Mar 2017 03:12
Yes, on my machine it is x7-x8 faster. This plugin helps to cut down on the work which is needlessly repeated each time the "set effect constant" commands are called (less string usage, avoids dbp's math resources, reuses effect constant handles).
Kuper
9
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 16th Mar 2017 21:32 Edited at: 16th Mar 2017 21:33
Test it on Win7 and DBProEx 1.0.0.8. Works fine.
Also I get boost about 50% ( dark shader fps 223 vs fps 376 ID3DX )
Maybe I did something wrong?

+ Code Snippet
revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 17th Mar 2017 03:02 Edited at: 19th Mar 2017 16:01
Hi Kuper, thanks for testing. Remove all of those rnd(255)/255.0, they are effecting the program's speed more than anything. Also, you should not use the framerate counter to test the speed of specific commands; a program is always doing more than just calling the command you wish to test, and so it is not possible to see the total difference in command speed through FPS alone.

+ Code Snippet
Kuper
9
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 17th Mar 2017 13:22
Thanks revenant chaos!
Nice snippet
I think only MatrixUtils have such hiresolution timer? DBPro's timer() and perftimer() doesn't provide such accurate results
revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 17th Mar 2017 13:41 Edited at: 17th Mar 2017 14:06
You're welcome, thanks again for testing. Could I ask how much of a speed difference you get with the revised code?
Quote: "I think only MatrixUtils have such hiresolution timer?"
Yeah sorry about that; I think PerfTimer() should be more than accurate enough to replace the calls to HiTimer().


[Edit] Updated the above code snippet to use PerfTimer(), and modified the darkshader test loop to be a bit more realistic (corrected a silly error...)
Kuper
9
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 17th Mar 2017 15:00
I've tested with PerfTimer() already ( cause I try to use as less plugins as i can ) and it shows much lower speed difference
between DarkShader and D3DXEffect.( about 6 times )
Matrix utils timer shows about 10 times difference.
Seems like HiTimer() is best solution to get perfomance statistic of your code


revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 17th Mar 2017 15:26
Thanks man
Rudolpho
11
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 18th Mar 2017 09:10
Great work, thanks for sharing!
revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 18th Mar 2017 19:15
Thanks and you're welcome Rudolpho!

Uploaded new version, see first post for details.
Bored of the Rings
12
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 25th Mar 2017 07:42 Edited at: 25th Mar 2017 07:46
[oops wrong post, sorry]
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Kuper
9
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 5th Apr 2017 14:06
How to use "AnimBone_SetPosition" command"?
I'l try to use it for inverse kinematic like this:
revenant chaos
10
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 7th Apr 2017 02:27 Edited at: 7th Apr 2017 02:36
Hi Kuper, Wrong thread
The AnimBone_SetPosition command is used to define a bone's position (or position offset) within it's parent's local coordinate space. If any animations are being played onto the bone, manually defined rotation/position/scale will be overwritten when AnimObject_Update is called. This is not true for bone rotation/position/scale offsets. Much like DBPro's offset limb, the effects of this command are typically not desirable when used in conjunction with multi-weighted geometry.

To achieve inverse kinematics like you show in the picture, you would need to apply rotation offsets to the bones which lead from the pelvis down to each foot.

It should be noted that jGpuSkin was written with forward kinematics in mind, with speed being it's main concern. I do not have any plans to implement IK in the future.
Kuper
9
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 7th Apr 2017 12:05
Sorry wrong thread indeed!!
Move question to right one

Login to post a reply

Server time is: 2017-04-30 08:12:26
Your offset time is: 2017-04-30 08:12:26