[osg-users] Imported .obj file not showing textures.

Trajce Nikolov NICK trajce.nikolov.nick at gmail.com
Wed Jan 15 01:27:42 PST 2020


Hi,

the .mtl file is text file where the materials are defined. You can change
the ambient, diffuse there with text editor

On Wed, Jan 15, 2020 at 10:15 AM Voerman, L. <l.voerman at rug.nl> wrote:

> Hi Jiljith,
> I see no problem in your code, and it works when I add it to my osgviewer.
> with OSG_NOTIFY_LEVEL=NOTICE it generates 2 messages:
> Obj Found map in options, [DIFFUSE]=0
> Scaling image 'D:\laurens\Download\objDog/Dog_diffuse.jpg' from (450,450)
> to (512,512)
>
> I suggest you can convert your file with "osgconv -O DIFFUSE=0
> 12228_Dog_v1_L2.obj 12228_Dog_v1_L2.obj.osgt"
> so you can read it in your program with "osgDB::readRefNodeFile(path.
> toStdString() + ".osgt", opt);"
> maybe your scene has no light, or other reasons why the dog shows up black.
> Laurens.
>
>
> On Wed, Jan 15, 2020 at 8:10 AM JILJITH JOHN <jiljithjohncse at gmail.com>
> wrote:
>
>> Hi Laurens,
>>
>> The answer is so great. I am getting the texture applied. But it is in
>> the osgviewer.exe only.
>> Problematically I tried to add the option. Its not working.
>>
>> osgDB::Options* opt = new osgDB::Options;
>>
>>
>> opt->setOptionString("DIFFUSE=0");
>>
>>
>> osg::ref_ptr<osg::Node> model1= osgDB::readNodeFile(path.toStdString(), opt);
>>
>>
>>
>>
>> On Tuesday, January 14, 2020 at 6:39:07 PM UTC+5:30, L. Voerman wrote:
>>>
>>> repost in google group; It seems like my reply to the mailing list does
>>> not show up in google groups.
>>>
>>>
>>> Hi Jiljith,
>>>
>>> The material has both an ambient and a diffuse texture (both refer to
>>> the same file)
>>> while this can be made to work with a shader, using the fixed function
>>> pipeline means you'll have to choose one:
>>>
>>> osgviewer -O DIFFUSE=0 12228_Dog_v1_L2.obj
>>> Laurens.
>>>
>>> On Tuesday, January 14, 2020 at 10:52:54 AM UTC+1, JILJITH JOHN wrote:
>>>>
>>>>
>>>> Hi,
>>>>
>>>> I am developing a tool for editing 3D models using openscenegraph. When
>>>> I tried to load an .obj file, the texture is not applied. I am getting only
>>>> black shade.
>>>> The model is imported using the below code.
>>>>
>>>>
>>>>  osg::ref_ptr<osg::Node> model1= osgDB::readNodeFile(path.toStdString
>>>> ());
>>>>  model1->setDataVariance(osg::Object::DYNAMIC);
>>>>
>>>>
>>>>
>>>> --
>> 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/424783f2-415d-4351-8bf7-83bc25d30936%40googlegroups.com
>> <https://groups.google.com/d/msgid/osg-users/424783f2-415d-4351-8bf7-83bc25d30936%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200115/eb1b15bf/attachment-0001.html>


More information about the osg-users mailing list