Re: [osg-users] material definition lost
Hi Kim, I have attached the screenshot ( http://tinypic.com/r/wwnqmp/7%20http://tinypic.com/r/wwnqmp/7) of the image, can you please tell me why am i getting these water like highlights on the model, my shaders for the model just set a red color. Regards, Hi Kim, I have attached the screenshot of the image, can you please tell me why am i getting these water like highlights on the model, my shaders for the model just set a red color. Regards, On Wed, Feb 23, 2011 at 10:11 AM, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, Sorry, i'm not at work, i can only send you on tuesday next week :( , thanks for your support. On Wed, Feb 23, 2011 at 10:06 AM, Kim Bale kcb...@googlemail.com wrote: Can you send a screenshot, it might shed some light on the matter. Kim. On 22 February 2011 16:33, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, i wrote a really simple shader, which does nothing but assign red color to the model, but i see water like reflections on the model, thats why i'm confused :( , however, if i run the program with --disableShaders argument, then i loose all the nice effects and also the specular highlights on the model. Regards, On Tue, Feb 22, 2011 at 5:27 PM, Kim Bale kcb...@googlemail.comwrote: Hi Mahendra, Regardless of whether there are any other shaders at work, if you attached a shader to your model it should override any other shaders bound before it. I don't really know what else to suggest, there are too many unknown variables for me to diagnose the problem. I don't know what shader you used, or what material properties your model has etc. Regards, Kim. On 22 February 2011 15:54, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, still no result :( , i wrote two shaders and attached it to my model, and disabled useDefaultShader flag, but still i see specular hightlight on the model, exactly like in the water, still some shader working somewhere?? Regards, On Tue, Feb 22, 2011 at 2:57 PM, Mahendra G.R mahen...@mahendragr.com wrote: Yes, i will do that, thanks for your support Regards, On Tue, Feb 22, 2011 at 2:35 PM, Kim Bale kcb...@googlemail.comwrote: If you are disabling the default shader then the lighting effects you see will be the result of the fixed function shading. You should look at the specular properties of the light and the material and check that they are not too high. K. On 22 February 2011 13:29, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, I disabled the default scene shader and now the model looks very specular, though i see some color, does light source has any effect here?, Thanks, Regards On Tue, Feb 22, 2011 at 2:09 PM, Mahendra G.R mahen...@mahendragr.com wrote: Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.comwrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure that the relevant render targets are filled. The default shader provided by osgocean is very basic as I cannot anticipate everyone's shader needs. Thus if you want the default shader to take into account particular material properties you can either override the defuault shader or attach shader directly to the node you wish to render. Alternatively you may choose to disable the default shader, ( http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/OceanScene#599) however you will lose the DOF, glare and fogging effects if no other shader implementation is provided. Regards, Kim. On 22 February 2011 10:28, Mahendra G.R mahen...@mahendragr.com wrote: Hi all, I'm using osgOcean and placing a model in the middle of the ocean, this model has some material properties (its basically a .ive file), when i load the model with osgViewer, its fine, i see all the colors etc. but when i render it placing it inside the ocean, i loose the features of the model. I read somewhere in the forum to try disabling the shaders and recompile osgOcean (though i felt it had nothing to do with the shaders, just gave a try), did anyone else try loading models in osgOcean ?? Regards, Mahendra -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http
Re: [osg-users] material definition lost
Hi Kim, Still im getting the glare effect, this is my fragment shader.. // varying vec3 v_V; varying vec3 v_N; uniform bool osgOcean_EnableGlare; void main() { vec3 N = normalize(v_N); vec3 V = normalize(v_V); vec3 R = reflect(V, N); vec3 L = normalize(vec3(gl_LightSource[0].position)); //vec4 ambient = gl_FrontMaterial.ambient; //vec4 diffuse = gl_FrontMaterial.diffuse * max(dot(L, N), 0.0); //vec4 specular = gl_FrontMaterial.specular * pow(max(dot(R, L), 2.0), gl_FrontMaterial.shininess); //gl_FragColor = ambient + diffuse - specular; if(osgOcean_EnableGlare) { gl_FragData[1] = vec4(0.0); } gl_FragData[0] = vec4(1.0,0.0,0.0,1.0); } // Am i missing something?. Regards, On Tue, Mar 1, 2011 at 10:20 AM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, This look like you haven't taken into account the glare rendering in your shader. If you want the glare pass to ignore your model you need to set the value in the glare buffer to zero See: http://code.google.com/p/osgocean/source/browse/trunk/resources/shaders/terrain.frag#119 (From the trunk version which uses MRT). Regards, Kim. On 1 March 2011 09:14, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, I have attached the screenshot ( http://tinypic.com/r/wwnqmp/7 ) of the image, can you please tell me why am i getting these water like highlights on the model, my shaders for the model just set a red color. Regards, Hi Kim, I have attached the screenshot of the image, can you please tell me why am i getting these water like highlights on the model, my shaders for the model just set a red color. Regards, On Wed, Feb 23, 2011 at 10:11 AM, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, Sorry, i'm not at work, i can only send you on tuesday next week :( , thanks for your support. On Wed, Feb 23, 2011 at 10:06 AM, Kim Bale kcb...@googlemail.comwrote: Can you send a screenshot, it might shed some light on the matter. Kim. On 22 February 2011 16:33, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, i wrote a really simple shader, which does nothing but assign red color to the model, but i see water like reflections on the model, thats why i'm confused :( , however, if i run the program with --disableShaders argument, then i loose all the nice effects and also the specular highlights on the model. Regards, On Tue, Feb 22, 2011 at 5:27 PM, Kim Bale kcb...@googlemail.comwrote: Hi Mahendra, Regardless of whether there are any other shaders at work, if you attached a shader to your model it should override any other shaders bound before it. I don't really know what else to suggest, there are too many unknown variables for me to diagnose the problem. I don't know what shader you used, or what material properties your model has etc. Regards, Kim. On 22 February 2011 15:54, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, still no result :( , i wrote two shaders and attached it to my model, and disabled useDefaultShader flag, but still i see specular hightlight on the model, exactly like in the water, still some shader working somewhere?? Regards, On Tue, Feb 22, 2011 at 2:57 PM, Mahendra G.R mahen...@mahendragr.com wrote: Yes, i will do that, thanks for your support Regards, On Tue, Feb 22, 2011 at 2:35 PM, Kim Bale kcb...@googlemail.comwrote: If you are disabling the default shader then the lighting effects you see will be the result of the fixed function shading. You should look at the specular properties of the light and the material and check that they are not too high. K. On 22 February 2011 13:29, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, I disabled the default scene shader and now the model looks very specular, though i see some color, does light source has any effect here?, Thanks, Regards On Tue, Feb 22, 2011 at 2:09 PM, Mahendra G.R mahen...@mahendragr.com wrote: Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure that the relevant render targets are filled. The default shader provided by osgocean is very basic as I cannot anticipate everyone's shader needs. Thus if you want the default shader to take into account particular
Re: [osg-users] material definition lost
Hi Kim, Thank you very much, i found out the problem, i had to disable the glare in my code as well. Regards, On Tue, Mar 1, 2011 at 10:48 AM, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, Still im getting the glare effect, this is my fragment shader.. // varying vec3 v_V; varying vec3 v_N; uniform bool osgOcean_EnableGlare; void main() { vec3 N = normalize(v_N); vec3 V = normalize(v_V); vec3 R = reflect(V, N); vec3 L = normalize(vec3(gl_LightSource[0].position)); //vec4 ambient = gl_FrontMaterial.ambient; //vec4 diffuse = gl_FrontMaterial.diffuse * max(dot(L, N), 0.0); //vec4 specular = gl_FrontMaterial.specular * pow(max(dot(R, L), 2.0), gl_FrontMaterial.shininess); //gl_FragColor = ambient + diffuse - specular; if(osgOcean_EnableGlare) { gl_FragData[1] = vec4(0.0); } gl_FragData[0] = vec4(1.0,0.0,0.0,1.0); } // Am i missing something?. Regards, On Tue, Mar 1, 2011 at 10:20 AM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, This look like you haven't taken into account the glare rendering in your shader. If you want the glare pass to ignore your model you need to set the value in the glare buffer to zero See: http://code.google.com/p/osgocean/source/browse/trunk/resources/shaders/terrain.frag#119 (From the trunk version which uses MRT). Regards, Kim. On 1 March 2011 09:14, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, I have attached the screenshot ( http://tinypic.com/r/wwnqmp/7 ) of the image, can you please tell me why am i getting these water like highlights on the model, my shaders for the model just set a red color. Regards, Hi Kim, I have attached the screenshot of the image, can you please tell me why am i getting these water like highlights on the model, my shaders for the model just set a red color. Regards, On Wed, Feb 23, 2011 at 10:11 AM, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, Sorry, i'm not at work, i can only send you on tuesday next week :( , thanks for your support. On Wed, Feb 23, 2011 at 10:06 AM, Kim Bale kcb...@googlemail.comwrote: Can you send a screenshot, it might shed some light on the matter. Kim. On 22 February 2011 16:33, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, i wrote a really simple shader, which does nothing but assign red color to the model, but i see water like reflections on the model, thats why i'm confused :( , however, if i run the program with --disableShaders argument, then i loose all the nice effects and also the specular highlights on the model. Regards, On Tue, Feb 22, 2011 at 5:27 PM, Kim Bale kcb...@googlemail.comwrote: Hi Mahendra, Regardless of whether there are any other shaders at work, if you attached a shader to your model it should override any other shaders bound before it. I don't really know what else to suggest, there are too many unknown variables for me to diagnose the problem. I don't know what shader you used, or what material properties your model has etc. Regards, Kim. On 22 February 2011 15:54, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, still no result :( , i wrote two shaders and attached it to my model, and disabled useDefaultShader flag, but still i see specular hightlight on the model, exactly like in the water, still some shader working somewhere?? Regards, On Tue, Feb 22, 2011 at 2:57 PM, Mahendra G.R mahen...@mahendragr.com wrote: Yes, i will do that, thanks for your support Regards, On Tue, Feb 22, 2011 at 2:35 PM, Kim Bale kcb...@googlemail.comwrote: If you are disabling the default shader then the lighting effects you see will be the result of the fixed function shading. You should look at the specular properties of the light and the material and check that they are not too high. K. On 22 February 2011 13:29, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, I disabled the default scene shader and now the model looks very specular, though i see some color, does light source has any effect here?, Thanks, Regards On Tue, Feb 22, 2011 at 2:09 PM, Mahendra G.R mahen...@mahendragr.com wrote: Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure
Re: [osg-users] material definition lost
Hi Kim, Sorry, i'm not at work, i can only send you on tuesday next week :( , thanks for your support. On Wed, Feb 23, 2011 at 10:06 AM, Kim Bale kcb...@googlemail.com wrote: Can you send a screenshot, it might shed some light on the matter. Kim. On 22 February 2011 16:33, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, i wrote a really simple shader, which does nothing but assign red color to the model, but i see water like reflections on the model, thats why i'm confused :( , however, if i run the program with --disableShaders argument, then i loose all the nice effects and also the specular highlights on the model. Regards, On Tue, Feb 22, 2011 at 5:27 PM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, Regardless of whether there are any other shaders at work, if you attached a shader to your model it should override any other shaders bound before it. I don't really know what else to suggest, there are too many unknown variables for me to diagnose the problem. I don't know what shader you used, or what material properties your model has etc. Regards, Kim. On 22 February 2011 15:54, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, still no result :( , i wrote two shaders and attached it to my model, and disabled useDefaultShader flag, but still i see specular hightlight on the model, exactly like in the water, still some shader working somewhere?? Regards, On Tue, Feb 22, 2011 at 2:57 PM, Mahendra G.R mahen...@mahendragr.comwrote: Yes, i will do that, thanks for your support Regards, On Tue, Feb 22, 2011 at 2:35 PM, Kim Bale kcb...@googlemail.comwrote: If you are disabling the default shader then the lighting effects you see will be the result of the fixed function shading. You should look at the specular properties of the light and the material and check that they are not too high. K. On 22 February 2011 13:29, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, I disabled the default scene shader and now the model looks very specular, though i see some color, does light source has any effect here?, Thanks, Regards On Tue, Feb 22, 2011 at 2:09 PM, Mahendra G.R mahen...@mahendragr.com wrote: Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.comwrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure that the relevant render targets are filled. The default shader provided by osgocean is very basic as I cannot anticipate everyone's shader needs. Thus if you want the default shader to take into account particular material properties you can either override the defuault shader or attach shader directly to the node you wish to render. Alternatively you may choose to disable the default shader, ( http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/OceanScene#599) however you will lose the DOF, glare and fogging effects if no other shader implementation is provided. Regards, Kim. On 22 February 2011 10:28, Mahendra G.R mahen...@mahendragr.comwrote: Hi all, I'm using osgOcean and placing a model in the middle of the ocean, this model has some material properties (its basically a .ive file), when i load the model with osgViewer, its fine, i see all the colors etc. but when i render it placing it inside the ocean, i loose the features of the model. I read somewhere in the forum to try disabling the shaders and recompile osgOcean (though i felt it had nothing to do with the shaders, just gave a try), did anyone else try loading models in osgOcean ?? Regards, Mahendra -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg
[osg-users] material definition lost
Hi all, I'm using osgOcean and placing a model in the middle of the ocean, this model has some material properties (its basically a .ive file), when i load the model with osgViewer, its fine, i see all the colors etc. but when i render it placing it inside the ocean, i loose the features of the model. I read somewhere in the forum to try disabling the shaders and recompile osgOcean (though i felt it had nothing to do with the shaders, just gave a try), did anyone else try loading models in osgOcean ?? Regards, Mahendra -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] material definition lost
Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure that the relevant render targets are filled. The default shader provided by osgocean is very basic as I cannot anticipate everyone's shader needs. Thus if you want the default shader to take into account particular material properties you can either override the defuault shader or attach shader directly to the node you wish to render. Alternatively you may choose to disable the default shader, ( http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/OceanScene#599) however you will lose the DOF, glare and fogging effects if no other shader implementation is provided. Regards, Kim. On 22 February 2011 10:28, Mahendra G.R mahen...@mahendragr.com wrote: Hi all, I'm using osgOcean and placing a model in the middle of the ocean, this model has some material properties (its basically a .ive file), when i load the model with osgViewer, its fine, i see all the colors etc. but when i render it placing it inside the ocean, i loose the features of the model. I read somewhere in the forum to try disabling the shaders and recompile osgOcean (though i felt it had nothing to do with the shaders, just gave a try), did anyone else try loading models in osgOcean ?? Regards, Mahendra -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Window re-size in osgOcean
Hi Kim, Yes, i solved it, my mistake, didnt look at the screenDims function. Thanks, Regards On Tue, Feb 22, 2011 at 2:02 PM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, You need to provide your own resize handler but within it you can call setScreenDims to resize the framebuffers. See: http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/OceanScene#255 K. On 21 February 2011 14:55, Mahendra G.R mahen...@mahendragr.com wrote: Hi, Is there a way to make the osgOcean handle the resize events for the window?, i tried adding an event handler in the example file, but it only resizes the window or makes it full screen but the ocean scene remains the same size, where can i find the resize or wiindow handler for osgOcean?. Thanks, Regards -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgOcean] Shader again.
Hi Bawenang, Did you manage to load a model by anychance, and get the material properites (for example color) without changing the shaders?, it would really help me. Thanks, Regards On Tue, Feb 22, 2011 at 2:07 PM, Kim Bale kcb...@googlemail.com wrote: Hi Bawenang, To my knowledge all the shaders work correctly. Can you be more specific? Regards, Kim. On 22 February 2011 13:04, Bawenang Rukmoko ben...@cs.its.ac.id wrote: Hi, I seem to stumbled a lot on osgOcean's shaders. I've got lots of graphics artefacts because of them. Can you point me to the ones that are actually working on them? I may need to disturb them a bit with my questions. Thanks. Oh yea BTW I've successfully made my own bloom shader. Here's the screenshot. :D Thank you! Cheers, Bawenang -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=36945#36945 Attachments: http://forum.openscenegraph.org//files/glow2_129.jpg http://forum.openscenegraph.org//files/glow_139.jpg ___ 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 -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] material definition lost
Hi Kim, I disabled the default scene shader and now the model looks very specular, though i see some color, does light source has any effect here?, Thanks, Regards On Tue, Feb 22, 2011 at 2:09 PM, Mahendra G.R mahen...@mahendragr.comwrote: Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure that the relevant render targets are filled. The default shader provided by osgocean is very basic as I cannot anticipate everyone's shader needs. Thus if you want the default shader to take into account particular material properties you can either override the defuault shader or attach shader directly to the node you wish to render. Alternatively you may choose to disable the default shader, ( http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/OceanScene#599) however you will lose the DOF, glare and fogging effects if no other shader implementation is provided. Regards, Kim. On 22 February 2011 10:28, Mahendra G.R mahen...@mahendragr.com wrote: Hi all, I'm using osgOcean and placing a model in the middle of the ocean, this model has some material properties (its basically a .ive file), when i load the model with osgViewer, its fine, i see all the colors etc. but when i render it placing it inside the ocean, i loose the features of the model. I read somewhere in the forum to try disabling the shaders and recompile osgOcean (though i felt it had nothing to do with the shaders, just gave a try), did anyone else try loading models in osgOcean ?? Regards, Mahendra -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] material definition lost
Yes, i will do that, thanks for your support Regards, On Tue, Feb 22, 2011 at 2:35 PM, Kim Bale kcb...@googlemail.com wrote: If you are disabling the default shader then the lighting effects you see will be the result of the fixed function shading. You should look at the specular properties of the light and the material and check that they are not too high. K. On 22 February 2011 13:29, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, I disabled the default scene shader and now the model looks very specular, though i see some color, does light source has any effect here?, Thanks, Regards On Tue, Feb 22, 2011 at 2:09 PM, Mahendra G.R mahen...@mahendragr.comwrote: Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure that the relevant render targets are filled. The default shader provided by osgocean is very basic as I cannot anticipate everyone's shader needs. Thus if you want the default shader to take into account particular material properties you can either override the defuault shader or attach shader directly to the node you wish to render. Alternatively you may choose to disable the default shader, ( http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/OceanScene#599) however you will lose the DOF, glare and fogging effects if no other shader implementation is provided. Regards, Kim. On 22 February 2011 10:28, Mahendra G.R mahen...@mahendragr.comwrote: Hi all, I'm using osgOcean and placing a model in the middle of the ocean, this model has some material properties (its basically a .ive file), when i load the model with osgViewer, its fine, i see all the colors etc. but when i render it placing it inside the ocean, i loose the features of the model. I read somewhere in the forum to try disabling the shaders and recompile osgOcean (though i felt it had nothing to do with the shaders, just gave a try), did anyone else try loading models in osgOcean ?? Regards, Mahendra -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] material definition lost
Hi Kim, still no result :( , i wrote two shaders and attached it to my model, and disabled useDefaultShader flag, but still i see specular hightlight on the model, exactly like in the water, still some shader working somewhere?? Regards, On Tue, Feb 22, 2011 at 2:57 PM, Mahendra G.R mahen...@mahendragr.comwrote: Yes, i will do that, thanks for your support Regards, On Tue, Feb 22, 2011 at 2:35 PM, Kim Bale kcb...@googlemail.com wrote: If you are disabling the default shader then the lighting effects you see will be the result of the fixed function shading. You should look at the specular properties of the light and the material and check that they are not too high. K. On 22 February 2011 13:29, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, I disabled the default scene shader and now the model looks very specular, though i see some color, does light source has any effect here?, Thanks, Regards On Tue, Feb 22, 2011 at 2:09 PM, Mahendra G.R mahen...@mahendragr.comwrote: Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.comwrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure that the relevant render targets are filled. The default shader provided by osgocean is very basic as I cannot anticipate everyone's shader needs. Thus if you want the default shader to take into account particular material properties you can either override the defuault shader or attach shader directly to the node you wish to render. Alternatively you may choose to disable the default shader, ( http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/OceanScene#599) however you will lose the DOF, glare and fogging effects if no other shader implementation is provided. Regards, Kim. On 22 February 2011 10:28, Mahendra G.R mahen...@mahendragr.comwrote: Hi all, I'm using osgOcean and placing a model in the middle of the ocean, this model has some material properties (its basically a .ive file), when i load the model with osgViewer, its fine, i see all the colors etc. but when i render it placing it inside the ocean, i loose the features of the model. I read somewhere in the forum to try disabling the shaders and recompile osgOcean (though i felt it had nothing to do with the shaders, just gave a try), did anyone else try loading models in osgOcean ?? Regards, Mahendra -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] material definition lost
Hi Kim, i wrote a really simple shader, which does nothing but assign red color to the model, but i see water like reflections on the model, thats why i'm confused :( , however, if i run the program with --disableShaders argument, then i loose all the nice effects and also the specular highlights on the model. Regards, On Tue, Feb 22, 2011 at 5:27 PM, Kim Bale kcb...@googlemail.com wrote: Hi Mahendra, Regardless of whether there are any other shaders at work, if you attached a shader to your model it should override any other shaders bound before it. I don't really know what else to suggest, there are too many unknown variables for me to diagnose the problem. I don't know what shader you used, or what material properties your model has etc. Regards, Kim. On 22 February 2011 15:54, Mahendra G.R mahen...@mahendragr.com wrote: Hi Kim, still no result :( , i wrote two shaders and attached it to my model, and disabled useDefaultShader flag, but still i see specular hightlight on the model, exactly like in the water, still some shader working somewhere?? Regards, On Tue, Feb 22, 2011 at 2:57 PM, Mahendra G.R mahen...@mahendragr.comwrote: Yes, i will do that, thanks for your support Regards, On Tue, Feb 22, 2011 at 2:35 PM, Kim Bale kcb...@googlemail.com wrote: If you are disabling the default shader then the lighting effects you see will be the result of the fixed function shading. You should look at the specular properties of the light and the material and check that they are not too high. K. On 22 February 2011 13:29, Mahendra G.R mahen...@mahendragr.comwrote: Hi Kim, I disabled the default scene shader and now the model looks very specular, though i see some color, does light source has any effect here?, Thanks, Regards On Tue, Feb 22, 2011 at 2:09 PM, Mahendra G.R mahen...@mahendragr.com wrote: Hello Kim, Thanks for the reply, i dont think its the problem with the shaders, but somehow the stateset of my model is being changed (i guess), Is there way to overcome this problem without disabling the shaders and loosing all those nice effects, basically my material ONLY has some color properties and nothing more!, btw, im using the osgOcean example file to load my model (does it matter?). Thanks, Regards On Tue, Feb 22, 2011 at 1:55 PM, Kim Bale kcb...@googlemail.comwrote: Hi Mahendra, osgOcean uses shaders for most of it's rendering techniques. By default osgocean will apply a default shader to all children that are added to ocean scene. Certain effects like the glare and depth of field shaders and fogging rely on a shader implementation to ensure that the relevant render targets are filled. The default shader provided by osgocean is very basic as I cannot anticipate everyone's shader needs. Thus if you want the default shader to take into account particular material properties you can either override the defuault shader or attach shader directly to the node you wish to render. Alternatively you may choose to disable the default shader, ( http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/OceanScene#599) however you will lose the DOF, glare and fogging effects if no other shader implementation is provided. Regards, Kim. On 22 February 2011 10:28, Mahendra G.R mahen...@mahendragr.comwrote: Hi all, I'm using osgOcean and placing a model in the middle of the ocean, this model has some material properties (its basically a .ive file), when i load the model with osgViewer, its fine, i see all the colors etc. but when i render it placing it inside the ocean, i loose the features of the model. I read somewhere in the forum to try disabling the shaders and recompile osgOcean (though i felt it had nothing to do with the shaders, just gave a try), did anyone else try loading models in osgOcean ?? Regards, Mahendra -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org
[osg-users] Window re-size in osgOcean
Hi, Is there a way to make the osgOcean handle the resize events for the window?, i tried adding an event handler in the example file, but it only resizes the window or makes it full screen but the ocean scene remains the same size, where can i find the resize or wiindow handler for osgOcean?. Thanks, Regards -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Window re-size in osgOcean
Hi agian, I found another problem with osgOcean (or im missing something), i have loaded a model(.ive) along with the ocean(using the osgOcean example) however, i dont see any of the model's material properties displayed, but when i display the model with osgViewer, itseems fine. Thanks, Regards On Mon, Feb 21, 2011 at 3:55 PM, Mahendra G.R mahen...@mahendragr.comwrote: Hi, Is there a way to make the osgOcean handle the resize events for the window?, i tried adding an event handler in the example file, but it only resizes the window or makes it full screen but the ocean scene remains the same size, where can i find the resize or wiindow handler for osgOcean?. Thanks, Regards -- http://www.mahendragr.com -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Regarding osgOcean
Hello all, I was trying to build osgOcean but had some problems, i wanted to know which version of gcc is being used (or does it matter?), currently i have gcc 4.1.2, when i try to build osgOcean, i get the following error, /opt/openscenegraph/2.8/include/osgDB/fstream:32: error: invalid use of undefined type ‘struct std::fstream’ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:95: error: declaration of ‘struct std::fstream’ Can anyone tell me what is wrong with my setup, osg version : 2.8 cmake version : 2.6.4 osgOcean : latest thanks and regards, -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Regarding Osgocean
Hello all, can anyone please tell me if GCC version matters when compiling osgOcean?, i have a problem compiling it, the error i get is : make [ 5%] Building CXX object src/osgOcean/CMakeFiles/osgOcean.dir/DistortionSurface.cpp.o /localhome/mgopaludur/OSG/OpenSceneGraph-2.8.3/include/osgDB/fstream:32: error: invalid use of undefined type ‘struct std::fstream’ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:95: error: declaration of ‘struct std::fstream’ /localhome/mgopaludur/OSG/OpenSceneGraph-2.8.3/include/osgDB/fstream:44: error: invalid use of undefined type ‘struct std::ifstream’ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:89: error: declaration of ‘struct std::ifstream’ /localhome/mgopaludur/OSG/OpenSceneGraph-2.8.3/include/osgDB/fstream:56: error: invalid use of undefined type ‘struct std::ofstream’ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:92: error: declaration of ‘struct std::ofstream’ make[2]: *** [src/osgOcean/CMakeFiles/osgOcean.dir/DistortionSurface.cpp.o] Error 1 make[1]: *** [src/osgOcean/CMakeFiles/osgOcean.dir/all] Error 2 make: *** [all] Error 2 what am i doing wrong?, it will be really nice if someone comes up with an explaination Regards, -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Reading/writing float data into an image
Hello guys, I'm trying to write and then read back float data from an image but for some reason only the last written data seems correct code: dirImage-allocateImage((int) vertices.size(), (int)vertices.size(), (int)vertices.size(), GL_RGB, GL_FLOAT); for ( unsigned int i = 0; i vertices.size(); i++) { osg::Vec3 pos = vertices[i]; (float )dirImage-data(i)[0] = pos.x(); (float )dirImage-data(i)[1] = pos.y(); (float )dirImage-data(i)[2] = pos.z(); std::coutactual.x ispos.x()std::endl; std::coutactual.y ispos.y()std::endl; std::coutactual.z ispos.z()std::endl; std::coutpos.x is(float )dirImage-data(i)[0]std::endl; std::coutpos.y is(float )dirImage-data(i)[1]std::endl; std::coutpos.z is(float )dirImage-data(i)[2]std::endl; } can anybody point out the mistake, sorry if its too silly. -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Reading/writing float data into an image
Hello Laurens, Thank you, you are correct it worked. Best regards, On Fri, Oct 15, 2010 at 11:23 AM, Laurens Voerman l.voer...@rug.nl wrote: Hi Mahendra , osgimage::data() returns an (unsigned char *) so the array indexing only steps one byte. use ((float *)dirImage-data(i))[0] = pos.x();//same effect ((float *)dirImage-data(i))[1] = pos.y();//different effect ((float *)dirImage-data(i))[2] = pos.z(); Laurens. On 10/15/2010 10:55 AM, Mahendra G.R wrote: Hello guys, I'm trying to write and then read back float data from an image but for some reason only the last written data seems correct code: dirImage-allocateImage((int) vertices.size(), (int)vertices.size(), (int)vertices.size(), GL_RGB, GL_FLOAT); for ( unsigned int i = 0; i vertices.size(); i++) { osg::Vec3 pos = vertices[i]; (float )dirImage-data(i)[0] = pos.x(); (float )dirImage-data(i)[1] = pos.y(); (float )dirImage-data(i)[2] = pos.z(); std::coutactual.x ispos.x()std::endl; std::coutactual.y ispos.y()std::endl; std::coutactual.z ispos.z()std::endl; std::coutpos.x is(float )dirImage-data(i)[0]std::endl; std::coutpos.y is(float )dirImage-data(i)[1]std::endl; std::coutpos.z is(float )dirImage-data(i)[2]std::endl; } can anybody point out the mistake, sorry if its too silly. -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Regarding RTT
Hi all, I'm still not able to figure out how to read data from the texture, how should i read back back the data from a texture?, what i'm doing now is simply attaching an image to the camera and trying to save it on to the disc, which is not working. currently i'm just trying to set a color like gl_FragColor = red in my fragment shader. Thanks, Best regards -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Regarding RTT
Hi Aitor, Can you please tell me how you are doing it (saving it onto an image) when ur using a simple color. It would be really helpful for mel. Thanks, Best regards On Fri, Oct 8, 2010 at 10:39 AM, Aitor Ardanza aitoralt...@terra.es wrote: Hi Mahendra, I'm workin on osgmultiplerendertargets.cpp example to do something like you... see attached code. Do not forget to call command arguments --image. I have not succeeded with: gl_FragData[0] = texture2D( baseMap, Texcoord ); but gl_FragData[1] = vec4(0,1,0,1); works, and I can save the image to a file. Why can't use with other texture information? Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32541#32541 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Regarding RTT
Hi Aitor, No problem, i just wanted to know how you are writing it onto the file as an image, writeImageFile ? On Fri, Oct 8, 2010 at 11:04 AM, Aitor Ardanza aitoralt...@terra.es wrote: It is a bit complex to explain, and my english level is very low ... but it's all in the attachment. You have to make several changes to work: Code: const int tex_to_get = 1; and static const char *shaderSource = { uniform sampler2DRect textureID0;\n uniform sampler2DRect textureID1;\n uniform sampler2DRect textureID2;\n uniform sampler2DRect textureID3;\n void main(void)\n {\n gl_FragData[0] = \n vec4(texture2DRect( textureID1, gl_TexCoord[0].st ).rgb, 1);\n }\n }; -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32543#32543 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] render to 3d texture
Hi all, I was trying out Render to 3D texture from here : http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080430/5fea58f1/attachment.txtand i'm getting an error like this : Warning: detected OpenGL error 'out of memory' after RenderBin::draw(,) RenderStage::drawInner(,) FBO status= 0x8cd5 Am i running out of FBO's, is there a limit for it? Still i dont see any values in my texture/image. Thanks, Best regards. -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Regarding texture rectangle in MRT example
Hello, I'm doing exactly as it is shown in the osgmultiplerendertarget example, but i get an error when i declare and try to initialize an object of textureRectangle code : osg::TextureRectangle* textureRect[256] = {0,0,0,0}; for (int i=0;iZ;i++) { textureRect[i] = new osg::TextureRectangle; //.. } I get an error saying invalid use of undefined type struct osg::TextureRectangle, Another question : Should i create a quad and attach the textures and then render it? please excuse me if its a silly question. -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture
Hi Aitor, Sorry, what exactly do you want me to tell?, i'm trying to RTT of some data with a FBO, in a fragment shader that is. Then take this texture data and save it onto to the disc as an image, this is where i'm struck, because what i'm doing is for 3D data, it would be really nice if someone explains me how to save/read the data from the texture and save it as an image. I checked the examples but itseems i'm missing something, i have directly attached an image to the texture and trying to save it, something like this : textureCamera-attach( osg::Camera::COLOR_BUFFER, Image ); osgDB::writeImageFile(*Image, sample.png); Regards, On Thu, Oct 7, 2010 at 4:31 PM, Aitor Ardanza aitoralt...@terra.es wrote: Hi Mahendra, Mahendra G.R wrote: Hello Robert, Thanks, i figured it out. On Fri, Oct 1, 2010 at 2:42 PM, Robert Osfield () wrote: -- http://www.mahendragr.com (http://www.mahendragr.com) -- Post generated by Mail2Forum I'm trying something similar like you, but in fragment shader I need to work with two textures... Can you explain briefly the steps you followed? Thanks! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32527#32527 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Render to texture
Hello guys, this is my situation : i have a fragment shader doing some calculation and i want to store it in a texture, i saw some examples but most of them dont talk about shaders. how can i get the data back from the shader and store it as a texture using OSG. I'm trying to do it with an FBO and a camera to render Thanks, Best regards -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture
Hello, Thanks or ur reply, how should i read back the data from the texture, can i attach an image to the camera(or texture?) and read data from that image?, is it possible and how. Thanks, Best regards On Fri, Oct 1, 2010 at 12:52 PM, Ulrich Hertlein u.hertl...@sandbox.dewrote: Hi, On 1/10/10 20:11 , Mahendra G.R wrote: this is my situation : i have a fragment shader doing some calculation and i want to store it in a texture, i saw some examples but most of them dont talk about shaders. how can i get the data back from the shader and store it as a texture using OSG. I'm trying to do it with an FBO and a camera to render In general render to texture is no different when using shaders. You setup the camera to render to a texture and the shader is ignorant of where it's writing its gl_FragColor to. The situation changes a little when you need to write to multiple render targets from the fragment shader. Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture
Hello Robert, Thanks, i figured it out. On Fri, Oct 1, 2010 at 2:42 PM, Robert Osfield robert.osfi...@gmail.comwrote: HI Mahendra On Fri, Oct 1, 2010 at 1:30 PM, Mahendra G.R mahen...@mahendragr.com wrote: Thanks or ur reply, how should i read back the data from the texture, can i attach an image to the camera(or texture?) and read data from that image?, is it possible and how. See osgprerender example, in particular the code path that is used when you run: osgprerender --image Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture
Hello, Sorry guys, i have a problem agian. What i'm trying to do is render into a 3D texture and i have a problem here, as far as i know, what i'm doing now is render into a 2D texture (using a FBO). I saw some samples in opengl where they actually loop through all the slices in Z direction and produce a 3D texture. how should i do this in osg?. Sorry if my questions are stupid Thanks, Best regards On Fri, Oct 1, 2010 at 2:47 PM, Mahendra G.R mahen...@mahendragr.comwrote: Hello Robert, Thanks, i figured it out. On Fri, Oct 1, 2010 at 2:42 PM, Robert Osfield robert.osfi...@gmail.comwrote: HI Mahendra On Fri, Oct 1, 2010 at 1:30 PM, Mahendra G.R mahen...@mahendragr.com wrote: Thanks or ur reply, how should i read back the data from the texture, can i attach an image to the camera(or texture?) and read data from that image?, is it possible and how. See osgprerender example, in particular the code path that is used when you run: osgprerender --image Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.mahendragr.com -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture
Hello Robert, Ok, will do that. I'm pretty new to ALL these things. On Fri, Oct 1, 2010 at 3:38 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Mahendra, Hows about looking at the osg::Camera API, it should become obvious how one sets a specific face of texture cube map or a 3d texture when doing render to texture. Learning how to investigate how to solve your own problems by looking at the API and examples will really speed your progress. Robert. On Fri, Oct 1, 2010 at 2:32 PM, Mahendra G.R mahen...@mahendragr.com wrote: Hello, Sorry guys, i have a problem agian. What i'm trying to do is render into a 3D texture and i have a problem here, as far as i know, what i'm doing now is render into a 2D texture (using a FBO). I saw some samples in opengl where they actually loop through all the slices in Z direction and produce a 3D texture. how should i do this in osg?. Sorry if my questions are stupid Thanks, Best regards On Fri, Oct 1, 2010 at 2:47 PM, Mahendra G.R mahen...@mahendragr.com wrote: Hello Robert, Thanks, i figured it out. On Fri, Oct 1, 2010 at 2:42 PM, Robert Osfield robert.osfi...@gmail.com wrote: HI Mahendra On Fri, Oct 1, 2010 at 1:30 PM, Mahendra G.R mahen...@mahendragr.com wrote: Thanks or ur reply, how should i read back the data from the texture, can i attach an image to the camera(or texture?) and read data from that image?, is it possible and how. See osgprerender example, in particular the code path that is used when you run: osgprerender --image Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.mahendragr.com -- http://www.mahendragr.com ___ 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 -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Regarding image::data
Hello Guys, I have a small situation here, i'm trying to write float data into an image file using image-data(x,y,z)[0] = 0.352 (an example), but it automatically converts it into char, how can i prevent this? Thanks, Best regards -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Regarding image::data
Hello, @Robert, Mahendra is ok :). Btw, i gave GL_FLOAT as the type, i took Robert's suggestion and itseems working, however, i'm getting values from 0-255 (converted?) and not the actual float values stored. this is what i'm exactly doing : code: (float)image-data(0,0,0)[0] = 0.33 [1] = 0.56 [2] = .83 and printing them back casting to float. what am i doing wrong? Thanks, Best regards. On Fri, Sep 24, 2010 at 3:31 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Hi Mahendra G.R, what type does image have? If it is something like RGBA you try to assign a float to an unsigned byte. This will do implicit conversion. - Werner - On Friday 24 September 2010 15:21:37 Robert Osfield wrote: Hi Mahendra? G.R? All you need to do is cast the data return type to float. Robert. On Fri, Sep 24, 2010 at 2:04 PM, Mahendra G.R mahen...@mahendragr.com wrote: Hello Guys, I have a small situation here, i'm trying to write float data into an image file using image-data(x,y,z)[0] = 0.352 (an example), but it automatically converts it into char, how can i prevent this? Thanks, Best regards -- http://www.mahendragr.com ___ 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 -- TEXION Software Solutions TEXION GmbH - Rotter Bruch 26a - D 52068 Aachen - HRB 14999 Aachen Fon: +49 241 475757-0, Fax: +49 241 475757-29, web: http://www.texion.eu Geschäftsführer/Managing Director: Werner Modenbach ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- http://www.mahendragr.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org