Page 1 of 1

[pool/snooker project] problem with .mesh & .material

Posted: Thu Sep 29, 2005 10:02 pm
by CyberCouf
I'm trying to initiate myself to game codding, i discovery ogre3d, it seems realy a good engine with a good comunity!

So in order to do my firsts steps, i'm going to do a pool game (yes there is so much existing pool games, but this one is a way for me to learn game dev).

I use the "BsdColision" Demo because it's not so far to my aim.

But i have my first probleme :(

I've made a 3D model for pool using blender (i'm new to blender too)
Image
i use the python script to export my model in xml, and after use comand line tool to convert into .mesh
(i got some warnings: "Ignored face with 2 edges")
in my code i added :

Code: Select all

// Create the entity
Ogre::Entity* mEntity = mSceneMgr->createEntity( "Billard","billard.mesh" );
// Create the scene node
Ogre::SceneNode* mNode = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "BillardNode", Vector3( -150, 40, 30 ) );
mNode->attachObject( mEntity );
.. and ingame :
Image
missing faces, seems no materials.. :(

in log file:
23:17:03: Mesh: Loading billard.mesh.
23:17:03: Can't assign material Material.001 to SubEntity of Billard because this Material does not exist. Have you forgotten to define it in a .material script?
i don't understand well how to apply a material, and also why i haven't all my faces .

Posted: Thu Sep 29, 2005 10:12 pm
by reimpell
Be sure your face normals point outwards (quick test in Blender press "P" with "Solid" draw type, or use the "Draw Normals" option). Also be sure that your Ogre application can find the exported .material file. Blender's manual is available via the "Help" menu (Help->Manual).

Posted: Thu Sep 29, 2005 11:19 pm
by CyberCouf
ok, i've corrected all my normals i've a the .material file, but i don't find how to use it in ogre. (may be there is a tutorial for mesh/material import but i didn't find it :( )

Posted: Fri Sep 30, 2005 12:08 am
by Chris Jones
are you using the Media folder like the ogre tutorials/examples have? if so, put ur model in the models folder and the material in the material folder etc, this way ogre will find it

btw, looks cool!, i love pool/snooker, was playing it tonight actually :P

Posted: Sat Oct 01, 2005 5:29 pm
by CyberCouf
i don't understand how to use .material files :

after exporting from blender, i've my .xml and the .material, after a conversion: .mesh .material

i put the billiard.mesh into \media\models and no pb, i can use it in my code
but i put the billiard.material into \media\materials\scripts, and in log file:
18:22:48: Mesh: Loading billard.mesh.
18:22:48: Can't assign material Material.001/SOLID to SubEntity of Billard because this Material does not exist. Have you forgotten to define it in a .material script?

is there a mapping between .mesh name and .material name?
my xml:

Code: Select all

<mesh>
	<submeshes>
		<submesh material="Material.001" usesharedvertices="false" use32bitindexes="false" operationtype="triangle_list">
			<faces count="392">
				<face v1="0" v2="1" v3="3"/>
...
my material:

Code: Select all

material Material.001
{
	receive_shadows on
	technique
	{
		pass
		{
			ambient 0.427287 0.427287 0.427287 1.000000
			diffuse 0.159601 0.504432 0.267361 1.000000
			specular 0.039391 0.298061 0.153015 1.000000 10.750000
			emissive 0.000000 0.000000 0.000000 1.000000
		}
	}
}

why he doesn't find "Material.001" ?

Posted: Sat Oct 01, 2005 5:35 pm
by jacmoe
I don't know how to rename/assign material names in Blender, but I do know that . and _ and spaces in material names will bring trouble. :wink:

Posted: Sat Oct 01, 2005 8:13 pm
by reimpell
CyberCouf wrote:18:22:48: Can't assign material Material.001/SOLID
Material.001/SOLID is not defined in your material file. Did you made any changes to the exported files?

Posted: Sun Oct 02, 2005 4:28 pm
by CyberCouf
ok thanks! i changed the material name, without spaces or dot, it works

Image

now i'm looking for setting up collisions on my model, i hop i'll find it in the tutorials.

Posted: Sun Oct 02, 2005 5:30 pm
by Phantom
You are missing 5 balls, and they are way too big :)

And is this snooker or pool? I guess Pool since you don't have snookers addittional balls on the table...

(Yea I know it's offtopic but I thought it's worth mentioning)

Posted: Sun Oct 02, 2005 6:34 pm
by CyberCouf
don't worry, this is realy just some tests :wink:

the first step is to have a working "core", (interactions, physics, ...)

after that, i'll custom the models, put the trues dimmensions, ball color etc...
all for a real pool game :)