Page 1 of 1

Ogre Assimp Converter

Posted: Sat Oct 13, 2018 12:37 pm
by Owl53
Hi,

I have used Ogre Assimp Converter to convert several .obj models to .mesh, and they all seem to have been created as intended. However, once loading them into my project, when I render the model it doesn't cast shadows. So, upon referring back to the converter, I noticed that there is a -shadows option - when I try and follow the example format suggested, i.e (OgreAssimpConverter [options] sourcefile [destination]), using any type of option fails for me. It tries to use the option I suggest as the sourcefile, obviously therefore causing an error.

I suspect I am writing the command in slightly the wrong order or something, despite trying to follow the suggestion in the converter. Afterwards I tried several variants, each with no success. Could someone write how you can use the options available? For instance, just to demonstrate the principle, converting cube.obj?

Thanks.

Re: Ogre Assimp Converter

Posted: Sat Oct 13, 2018 1:11 pm
by paroj
the issue is that the "-shadow" option is not actually supported, see:
https://github.com/OGRECave/ogre-assimp ... #L100-L111

Re: Ogre Assimp Converter

Posted: Sat Oct 13, 2018 1:15 pm
by Owl53
paroj wrote:
Sat Oct 13, 2018 1:11 pm
the issue is that the "-shadow" option is not actually supported, see:
https://github.com/OGRECave/ogre-assimp ... #L100-L111
I see. So is there a way to get the .mesh 's that are created by the converter to give off shadows? I tried in code using entity->setCastShadows with no success.

Re: Ogre Assimp Converter

Posted: Sat Oct 13, 2018 1:19 pm
by paroj
for shadows you mainly need to configure the scene manager, see e.g. https://github.com/OGRECave/ogre/blob/m ... .h#L76-L80

https://ogrecave.github.io/ogre/emscripten/

Re: Ogre Assimp Converter

Posted: Sat Oct 13, 2018 1:43 pm
by Owl53
paroj wrote:
Sat Oct 13, 2018 1:19 pm
for shadows you mainly need to configure the scene manager, see e.g. https://github.com/OGRECave/ogre/blob/m ... .h#L76-L80

https://ogrecave.github.io/ogre/emscripten/
Sorry, I didn't explain the issue very well. So, for models within the ogre media folder, for example: shadows on the models work perfectly in the scene. But for other .mesh models created by the exporter, put into the same scene and loaded with all the same code, the models don't have shadows.

Re: Ogre Assimp Converter

Posted: Sat Oct 13, 2018 2:52 pm
by Owl53
Some further information if it helps, I have the shadow type set to SHADOWTYPE_STENCIL_MODULATIVE, and this shows shadows for the ogre media models but not different models that I've converted. If I set the shadow type to SHADOWTYPE_TEXTURE_MODULATIVE however, i.e. what it is in that example you linked, shadows don't show for any of the models.

Re: Ogre Assimp Converter

Posted: Sat Oct 13, 2018 6:00 pm
by Owl53


Here is an example showing what I meant. The cubes on the outside are the cube from the ogre media file, and the inner cube is a cube made into a mesh from the converter. As you can see, the media cubes have shadows, but the other one doesn't.

Here is the relevant scene manager code:

Code: Select all

sceneManager.reset(m_root->createSceneManager("DefaultSceneManager", "Scene"));
sceneManager->setAmbientLight(Ogre::ColourValue(1, 1, 1));
sceneManager->setShadowTechnique(Ogre::ShadowTechnique::SHADOWTYPE_STENCIL_MODULATIVE);
sceneManager->setShadowColour(Ogre::ColourValue(0.5f, 0.5f, 0.5f));
The floor - cast shadows is set to false.
The other cubes - cast shadows are all set to true.

The light creation code in the scene is:

Code: Select all

light.reset(_sceneManager->createLight("SpotLight"));
light->setDiffuseColour(Ogre::ColourValue::White);
light->setSpecularColour(Ogre::ColourValue::White);
light->setType(Ogre::Light::LT_SPOTLIGHT);

lightNode.reset(_sceneManager->getRootSceneNode()->createChildSceneNode());
lightNode->attachObject(m_light.get());
lightNode->setDirection(0, -1, 0);
lightNode->setPosition(Ogre::Vector3(0, 200, 0));
light->setCastShadows(true);

light->setSpotlightRange(Ogre::Degree(35), Ogre::Degree(50));

Re: Ogre Assimp Converter

Posted: Sat Oct 13, 2018 7:15 pm
by paroj
strange.. can you upload the material and mesh file of the inner cube somewhere?

Re: Ogre Assimp Converter

Posted: Sat Oct 13, 2018 7:37 pm
by Owl53
Just for testing, I have been trying a variety of materials. So, to confirm that the contents of it wasn't the issue, I applied the Penguin.material from ogre media - i.e. just a texture:

Code: Select all

material Penguin
{
    technique
    {
        pass
        {
		    texture_unit
			{
			    texture penguin.jpg
			}
        }
    }
}
The result of using this material is just the same as the picture from my previous post (i.e. no shadow). I'll pm you a link for the mesh.

Re: Ogre Assimp Converter

Posted: Sun Oct 14, 2018 1:04 am
by paroj
add a Mesh::buildEdgeList() call or run OgreMeshUpgrader on the mesh.

Re: Ogre Assimp Converter

Posted: Sun Oct 14, 2018 1:22 pm
by Owl53
paroj wrote:
Sun Oct 14, 2018 1:04 am
add a Mesh::buildEdgeList() call or run OgreMeshUpgrader on the mesh.
Upgrading the mesh worked, thank you!