[GSoC 2011 - Accepted] Dual Quaternion Skinning

Threads related to Google Summer of Code
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

#3 worked out really well, I pushed the changes.

For this phase of the project, I have three more things to do:
First, I need to fix the normal calculations for two-phase skinning.
Second, I need to support dual quaternion skinning without having to define it in the material (the mechanism by which this happens is a bit confusing for me).
Third, I need to fix GLSL support.

Overall, I feel that I am fairly on track.
As evaluations are coming up this next week, do you have any suggestions for things that I've missed or should be doing better?
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

@mysterycoder

you're progress seams is quite good. I'm not yet sure what I'm suppose to do with the evaluations. but I don't think there would be a problem.

I've tried to compile the code of the your dual quaternion Ogre branch. I am having some issues\observations
1. Project doesn't seam to compile for me. It might not be something on my side or the unity compilation process. The only thing that seamed to fix it is adding an include of "OgreShaderExHardwareSkinningTechnique.h" to the end of the file "OgreShaderExHardwareSkinning.h". adding it in the beginning produced other errors. No need to work on this. I'll try to get back to you tomorrow with further details.
2. On the HardwareSkinningTechnique class - Please ensure you are inheriting from "public RTShaderSystemAlloc" and that you have a virtual constructor.
3. On the HardwareSkinning class - I don't think there is a need to hold a pointer to both LinearSkinning (mLinear) and DualQuaternionSkinning (mDualQuat) seperatly. only one technique can be active at a time anyway. I believe you should remove the 2 parameters and keep the mActiveTechnique parameter only.
4. What render system are you using? Is it dx11? which directx sdk release version? I seem to have problems compiling the cg code on the new computer with the vs_3_0 profile. I may need to update the cg compiler. again I'll get back to you on this with more information tomorrow.
it's turtles all the way down
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

Mattan Furst wrote:1. Project doesn't seam to compile for me. It might not be something on my side or the unity compilation process. The only thing that seamed to fix it is adding an include of "OgreShaderExHardwareSkinningTechnique.h" to the end of the file "OgreShaderExHardwareSkinning.h". adding it in the beginning produced other errors. No need to work on this. I'll try to get back to you tomorrow with further details.
Oh this is strange, perhaps we're using different compilers? I'm using g++ 4.5.2 with gold linker.
Mattan Furst wrote:2. On the HardwareSkinningTechnique class - Please ensure you are inheriting from "public RTShaderSystemAlloc" and that you have a virtual constructor.
Will do. When you say "virtual constructor" are you speaking about this: http://www.parashift.com/c++-faq-lite/v ... l#faq-20.8?
Mattan Furst wrote:3. On the HardwareSkinning class - I don't think there is a need to hold a pointer to both LinearSkinning (mLinear) and DualQuaternionSkinning (mDualQuat) seperatly. only one technique can be active at a time anyway. I believe you should remove the 2 parameters and keep the mActiveTechnique parameter only.
I believe that I should keep those two parameters. They prevent HardwareSkinning from having to continually create new instances of either LinearSkinning or DualQuaternionSkinning. For instance, if you have three materials, one that specifies dual quaternion, then another that specifies linear, then another that specifies dual quaternion, HardwareSkinning would have to create an instance of DualQuaternionSkinning, then an instance of LinearSkinning, then re-create another instance of DualQuaternionSkinning.

Code: Select all

void HardwareSkinning::setHardwareSkinningParam(ushort boneCount, ushort weightCount, SkinningType skinningType, bool correctAntipodalityHandling, bool scalingShearingSupport)
{
	mSkinningType = skinningType;
	
	if(skinningType == ST_DUAL_QUATERNION)
	{
		if(mDualQuat.isNull())
		{
			mDualQuat.bind(OGRE_NEW DualQuaternionSkinning);
		}
		
		mActiveTechnique = mDualQuat;
	}
	else //if(skinningType == ST_LINEAR)
	{
		if(mLinear.isNull())
		{
			mLinear.bind(OGRE_NEW LinearSkinning);
		}
		
		mActiveTechnique = mLinear;
	}
	
	mActiveTechnique->setHardwareSkinningParam(boneCount, weightCount, correctAntipodalityHandling, scalingShearingSupport);
}
Mattan Furst wrote:4. What render system are you using? Is it dx11? which directx sdk release version? I seem to have problems compiling the cg code on the new computer with the vs_3_0 profile. I may need to update the cg compiler. again I'll get back to you on this with more information tomorrow.
I'm using cg compiler version 3.0, but right now I can only test on OpenGL because I'm using Mint Linux (a Ubuntu Linux derivative). I hope to get my laptop with Windows on it in order soon.

I've been trying to figure out the normal problems for the last few days, and I haven't been making too much progress. Originally I had modeled my normal calculation code on the original hardware skinning RTSS technique, but after turning off the ambient light, I'm wondering if there is a problem with those normal calculations as well.

This image is of a single spotlight with no specular or ambient. While the lighting on the dual quaternion skinned spine on the right is clearly incorrect, the lighting on thespine with linear skinning also appears to be wrong:
linearvsdqlight.jpg
I've checked the dual quaternion normal code many times, and I believe them to be identical to what I originally tested with the stand-alone shaders. The only thing I can think of is if the normal is transformed into the wrong space. I'm a bit stuck on this, so I'll post some more details tomorrow along with some code.
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

Will do. When you say "virtual constructor" are you speaking about this: http://www.parashift.com/c++-faq-lite/v ... l#faq-20.8?
Never knew such a thing existed (or at least I didn't know about the Idiom).I miss printed. I meant a virtual destructor.
I believe that I should keep those two parameters. They prevent HardwareSkinning from having to continually create new instances of either LinearSkinning or DualQuaternionSkinning.
I though they needed to be created per material separately anyway. I will look into it more thoroughly tomorrow.

If you feel stuck continue to the next phase.

Unfortunately I can only work from my work place on this project. But I intend to look into the cg and normal calculation tomorrow. I believe I'm close to resolving the cg problem.

P.S.
I've updated the instancing code I've told you about.
it's turtles all the way down
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

I pushed a new version with my latest attempts with the normal code. Thanks for taking a look at it.
I think in the interest of progress I'll move onto the instancing code for now.
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

I've fixed the 3 main problems I was having:
  • Project compilation in vs2005 - I still not know what the problem was but I managed to bypass it for now
  • cg compilation - There was a problem where you tried to place a value back into the 2x4 matrix array. Placing it in a temporary value and using it instead fixed the problem
  • normal calculations - In one of the initial lines of the shader you placed the multiplied the input position by a value and placed that value back into the input position parameter. The light calculation based their calculation on a multiplied position value and not the original value.Placing the multiplied position value to a temporary value and then working of that fixed the problem.
There still might be a problem with the normal calculations. When you multiply the normal with the inverse world transformation so you will get the normal back in object coordiantes you use a 4x4 transformation. Normal calculation only need 3x3 matrix. The translation element shouldn't work on them. I didn't see a problem so a didn't try to fix it for now. I wanted to mess as little as I could with the code.

Code is checked in.
it's turtles all the way down
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

Just submitted your midterm evaluation. Everything is ok.
it's turtles all the way down
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

Sorry for the number of posts. I'm trying to reach 100 :wink:.

On the subject of debugging shaders in the rtss system. One of the helpful features in the RTSS which helped me debug the cg and normal problems is that you can make the RTSS save it's shaders to a predefined directory. You can do this by unremarking the line 85: "//#define _RTSS_WRITE_SHADERS_TO_DISK" in the SampleBrowser.h file.

Once you do that you can play around a little bit with the shaders. As long as you don't change the RTSS SRS code the checksum of the shader code will remain the same and the RTSS will not overwrite your file. This means that Ogre will run your shader file even if you changed it a bit.

Also once the shader is written to a file you can use nvidia's cgc.exe (windows) program to check for compilation problems:
C:\Program Files\NVIDIA Corporation\Cg\bin\cgc.exe -entry [function name] -profile [profile name: vs_3_0 , ps_3_0] -I[Path to where the rtss shader files exist: XXXX\Samples\Media\materials\programs] [full file path to the file containing the shader].
I don't know if this program exist for UNIX or an equivalent program for GLSL shaders sorry.
it's turtles all the way down
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

hello @mysterycoder,

I've noticed you're coming along on your project through the bitbucket code fork.
you haven't posted anything on the forum in a while so I was wondering whether you need any guidance or help on anything.
it's turtles all the way down
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Assaf Raman »

Yes, I would love to see some videos of your progress.
Watch out for my OGRE related tweets here.
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

Mattan Furst wrote:I've noticed you're coming along on your project through the bitbucket code fork.
you haven't posted anything on the forum in a while so I was wondering whether you need any guidance or help on anything.
Ah yes, sorry about that. I've been trying to get to where I am working on the VTF and HW_VTF stuff, which requires more changes.

First of all, your changes were really great. SkinningType really did need to get moved into the namespace and I definitely wouldn't have noticed the subtle bug that you found that was causing the lighting issue. After you showed me how to have RTSS output its shaders, I was able to debug some of the GLSL problems better. The compilation problems I was having under GLSL actually wasn't caused by the GLSL code itself, but by some RTSS code which could have been tighter. I addressed that issue and the compilation problems went away, although the GLSL isn't entirely functional yet. But, as we discussed before, I'm sticking with Cg for now.

Next, I worked on getting the RTSS skinning to work programatically, without specifying the properties in materials. After finding that the parameters were being stored in SkinningData as user data in the material, I had to re-factor some code. Most notably, I moved preAddToRenderState to the HardwareSkinning class from the HardwareSkinningTechnique class. This actually took me quite some time to work out because of some subtle changes in behavior from your original version due to using the pimpl idiom.

Now, I've moved onto implementing the instancing. First, I modified the NewInstancing demo to have a combo box selection of skinning techniques when "Animate Instances" is activated. When the combo box is changed, it switches the pointer of the array of material names currently in use. Then I moved to actually adapting the shader. I did shader-based instancing first, since it seemed to require the least amount of code changes. After playing with that for a while, it's working well. As I stated earlier, I'm working on the VTF-based techniques now, and I'm sure I'll have some questions in a few hours as I get deeper into it. :D
Assaf Raman wrote:Yes, I would love to see some videos of your progress.
Certainly, I'll try to upload some by tomorrow.
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

Here are two videos. The first is of the dual quaternion skinning demo which illustrates the difference between linear skinning and dual quaternion skinning. The second is of the modified NewInstancing demo. It isn't clear that the second video is using dual quaternion skinning because the model in use doesn't exhibit the issues addressed by dual quaternion skinning, but I can assure you it is. :)

[youtube]WTj4cY2hCoo[/youtube]
[youtube]54Ke5fhtlXg[/youtube]
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by spacegaier »

Really like your demo video. Only request: Could you move the light a little so that we can some a bit more of the blue things, because the most important visual difference seems to be rather in the middle of the blue thing, which is already almost unlight. You might have to make the blue things a bit higher once you move the lights, so that they still fade in the scene as nicely as they do right now.

Good job :) .
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by syedhs »

And FPS comparison between before and after? Dual quaternion is supposed to improve performance.. :)
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Assaf Raman »

Should it? I am not sure about that, can you point me to the article that states that?
Watch out for my OGRE related tweets here.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by syedhs »

I don't know - I think I read somewhere, probably I got confused.. but I will post the link if it is to be expected (performance). :mrgreen:
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

spacegaier wrote:Really like your demo video. Only request: Could you move the light a little so that we can some a bit more of the blue things, because the most important visual difference seems to be rather in the middle of the blue thing, which is already almost unlight. You might have to make the blue things a bit higher once you move the lights, so that they still fade in the scene as nicely as they do right now.
Thanks! Yes, I'll fix the lighting setup. It was left over from when I was testing the normal generation.
syedhs wrote:And FPS comparison between before and after? Dual quaternion is supposed to improve performance.. :)
What you might be thinking of is that dual quaternion skinning requires less memory bandwidth. A dual quaternion is sent to the shader as a 2x4 matrix, whereas a standard transformation matrix is 3x4. Basic dual quaternion skinning requires 7 more vertex shader instructions than standard linear skinning.

However, in the case of the instancing demo, two-phase dual quaternion skinning is used because the robot entities are being scaled. Both a 2x4 matrix, the dual quaternion, and a 3x4 matrix, for scaling and shearing, must be sent to the vertex shader. In addition, two-phase dual quaternion skinning requires an additional 29 shader instructions over standard linear skinning.
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

So, I think I may have run into a bit of a road block regarding the instancing support. I was going through the InstanceManager and InstanceBatchVTF classes and changing the things that were needed for dual quaternion support. But then I noticed a comment in the code that stated that only one vertex weight is supported in the VTF techniques because anything more would be prohibitively expensive. As far as I'm aware, dual quaternion skinning won't do too much for a model that is only animated using a single vertex weight. I'm not very intimately familiar with instancing, so I was wondering if there is a way to extend the VTF techniques to support multiple weights without destroying the performance or if this might be a bit of a fruitless endeavor.
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

I've noticed that comment to.

I would have to ask @dark_sylinc about this but I believe that the reason that comment is placed there is because vertex texture fetch operation which is usually a relativly heavy operation, and not because of a hardware limitation. Currently the vtf shader performs 3 texture fetches.
As far as I'm aware, dual quaternion skinning won't do too much for a model that is only animated using a single vertex weight
I agree. However if you to drop scaling and shearing support (atleast for per bone calculations) you can create a shader with 2 texture fetches only which may actually out perform the original implemention. Scaling and shearing can still be handled on a per object manner in the recently added (by me) lookup matrix technique:
http://www.ogre3d.org/forums/viewtopic. ... 25#p432630

As far as using dual quaternion with 2 bones. As long as you drop the scaling and shearing support (at least for per bone operation) I don't think the shader will work to badly. it's only 1 extra vertex fetch.

I would agree that implementing dual quaternion with more than 2 bones in this case is an overkill, and does not need to be supported. both because of the complexity of the shader, and the way in which instancing is usually used.

P.S.
  • [s]There is a part of the in the VTF and HW_VTF classes which remove the index and bone weights data from the vertex buffer. You will have to disable that code in the case of handling more than 1 bone.[/s]
  • Due to the nature of how instancing is used and the complexity of the calculations I do not think you need to support scaling and shearing (at least not per bone).
  • I would like you to try and implement the dual quaternion in instancing. However if you run into an unsolvable situation or realize that using dual quaternion in the instancing mechanism is unacceptable FPS-wise you can remove that code, and I will approve your project regardless.
it's turtles all the way down
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

correction
There is a part of the in the VTF and HW_VTF classes which remove the index and bone weights data from the vertex buffer. You will have to disable that code in the case of handling more than 1 bone.
That is incorrect. I forgot that the data is added to the vertex buffer, after a bit of processing, through texture coordinates a few lines latter.
it's turtles all the way down
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5292
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by dark_sylinc »

Yeah, the main I didn't bother in having more than 1 weight per vertex in instancing was due to performance. 2 weights per vertex would've meant 6 texture fetches, 3 weights per vertex then you have 9. Plus, I had to deal with code that dealt dynamically adjusting the vertex declarations, for something that might not worth it. Not to mention HW instancing wasn't there yet, so adding 12 bytes per weight (each weight needs 3 floats for the tex lookup) would've made the vertex buffer insanely large.

Another problem was "design" in sort of speak. Due to the amount of noobies I've foreseen that would try to use instancing, I feared lots of people trying to use 2-4 weights per bones then complaining instancing is crap; when they obviously wouldn't be understanding what instancing is. This, however, could be solved with well written documentation about Instancing. Something that hasn't been done yet.

Technically speaking, it's possible and not so hard now that we've tried the code and proven to be fast and stable (when you're writing something the first time, vertex declarations and bindings are a great source of problems).
All that needs to be modified is at InstanceBatchHW_VTF::createVertexSemantics
The situation is a bit different from back then because now we have HW instancing, a robust code, and it seems that VTF fetches wouldn't be that slow because the memory print is so low, that it should be able to fit in the texture cache (though GeForce 6 & 7 series forget about it); unless the bone count is absurdly high, but we already have a bone count limit around 80 for regular entities (non-instancing) so we're used to it.

The only real limit in the number of weights is the number of texcoords the vertex declaration can hold.
Just make sure the new vertex declaration:
a. Takes care of memory alignment (16-bytes), not very strict seems some GPUs don't seem to be affected (may be that's not where the bottleneck is).
b. Takes care of meshes with multiple UVs, in which case leaves less room for our extra texcoords, and warn the user when this happens.

Cheers
Dark Sylinc
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

@Mattan Furst
Thanks for your advice. I'm glad that you think it's doable, I was worried I was going to have to stop. :D
I've gotten single weight dual quaternion skinning working for VTF and HW_VTF working. I still need to add support for the bone lookup table (and scaling using the table). After that, I'll work on adding two weight skinning.
Although, right now it seems like dual quaternion skinning is still slower, even with the reduction in texture fetching.

@dark_sylinc
Thanks for all of the implementation details you provided, I look forward to examining it in more detail soon.
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

Although, right now it seems like dual quaternion skinning is still slower, even with the reduction in texture fetching.
I'm assuming you are still talking about single dual quaternion weight. What about if you remove the correct antipodality handling. If it's still slower than I think it best you remove the code. There is no point in adding code which has no use and will only serve to complicate the existing code.
it's turtles all the way down
User avatar
Mattan Furst
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 260
Joined: Tue Jan 01, 2008 11:28 am
Location: Israel
x 32

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by Mattan Furst »

I still need to add support for the bone look-up table (and scaling using the table)
Just to make sure we are on the same page. Using the look-up table, as far as the shader are concerned, means adding an extra step after the bone position calculations. In this extra step a matrix, which is placed in the vertex data, is multiply with the position and normal. You don't need to convert that bit of code to dual quaternion. That will defiantly be a waste. You would require both extra space and calculations.

As far as I can tell supporting the look-up table feature shouldn't require any special code changes in the ogre instancing code. It would just require to adding some new materials and perhaps changing the NewInstancing sample.
it's turtles all the way down
mysterycoder
Google Summer of Code Student
Google Summer of Code Student
Posts: 169
Joined: Sat Dec 03, 2005 2:04 am
x 6

Re: [GSoC 2011 - Accepted] Dual Quaternion Skinning

Post by mysterycoder »

Mattan Furst wrote:I'm assuming you are still talking about single dual quaternion weight. What about if you remove the correct antipodality handling. If it's still slower than I think it best you remove the code. There is no point in adding code which has no use and will only serve to complicate the existing code.
Yes I was talking about the single weight skinning. But, all of that code will also be necessary for the two-weight skinning as well, so I think I should leave it in for now. Also, I have a Geforce 8800 GTS 512mb, perhaps on other cards that have a harder time with VTFs, they will get a performance boost from the dual quaternion skinning?
Mattan Furst wrote: Just to make sure we are on the same page. Using the look-up table, as far as the shader are concerned, means adding an extra step after the bone position calculations. In this extra step a matrix, which is placed in the vertex data, is multiply with the position and normal. You don't need to convert that bit of code to dual quaternion. That will defiantly be a waste. You would require both extra space and calculations.

As far as I can tell supporting the look-up table feature shouldn't require any special code changes in the ogre instancing code. It would just require to adding some new materials and perhaps changing the NewInstancing sample.
I understand, actually I just pushed a version with the LUT and you're right, I didn't need any changes in the actual instancing code, just the materials. Using the bone LUT, the performance between the two methods is actually very close, I'd say within 3-4 fps, with linear skinning still slightly faster.
My Google summer of code 2011 topic: Dual Quaternion Skinning
My Google summer of code thread
My Google summer of code wiki page
Post Reply