Ogre Assimp Converter
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Ogre Assimp Converter
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.
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.
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: Ogre Assimp Converter
the issue is that the "-shadow" option is not actually supported, see:
https://github.com/OGRECave/ogre-assimp ... #L100-L111
https://github.com/OGRECave/ogre-assimp ... #L100-L111
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre Assimp Converter
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.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
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: Ogre Assimp Converter
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/
https://ogrecave.github.io/ogre/emscripten/
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre Assimp Converter
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.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/
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre Assimp Converter
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.
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre Assimp Converter
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 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));
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: Ogre Assimp Converter
strange.. can you upload the material and mesh file of the inner cube somewhere?
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre Assimp Converter
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:
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.
Code: Select all
material Penguin
{
technique
{
pass
{
texture_unit
{
texture penguin.jpg
}
}
}
}
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: Ogre Assimp Converter
add a Mesh::buildEdgeList() call or run OgreMeshUpgrader on the mesh.
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4