[osg-users] obj plugin does not support diffuse and specular texture maps

Ralf Habacker ralf.habacker at freenet.de
Tue Oct 17 04:03:40 PDT 2017


Hi Chris,

thanks for this explanation.

After looking into osg source I think this may be solvable by:

1. extend ShaderGenCache and related classes to support additional
texture maps.

2. extend the obj plugin to provide a map holding recent texture type
and unit index assignments. This map is required by the ShaderGenCache
class to be able to setup the correct texture uniforms.

3. In the obj plugin it is required to setup an event handler to support
 the "toogle lighting" key 'l' which is provided by the state set
handler. On each lighting state change the osgUtil::ShaderGenVisitor
instance need to get the recent camera state set and the loaded nodes
need to accept the shaderGen visitor, which recreates or removes shader
from the related nodes.

Can someone confirm or is there a better solution ?

Ralf

Am 18.09.2017 um 21:22 schrieb Chris Hanson:
> I think all that what's going on is that the loader is simply assigning
> the image maps (diffuse and specular) to various texture unit numbers:
> http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/src/osgPlugins/obj/ReaderWriterOBJ.cpp?rev=13006#L67
> http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/src/osgPlugins/obj/ReaderWriterOBJ.cpp?rev=13006#L835
> 
> but it doesn't really set up a shader or anything special to utilize
> them, so the specular texture just clobbers the diffuse texture. You
> most likely need to write a small fragment shader to actually interpret
> the maps in whatever way you want.
> 
> On Mon, Sep 18, 2017 at 2:10 AM, Ralf Habacker <ralf.habacker at freenet.de
> <mailto:ralf.habacker at freenet.de>> wrote:
> 
>     Hi,
> 
>     we tried to use the obj plugin in an osg based vr application for the
>     HTC Vive to load the steamvr controller (which is provided as .obj file)
>     and recognized that it is displayed with black surfaces instead of
>     showing the provided textures (which works for example in blender).
> 
>     We found out that the osg plugin shows always black surfaces if a
>     material used by an obj file contains a diffuse *and* a specular texture
>     which could be verified with the appended test case.
> 
>     Are there any hints how to solve this issue ?
> 
>     Regards
>     Ralf
> 
> 
> 
> 
>     _______________________________________________
>     osg-users mailing list
>     osg-users at lists.openscenegraph.org
>     <mailto:osg-users at lists.openscenegraph.org>
>     http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>     <http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>
> 
> 
> 
> 
> -- 
> Chris 'Xenon' Hanson, omo sanza lettere. Xenon at AlphaPixel.com
> http://www.alphapixel.com/
> Training • Consulting • Contracting
> 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL
> 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
> Legal/IP • Forensics • Imaging • UAVs • GIS • GPS •
> osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded •
> Mobile • iPhone/iPad/iOS • Android
> @alphapixel <https://twitter.com/alphapixel> facebook.com/alphapixel
> <http://facebook.com/alphapixel> (775) 623-PIXL [7495]
> 
> 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 


More information about the osg-users mailing list