Project idea:Instancing & crowds.

Threads related to Google Summer of Code
Post Reply
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

*Hem*
just another question.

I've made shaders in glsl, but...I cannot use vs 2.0 or greater with an ATI card right? Only with an nVidia card, using modes vp30.

So in fact my shaders are useless, because:
-the cg shader compiled in arbvp1 will do the same thing for the instancing shader
-using only vs 1.1 has is a non-sense for crowd rendering using shader instancing, because with 20 bones the limit of 96 float4 is reached with one object.


In addition, the object count per batch for shader instancing of static objects will be reduced to 32(maximum) in gl mode.

So, I put the glsl shaders or I just add new vertex program declaration of the same code with different shader version configuration?
Follow la Moustache on Twitter or on Facebook
Image
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Post by Praetor »

ATI cards have Sm3.0. In fact the new ATI cards (the one I have, x1900xt) has a better implementation than the 6800. Don't know about a technical comparison of implementations with the 7800 though. But yeah, ATI cards have it now.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Yeah I know that ATI cards have SM 3, but the vertex program version, there is nothing after vs 1_1 for opengl and ATI cards, if I refer to the manual:
http://www.ogre3d.org/docs/manual/manual_18.html#SEC85
Follow la Moustache on Twitter or on Facebook
Image
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

GLSL is essentially SM2/3, for vertex and fragment programs. It doesn't have to map down to an ARB assembler format like Cg does (pre Cg 1.5 anyway).

For this project separate GLSL/HLSL programs are going to be a must (forgetting Cg 1.5 for a moment which is still something of an unknown to me)
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Okay I understand now, so there is no tag to set in the vertex program declaration to decide which shader version to use, as there is for cg and hlsl.

Thanks a lot.
Follow la Moustache on Twitter or on Facebook
Image
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Oh, and by the way, I'm looking for a way to know if the program is running in openGL or directX.
Follow la Moustache on Twitter or on Facebook
Image
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Post by Praetor »

Try getting the render system from root and checking its name.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

A better way if you're just choosing a shader language is to use the HighLevelGpuProgramManager::isSyntaxSupported() method.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Hi everybody. I give some news, even if it is quite late , because of my recent job(programming the wii is fun ;) ), and also exams, because even if I've a job in the game industry, I've chosen to continue the student life in parallel :lol:

About the instancing, I've uploaded the last samples and code here( http://crashy.cartman.free.fr/SOC/ogrenew.rar ), but the glsl shaders that I made were not working at all. I get some error when accessing to the matrix array using the object's index. I'm sure that some of you will create glsl shaders better than I.

For the crowds using instancing in glsl, I saw this topic :
http://www.ogre3d.org/phpBB2/viewtopic. ... lsl+weight

But the patch made the paginglandscape plugin crash, and I had urgent job to do with it for Antharia.

In fact I'm disappointed by myself, not to have succeded to get the openGl mode working with the shader instancing code.

But I don't plan to give up the baby, as I have some ideas to improve the "transparency", doing the use of instanced object look like the one of standard objects(IE, A way to make object picking).

And some others little things to add cool features to OGRE.

NB: As soon as my cvs client will work, I'll submit a patch(if necessary ).

Still thank you for the SOC organization, and sorry for the little failure :oops:
Follow la Moustache on Twitter or on Facebook
Image
User avatar
Zeal
Ogre Magi
Posts: 1260
Joined: Mon Aug 07, 2006 6:16 am
Location: Colorado Springs, CO USA

Post by Zeal »

sorry for the little failure
Hah! This is A++ stuff, no need to apologize. One day soon my crowds will be large enough, and ill definitely be implementing instancing.

So until then, keep on polishing (although things look quite usable as is). And THANKS for all your effort!
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Hello, just merged with the last Eihort sources, same link:

http://crashy.cartman.free.fr/SOC/ogrenew.rar

Still trying to generate a diff file, wincvs don't find the ogreSceneManager.h/cpp files, and tortoiseCVS only writes the beginning of the diff file :lol:
Follow la Moustache on Twitter or on Facebook
Image
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

Use the good basic simple cvs :P
Image
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Hehe I tried, I get some errors too(because I checked out my folder using a win32 cvs) , but you're right, I'll do like this :D
Follow la Moustache on Twitter or on Facebook
Image
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Another last little thing: is it better to make a patch for the Soc Instancing branch, or for the Eihort branch? What do you prefer.
Follow la Moustache on Twitter or on Facebook
Image
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Since the SoC instancing branch is based on Dagon, it will be better if you diff against the current Eihort CVS version.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Patch submitted . If there is any problem, I'm here :)
Follow la Moustache on Twitter or on Facebook
Image
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Hi there, I'm upping the topic because I think there is a bug in the instandinc code for the skinned objects, but I cannot find what's wrong.

It's related to this topic:
http://www.ogre3d.org/phpBB2/viewtopic.php?t=34601

The vertex declaration of the object is :

Position (float3)
Normal (float3)
Blend Indices (U4)
BlendWeights (Float)
Diffuse Color (Float4)
Texture Coord(float2)
and the object index (float1)

The position and the normal are in the first buffer, the diffuse color, tex coords, and object index are in the second buffer, and the blend indices and blend weights are in the third buffer.

The vertices are skinned to only one bone each, so weights are 1 everytime .

The object skinning is totaly wrong (only the vertices linked to the first bone are correctly skinned) when using the crowd shader adapted to 1 weight per vertex:

Code: Select all

blendPos += float4(mul(worldMatrix3x4Array[index*numBones+blendIdx], position).xyz, 1.0) ;
I really don't see what's wrong, because after some hours debugging the vertex data copy, everything seems good.

I think I'll find a solution but before spending all my full time on this problem, I wonder if someone has an idea.

Thanks :)
Follow la Moustache on Twitter or on Facebook
Image
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Hi again. After massive debug I think that I've foudn the problem.
Buffer copy is right, the shader is good, the bone matrices are good.

But I made a comparaison between a batch of 1 object using instanced geometry, and the same object with hardware skinning.
I checked bone per bone, forcing the blend indice in the vertex program, to see how transformations were different.

And when debugging I saw that when using the character as a single entity, the blendIndexToBoneIndexMap list had only 15 bones, and the model has 18 bones.
If I understant the meaning of this list, it contains only the bones that are linked to a vertex <=> if none of the vertices of the mesh is assigned to a bone, this bone is not in the list. Is it really that?
If so, I understant where was the bug, as the blend indices must be changed.
Follow la Moustache on Twitter or on Facebook
Image
przemek210
Gnoblar
Posts: 12
Joined: Tue Jun 07, 2005 11:54 am

Post by przemek210 »

I have a little question. Why world matrix is passed by big table, and not by texcoords? Won't be that more flexible? I want to have about 400 entities in one batch but I can't passed this to a vertex shader. Sorry, if this question was asked earlier, but I don't have time now to read all posts.
Post Reply