[osg-users] luxrender material support
Hi, I am using OpenSceneGraph 3.0.1. The task I am having is to support luxrender materials in osg nodes. I could not find any API which reads luxrender material and coverts it to a form which osg::Material can understands it. Please guide me how to go about supporting luxrender materials if anyone has done this before I have attached sample luxrender material files (.lxm and .lbm2) for reference. I want to know how to map various parameters to osg::Material parameters (diffuse, ambient, specular, emission, shininess, etc. Thanks for your time. Regards, Mukudan Shower Glass.lbm2 Description: Binary data Shower Glass.lxm Description: Binary data gold.lbm2 Description: Binary data gold.lxm Description: Binary data ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] luxrender material support
HI Mukrundan, I haven't ever heard of luxrender before so can't provide any assistance. I'd guess most others won't be able to either for a niche product. Me thinks you first need to understand what luxrender does, a quick google search on it looks like it's a high quality software renderer. It really doesn't look like something that will easily map across to OpenGL rendering without LOTS of work on shaders and multi-pass rendering, even then it may well up impossible depending upon exactly how luxrender works. So go understand the problem, go learn about luxrender. Robert. On 7 October 2013 08:25, Mukundan A R mukunda...@gmail.com wrote: Hi, I am using OpenSceneGraph 3.0.1. The task I am having is to support luxrender materials in osg nodes. I could not find any API which reads luxrender material and coverts it to a form which osg::Material can understands it. Please guide me how to go about supporting luxrender materials if anyone has done this before I have attached sample luxrender material files (.lxm and .lbm2) for reference. I want to know how to map various parameters to osg::Material parameters (diffuse, ambient, specular, emission, shininess, etc. Thanks for your time. Regards, Mukudan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] luxrender material support
Hi Robert, Ok. I will go with your suggestion. Thanks a lot. Regards, Mukundan On 7 October 2013 16:37, Robert Osfield robert.osfi...@gmail.com wrote: HI Mukrundan, I haven't ever heard of luxrender before so can't provide any assistance. I'd guess most others won't be able to either for a niche product. Me thinks you first need to understand what luxrender does, a quick google search on it looks like it's a high quality software renderer. It really doesn't look like something that will easily map across to OpenGL rendering without LOTS of work on shaders and multi-pass rendering, even then it may well up impossible depending upon exactly how luxrender works. So go understand the problem, go learn about luxrender. Robert. On 7 October 2013 08:25, Mukundan A R mukunda...@gmail.com wrote: Hi, I am using OpenSceneGraph 3.0.1. The task I am having is to support luxrender materials in osg nodes. I could not find any API which reads luxrender material and coverts it to a form which osg::Material can understands it. Please guide me how to go about supporting luxrender materials if anyone has done this before I have attached sample luxrender material files (.lxm and .lbm2) for reference. I want to know how to map various parameters to osg::Material parameters (diffuse, ambient, specular, emission, shininess, etc. Thanks for your time. Regards, Mukudan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to add shadows to deferred shading?
Thanks for the info. I'll try to do as you suggested. Can anyone please check if my conclusions are correct in the shader comments? The 1st and 2nd pass shaders are right at the top: https://bitbucket.org/kornerr/osg-deferred-shading/src/9a2bb7f2c800f3f3d4632ba4fcc27549aa4b7967/main.cpp?at=default Thanks. PS: Also, I'd like to know how to correctly name the posDir_worldspace vector, since position direction doesn't make much sense. 2013/10/5 Marcel Pursche marcel.purs...@student.hpi.uni-potsdam.de Hello, I can't give you a example code but a general concept. The most commonly used technique to create shadows nowadays is shadow mapping. The basic idea is to render in a depth buffer from the light source looking to the scene. The projection and model view matrix, that was used to generate this image, needs to be passed to the main render pass as-well. In the main render pass the vertex position is multiplied with the light projection and model view matrix to get the position of this vertex in the depth buffer. The only thing that needs to be done to create shadows is to compare the depth value stored in the depth buffer with the z-value of our vertex. If the stored value was bigger, there is no shadow, if the value was smaller, the fragment is shadowed. To combine this technique with deferred shading is pretty simple. You can just create a post render pass with the position buffer from the deferred pipeline and the depth image as input. Instead of the vertex position you just need to use the position stored in the position buffer as input. Everything else stays the same. You can look in the osgShadow source code to see how you can set up the prerender camera and how the shader code should look like. Thank you! Cheers, Marcel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56626#56626 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to add shadows to deferred shading?
Hi, your comments are looking good so far. A good name for the posDir_worldspace would be view direction or eye direction. In most lighting formulas it is abbreviated with V or E. It is the direction from the vertex to the eye/camera. There are good wikipedia articles that explain the theoretical background: lBDRF (http://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function), Lambertian Model (http://en.wikipedia.org/wiki/Lambertian), Phong reflection model (http://en.wikipedia.org/wiki/Phong_reflection_model), Blinn Phong model (http://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model) . You have implemented the Lambertian model for diffuse light and the Blinn Phong model for specular light. Thank you! Cheers, Marcel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56650#56650 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to add shadows to deferred shading?
Hm. If posDir_worldspace is actually the direction from the vertex to the camera (eye), then may be it's not really in world space, but in camera (eye) space? And all of the 2nd pass FS calculations too? 2013/10/7 Marcel Pursche marcel.purs...@student.hpi.uni-potsdam.de Hi, your comments are looking good so far. A good name for the posDir_worldspace would be view direction or eye direction. In most lighting formulas it is abbreviated with V or E. It is the direction from the vertex to the eye/camera. There are good wikipedia articles that explain the theoretical background: lBDRF ( http://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function), Lambertian Model (http://en.wikipedia.org/wiki/Lambertian), Phong reflection model (http://en.wikipedia.org/wiki/Phong_reflection_model), Blinn Phong model ( http://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model) . You have implemented the Lambertian model for diffuse light and the Blinn Phong model for specular light. Thank you! Cheers, Marcel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56650#56650 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to add shadows to deferred shading?
Hi, your right, this part of the shader code is wrong. This direction needs to be calculated: Code: posDir_worldspace = normalized(camera_worldspace-p_worldspace); The way it is done in the shader only works for viewspace positions, as the camera position is always 0,0,0 in viewspace coordinates. Everything else should be ok as it is transformed to world space in the first pass. Thank you! Cheers, Marcel[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56653#56653 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to add shadows to deferred shading?
I've changed it to: vec3 cameraPos_worldspace = mat3(osg_ViewMatrixInverse) * vec3(0, 0, 0); I hope that's correct now. 2013/10/7 Marcel Pursche marcel.purs...@student.hpi.uni-potsdam.de Hi, your right, this part of the shader code is wrong. This direction needs to be calculated: Code: posDir_worldspace = normalized(camera_worldspace-p_worldspace); The way it is done in the shader only works for viewspace positions, as the camera position is always 0,0,0 in viewspace coordinates. Everything else should be ok as it is transformed to world space in the first pass. Thank you! Cheers, Marcel[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56653#56653 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to add shadows to deferred shading?
I think this produces (0, 0, 0) too... So turns out camera is always at (0, 0, 0) in every space? Or I can't really invert (0, 0, 0) vector? 2013/10/7 michael kapelko korn...@gmail.com I've changed it to: vec3 cameraPos_worldspace = mat3(osg_ViewMatrixInverse) * vec3(0, 0, 0); I hope that's correct now. 2013/10/7 Marcel Pursche marcel.purs...@student.hpi.uni-potsdam.de Hi, your right, this part of the shader code is wrong. This direction needs to be calculated: Code: posDir_worldspace = normalized(camera_worldspace-p_worldspace); The way it is done in the shader only works for viewspace positions, as the camera position is always 0,0,0 in viewspace coordinates. Everything else should be ok as it is transformed to world space in the first pass. Thank you! Cheers, Marcel[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56653#56653 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to add shadows to deferred shading?
I've corrected camera position and now it looks better: http://youtu.be/9LUOO9VfFTc with more highlights. Again, thanks for the help. 2013/10/7 michael kapelko korn...@gmail.com I think this produces (0, 0, 0) too... So turns out camera is always at (0, 0, 0) in every space? Or I can't really invert (0, 0, 0) vector? 2013/10/7 michael kapelko korn...@gmail.com I've changed it to: vec3 cameraPos_worldspace = mat3(osg_ViewMatrixInverse) * vec3(0, 0, 0); I hope that's correct now. 2013/10/7 Marcel Pursche marcel.purs...@student.hpi.uni-potsdam.de Hi, your right, this part of the shader code is wrong. This direction needs to be calculated: Code: posDir_worldspace = normalized(camera_worldspace-p_worldspace); The way it is done in the shader only works for viewspace positions, as the camera position is always 0,0,0 in viewspace coordinates. Everything else should be ok as it is transformed to world space in the first pass. Thank you! Cheers, Marcel[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56653#56653 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] compatibity profile
On 5.10.2013 20:15, Sajjadul Islam wrote: Code: #version 400 in vec3 VertexPosition; in vec3 VertexColor; out vec3 Color; void main() { Color = VertexColor; gl_Position = vec4(VertexPosition,1.0); } Please try it on your end and let me know!! Hi Sajjadu, I can't try your code at the moment, but from what I can tell, the vertex shader is missing : uniform mat4 osg_ModelViewProjectionMatrix; and then in vertex shader main use: gl_Position = osg_ModelViewProjectionMatrix*vec4(VertexPosition,1.0); The osg_ModelViewProjectionMatrix, osg_ModelViewMatrix and others are automatically set by the osg. Also, don't forget to call: gc-getState()-setUseModelViewAndProjectionUniforms(true); Robert Milharcic ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Deprecated osgViewer::computIntersections
Hi, I'm not sure of the details of your problem, but I recently had a problem with intersections as well. The epsilon value was changed in LineSegmentIntersector.cpp line 410. I changed back to 1e-4 from 1e-13 and it solved my problems. Cheers, Jason -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56660#56660 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Deprecated osgViewer::computIntersections
Hi Jason, In svn/trunk and OSG-3.2 branch I've changed the epsilon to 1e-6 to handle axis align planar bounding boxes. Robert. On 7 October 2013 19:26, Jason MacDonald jnm...@gmail.com wrote: Hi, I'm not sure of the details of your problem, but I recently had a problem with intersections as well. The epsilon value was changed in LineSegmentIntersector.cpp line 410. I changed back to 1e-4 from 1e-13 and it solved my problems. Cheers, Jason -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56660#56660 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Deprecated osgViewer::computIntersections
Thanks for the tip. I'm see an epsilon of -6.2774385622041925e+066 which looks uninitialized to me. I'm going to dig further. I last built revision 13699. Maybe I'll just update and rebuild everything and see if the problem is already resolved. On Mon, Oct 7, 2013 at 1:49 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Jason, In svn/trunk and OSG-3.2 branch I've changed the epsilon to 1e-6 to handle axis align planar bounding boxes. Robert. On 7 October 2013 19:26, Jason MacDonald jnm...@gmail.com wrote: Hi, I'm not sure of the details of your problem, but I recently had a problem with intersections as well. The epsilon value was changed in LineSegmentIntersector.cpp line 410. I changed back to 1e-4 from 1e-13 and it solved my problems. Cheers, Jason -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56660#56660 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@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 Digital Imaging • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android @alphapixel https://twitter.com/alphapixel facebook.com/alphapixel (775) 623-PIXL [7495] ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Problem with Jpeg plugin
Hi, I know this has been asked before, but I could not find a decent answer in previous posts. The problem is that I compile osg, and I want to use the plugin for jpeg. Now I followed the directions exactly (I think) on the getting started sections. I downloaded the dependencies, put them in a seperate directory, use CMake, and it finds the libjpg. First thing that is not clear however: there are 2 dependencies packages for MSVC++ 10 that I can download. Of of them only contains a lib, bin etc., and the other one has x86 and x64 directories in them, each with lib bin etc. It doesn't say anywhere what I am supposed to do.. should I pick either one, or both, and what should I base my choice on? and if both, do I need to copy stuff from where to where exactly? Now I just downloaded the first dependency package (decision pretty much based on nothing, but it contains a jpeg library so I thought it would be ok). Cmake finds the jpeg library under D:/OpenSceneGraph_3.2_source/3rdparty/lib/libjpegD.lib. So far so good... Then I do what it tells me I compile OSG and I build the INSTALL project... OSG works fine, but no JPEG plugin (error when trying to use a .jpg about the plugin not being available. Also when I check the OSG workspace there is no project for the jpeg library I think, unless its names weird and I didn't see it. I tried CMake again but when generating I do not see any specific errors on the JPEG plugin. So any idea what is going on? Why is the jpeg plugin not built? Thank you! Cheers, Bram -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56663#56663 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Camera representing node
Hi, I'm trying to add cameras to the scene (dropping models across the scene) and the user could drag them or rotate them and change its parameters. All works good for the first time, however, I lose track if the user rotates the camera representing object. I'm banging my head with simple math but I'm unable to figure out how the camera's center/up vector change if the camera object rotates. I put the eye to where the node is translated to. I tried to figure out the rotation angle so that I could initialize the camera with the original parameters for the center and up and then apply rotation to the model view matrix but it doesn't seem to make the camera look at, in the correct direction. I'm using daggers for rotating and translating the node. Tried looking at source for some manipulators but could not understand much. Sorry for the noob question but would be glad if anyone could help. Thanks, mots ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org