[osg-users] Loading textured meshes (obj+mtl) leads to crash in osg 3.4.1
'Tom Pollok' via OpenSceneGraph Users
osg-users at googlegroups.com
Wed Jan 15 04:47:26 PST 2020
Hi Laurens,
thank you for clarification! My problem was that im using openscenegraph in
combination with osgEarth. I figured out how to fix it, so in case other
osg and osgEarth users might run into the same issue.
To fix the issue i had to include
#include <osgEarth/Registry>
and after loading the model i had to run the shader generator on the model.
osgEarth::Registry::shaderGenerator().run( model );
Now everything works fine.
Thank you very much for your super quick help @Laurens and @Robert !!!
Best,
Tom
Am Mittwoch, 15. Januar 2020 13:00:41 UTC+1 schrieb Voerman, L.:
>
> Hi Tom,
> Your model works with texture for me, in osg 3.4.0 as well as 3.6.5 with
> the following commands:
> sed -E "s#(f [0-9]+/[0-9]+)/0 ([0-9]+/[0-9]+)/0 ([0-9]+/[0-9]+)/0#\1 \2
> \3#" "Data2.obj" > noNormals.obj
> osgviewer -O noRotation noNormals.obj
> Laurens.
>
>
> On Wed, Jan 15, 2020 at 12:24 PM 'Tom Pollok' via OpenSceneGraph Users <
> osg-... at googlegroups.com <javascript:>> wrote:
>
>> Hello Robert,
>>
>> to test it with my old osg version, i fixed the obj file such it does not
>> contain any indices to normals anymore, as there are no normals.
>> This indeed helped loading the model, but no textures appear at all.
>> Should it load the textures automatically due to the first line in the obj
>> file being mtllib Data.mtl and the use of usemtl material_0 before the
>> faces or do i need to take extra care when loading a textured model?
>>
>> For loading, im using only:
>>
>> osgDB::Options* opt = new osgDB::Options;opt->setOptionString("noRotation");osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(pathToObjFile, opt);
>>
>>
>> Best,
>> Tom
>>
>>
>> Am Dienstag, 14. Januar 2020 17:25:27 UTC+1 schrieb Robert Osfield:
>>>
>>> On Tue, 14 Jan 2020 at 15:26, 'Tom Pollok' via OpenSceneGraph Users <
>>> osg-... at googlegroups.com> wrote:
>>>
>>>> Thank you for the workaround.
>>>>
>>>> So as far as i understand you only add the texture coordinate and
>>>> normal, if there exists one with a index greater than 0 and less then the
>>>> number of normals or texture coordinates.
>>>> So that means that openscenegraph now will be able to display the
>>>> textured mesh, even if the normals are missing, right?
>>>>
>>>
>>> Yes, that's correct, you'll get a textured mesh with no normals assigned.
>>>
>>> Robert.
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "OpenSceneGraph Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to osg-... at googlegroups.com <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/osg-users/b55a82c5-4801-49da-b1c4-149d868bd6fa%40googlegroups.com
>> <https://groups.google.com/d/msgid/osg-users/b55a82c5-4801-49da-b1c4-149d868bd6fa%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> _______________________________________________
>> osg-users mailing list
>> osg-... at lists.openscenegraph.org <javascript:>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/79d8878f-0123-4a3a-8d70-1e2e3eb9e20c%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200115/038ae182/attachment.html>
More information about the osg-users
mailing list