Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-12 Thread Grigoriy Mylnikov
Hi, Is this issue solved in OSG somehow? I need to use some basic lighting on Android (GLESv3). It should use parameters from osg::Light. Are there any ready-made solutions? if not, where can I get some shaders/shader generator to start with? I'm new in shaders. Thank you! Cheers, Grigoriy -

Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-16 Thread Grigoriy Mylnikov
Sorry for delayed reply. My goal is to open and display .osgt files on android the same way they can be opened on desktop. This includes using several lights inside a model, both directional and point lights. I have some progress with writing shaders, but I have troubles with understanding OSG

Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-16 Thread Grigoriy Mylnikov
After some trial and errors, I managed to do it in shader. But this means one redundant matrix multiplication per each vertex. Isn't it more effective to compute it once per frame on cpu side? What's the purpose of state.getModelViewMatrix()? I expected to get a camera*model matrix there. Or it

Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-18 Thread Grigoriy Mylnikov
I tried to use osgUtil/ShaderGen. As far as I understand, it does not supports GLES2/3: it references gl_LightSource, gl_FrontLightProduct etc. in shader code, and I could not find such uniforms created. Also, it assumes only one light source. Maybe there is some more advanced version of ShaderG

Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-19 Thread Grigoriy Mylnikov
At the moment, I implemented ShaderLight class that extends osg::Light and allows to use several point lights with per-pixel lighting (using my shaders). It works on android emulator. I'm not sure about where is a best place to add that lights' uniforms to scene graph (e.g. rootStateSet->addUni

Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-20 Thread Grigoriy Mylnikov
Hi, One more question. If I use gl_ModelViewMatrix in shaders to transform Light position, it gets transformed by both camera matrix and current node's matrix, that is not right. Is there some build-in OSG uniform that holds only camera matrix or only model matrix? Or I should compute it and pa

Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-20 Thread Grigoriy Mylnikov
Thank you, it works. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75222#75222 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-ope