Hardware and software skinning in different techniques

Problems building or running the engine, queries about how to use features etc.
Post Reply
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Hardware and software skinning in different techniques

Post by Oogst » Mon May 29, 2006 6:51 pm

For De Blob I am creating some very simple low-quality shaders for old and bad GPU's. I am using several techniques in one material for this. Now if the best technique has hardware skinning and the worst technique has software skinning, then my object simply gets lost. For example:

This is correct (although ugly); the red part is done using software shading:
Image

This one is wrong, for the upper part is simply totally gone:
Image

This the material I am using for this:

Code: Select all

material BallTop
{
	technique
	{
		pass
		{
			vertex_program_ref Cg_Ball_Top_VP
			{
			}
			fragment_program_ref Cg_Ball_Top_FP
			{
			}
			texture_unit
			{
				texture FalloffBlue.png 1d
				tex_address_mode clamp
				filtering linear linear none
			}
			texture_unit
			{
				texture BallOverlay.tga
				filtering trilinear
			}
		}
	}
	technique
	{
		scheme Low
		pass
		{
			diffuse 1 0 0
			ambient 0 0 0
			emissive 0.1 0.1 0.1
		}
	}
}
The simple material is being used in the screenshot. If I remove the vertex and fragment programs that are doing the hardware skinning from the upper technique, then it works fine. If I let them remain there, the object is gone with the lower technique.

How can I solve this?

Thanks in advance!
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Post by Oogst » Tue May 30, 2006 8:31 am

Does no one have a clue?
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Tue May 30, 2006 2:07 pm

Is this one object with submeshes? An object must be entirely software skinned or entirely hardware skinned, you can't mix them.
0 x

Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Post by Oogst » Tue May 30, 2006 3:01 pm

It might have submeshes because of the exporter-issue in 3dsmax, but if it has submeshes, then all have the same material, so this should not be a problem then, right?

Just to be sure I did an extra entity->setMaterialName() and that did not help either.
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Wed May 31, 2006 5:21 pm

Hmm, then I suspect a problem with the shader, I don't have this problem on other multi-submesh objects.
0 x

Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Post by Oogst » Wed May 31, 2006 7:30 pm

Some experimenting learned me that on a Intel xxxxxx, i.e. a cardboard GPU, the low-shader does work. Quite strange, that.

Could you explain how a shader could brake this? The bottom-technique does not have a shader and the upper technique should not be used. What am I missing here?
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

User avatar
BlasterN
Gnome
Posts: 378
Joined: Thu Mar 24, 2005 1:07 am
Location: Spain
Contact:

Post by BlasterN » Wed May 31, 2006 11:05 pm

If you are using Software Skinning and the shader, you should not have problems.
hardware skinning and shader that change the position of the vertices could create problems. I remember a shader, convert a box into a star and then into a box etc... (like the screensaver in windows in spanish "Figuras 3D" -> "3D figures") and simply disapear when i applied to robot in the animation_demo.

So your shader can't modify vertices.
I'm pretty sure that you modify vertices, right? for the collision with the floor, like a ball. I show the showcase.

like allways a little imagination that could be good or bad.
There is a way to apply one shader in the last time/position. Something related with renderqueue...
0 x
Works:
MapToMesh | Bengine B9 @ www.sourceforge.net/projects/maptoogremesh/
3DWorldStudio exporter@ www.blastern.info

Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Post by Oogst » Thu Jun 01, 2006 6:46 pm

This really is not the case. The material has two techniques. Technique 1 does a shader with hardware skinning. Technique 2 is very simple and wants to get software skinning. If I let Ogre perform technique 2, the mesh simply disappears. If I remove the hardware skinning from technique 1 and then use technique 2, the mesh is properly animated using software skinning. So if technique 1 has hardware skinning, technique 2 does not work.
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Thu Jun 01, 2006 10:40 pm

Odd, the robot and jaiqua materials use exactly this approach (fallback to software skinning in technique 2) and works fine.

Hold on - you're using material schemes. That probably isn't going to work, you should really provide hardware / software fallback within each scheme. Fallback never occurs across schemes and I don't think the hardware / software skinning detection will pick up the change across schemes.
0 x

Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Post by Oogst » Fri Jun 02, 2006 9:29 am

Am I right then to conclude that I cannot make software skinning the only option for one of the schemes? As I understand it, this would not work either:

technique1: hardware, scheme default
technique2: software, scheme default
technique3: software, scheme Low

That means I have to do some extra work, because to create a hardware-skinning material for the Low-scheme, I have to write an extra vertex shader. Is this because of something in Ogre, or in DX/GL?
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Fri Jun 02, 2006 1:46 pm

It's a limitation with the way the hardware skinning flag is picked up at the moment. Basically the Entity is not told that you switched schemes, so it doesn't know that it should re-examine whether it can use hardware skinning or not. Unless you want to tell every Entity when you change schemes that they should reevaluate their skinning approach, you would be much better to homogenise them so that each scheme can do both. Schemes aren't really designed for hardware fallback of skinning, that's already built into the regular techniques.

If you set the low scheme before the entity first evaluated hardware skinning, it will figure out the correct position. The trouble is that you must have had the regular scheme in place when it examined it, then switched it afterwards.
0 x

Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Post by Oogst » Fri Jun 02, 2006 7:07 pm

Ah, but these sound like much more reasonable solutions than writing extra shaders. I'll try changing the order, although I think it is already set correctly. Not 100% sure, though.
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

Post Reply