[osg-users] Rotate Camera on Its Axis

2015-06-17 Thread Rômulo Cerqueira
Hi, I have problems with this topic. I get my View Matrix by viewer-getCamera()-getViewMatrix() and apply a rotation by preMult, but the camera rotates using the center of the world scene as reference, not its own center. How I can do this? ... Thank you! Cheers, Rômulo --

Re: [osg-users] Material Properties to Change the Normal Intensity

2016-12-28 Thread Rômulo Cerqueira
Hi Sebastian, I followed your tip and passed the reflectance as float-uniform. Each object has a different reflectance passed by individual statesets. ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69791#69791

Re: [osg-users] Check if sampler2D is valid in fragment shader

2016-12-28 Thread Rômulo Cerqueira
Hi Sebastian, > > There is no direct way. If you need shaders with and without texturing > you should bind different programs to the affected geometries. > I think my problem is a little bit different. I will receive the final scene with or without textures and process it properly. I

Re: [osg-users] Check if sampler2D is valid in fragment shader

2017-01-03 Thread Rômulo Cerqueira
Hi Sebastian, I have used the last openscenegraph stable package in ubuntu (version 3.2.3 - https://launchpad.net/ubuntu/+source/openscenegraph), and there is no setDefine() method in osg::StateSet (only for 2.4 and newer). There is a different way? Cheers, Rômulo -- Read

Re: [osg-users] Check if sampler2D is valid in fragment shader

2017-01-03 Thread Rômulo Cerqueira
Hi, > > I can create a minimal example if you're stuck with this. > I will appreciate this, please. ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69845#69845

Re: [osg-users] Check if sampler2D is valid in fragment shader

2016-12-29 Thread Rômulo Cerqueira
Hi Christian, > You could traverse the scene graph and check the state sets to see if they > bind a texture to a texture unit. > > Then depending on these findings, choose the correct shader code. I appreciated it. Can you give me some example? ... Thank you! Cheers, Rômulo

[osg-users] Material Properties to Change the Normal Intensity

2016-12-23 Thread Rômulo Cerqueira
Hi, I have simulated a sonar sensor using normal depth map by custom 3D shader from OpenSceneGraph scene. I already implemented the Bump Mapping technique to change the normal directions. For now, I need to change the material properties (e.g. reflectance) of scene's objects to

[osg-users] Check if sampler2D is valid in fragment shader

2016-12-26 Thread Rômulo Cerqueira
Hi, is there a way to check if a texture (as uniform sampler2D) is valid in fragment shader? This is my current code: Code: if (textureSize(myTexture, 0).x > 1) { // do something with the texture } else { // process without texture information } ... Thank you in advance! Cheers, Rômulo

Re: [osg-users] Material Properties to Change the Normal Intensity

2016-12-26 Thread Rômulo Cerqueira
Hi Sebastian, > > Are you planning on using the bump-maps alpha channel, or which alpha do you > plan to use. > I wanna to pass a reflectance value to be multiplied by the normal map (normNormal in fragment shader) to simulate real situations. For example, a steel cube (e.g. reflectance =

Re: [osg-users] Material Properties to Change the Normal Intensity

2016-12-25 Thread Rômulo Cerqueira
Hi SMesserschmidt, Thanks for your reply. I wanna set a refletance value for each scene's object and multiply it by normal value (e.g. Steel and aluminium have more reflectivity than wood and plastic). In this case, the alpha channel will change the object transparency, right? If yes, I think

Re: [osg-users] Material Properties to Change the Normal Intensity

2016-12-25 Thread Rômulo Cerqueira
Hi SMesserschmidt, Thanks for your reply. I wanna set a refletance value for each scene's object and multiply it by normal value (e.g. Steel and aluminium have more reflectivity than wood and plastic). In this case, the alpha channel will change the object transparency, right? If yes, I think

Re: [osg-users] Material Properties to Change the Normal Intensity

2016-12-26 Thread Rômulo Cerqueira
Hi Sebastian, I was having a look in the second option and it is easy to code (https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/uniform.php), however I'm not sure if I can set different reflectance in a scene with multiple objects. Maybe use the alpha channel is a better option. ...

Re: [osg-users] Material Properties to Change the Normal Intensity

2016-12-26 Thread Rômulo Cerqueira
Hi Sebastian, this is my vertex shader: Code: #version 130 out vec3 pos; out vec3 normal; out mat3 TBN; void main() { pos = (gl_ModelViewMatrix * gl_Vertex).xyz; normal = gl_NormalMatrix * gl_Normal; vec3 n = normalize(normal); vec3 t = normalize(gl_NormalMatrix[0]); vec3 b = cross(t, n);

[osg-users] Change Perspective to Orthogonal View

2017-03-05 Thread Rômulo Cerqueira
Hi, I like to change the current perspective view of my camera to an orthogonal projection, keeping the same position. How can I do this? My current code of perspective camera: Code: _viewer->getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);

Re: [osg-users] Problem to load images

2017-08-15 Thread Rômulo Cerqueira
Hi Robert, thanks for your reply. Follows my code: Code: #define BOOST_TEST_MODULE "NormalMapping_test" #include // OpenSceneGraph includes #include #include #include #include #include #include #include #include // Rock includes #include #include // OpenCV includes #include

Re: [osg-users] Problem to load images

2017-08-12 Thread Rômulo Cerqueira
Hi Trace and Nick, this attachment is my output when I perform the following commands: Code: export OSG_NOTIFY_LEVEL=DEBUG osgviewer --image gray_texture_d.jpg ... Thank you! Cheers, Rômulo -- Read this topic online here:

Re: [osg-users] Problem to load images

2017-08-13 Thread Rômulo Cerqueira
Hi Nick and Robert, the attached file is the output from my C++ program. Any suggestions to solve that? Thanks in advance, Rômulo Cerqueira -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=71407#71407 Attachments: http

Re: [osg-users] CullVisitor::apply(Geode&) detected NaN,

2017-09-01 Thread Rômulo Cerqueira
Ok Robert, this is my current code (only .cpp): Code: #include "ImageViewerCaptureTool.hpp" #include #include #include namespace normal_depth_map { ImageViewerCaptureTool::ImageViewerCaptureTool(uint width, uint height) { // initialize the hide viewer; initializeProperties(width,

[osg-users] CullVisitor::apply(Geode&) detected NaN,

2017-08-30 Thread Rômulo Cerqueira
Hi, I have the following message when I run my OSG application: Code: CullVisitor::apply(Geode&) detected NaN, depth=nan, center=(1.79588 1.50488 1.42179), matrix={ nan nan -nan -nan nan nan -nan -nan nan nan -nan -nan nan nan -nan -nan } What this kind of warning/error means? ...

Re: [osg-users] CullVisitor::apply(Geode&) detected NaN,

2017-09-02 Thread Rômulo Cerqueira
Hi guys, I found and solved the problem! :D When I grab the osg scene at first time, my view matrix is NaN; from the second time, this matrix is correctly filled. Then, I modified the grabImage method to replace when the view matrix is NaN by the identity matrix, as follows: Code:

Re: [osg-users] CullVisitor::apply(Geode&) detected NaN,

2017-08-31 Thread Rômulo Cerqueira
Up! Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=71574#71574 ___ osg-users mailing list osg-users@lists.openscenegraph.org

[osg-users] Dynamic Cubemap with OSG and Shader

2017-12-04 Thread Rômulo Cerqueira
Hi, I would like to use the dynamic cubemaps to reproduce the mirror effects in my application, however I found few examples on the internet. Is there any example code related to this topic? I will appreciate that. ... Thank you! Cheers, Rômulo -- Read this topic online

Re: [osg-users] dynamic cube map

2017-12-04 Thread Rômulo Cerqueira
Hi, I would like to use the dynamic cubemaps to reproduce the mirror effects in my application, however I found few examples on the internet. Do you have any code about dynamic cubemaps to suggest me? ... Thank you! Cheers, Rômulo -- Read this topic online here:

Re: [osg-users] dynamic cube map

2017-12-18 Thread Rômulo Cerqueira
Hi Nick, I still need help to get the normal/depth data from reflected objects. Could you have a look in my current code? C++ code: Code: // OSG includes #include #include #include #include #include #include #include #include #include #include #include #include // C++ includes

Re: [osg-users] dynamic cube map

2017-12-19 Thread Rômulo Cerqueira
Hi, I got the depth data from reflected objects. I needed to render the depth buffer to texture. Follows my update code: C++ code: Code: // OSG includes #include #include #include #include #include #include #include #include #include #include #include #include // C++ includes

Re: [osg-users] Normal Mapping using Dynamic Cubemap

2017-12-19 Thread Rômulo Cerqueira
Hi Sebastian, can you help me to find an example? I've been looking for this solution for almost two months. ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72612#72612

[osg-users] Normal Mapping using Dynamic Cubemap

2017-12-18 Thread Rômulo Cerqueira
Hi, is it possible to generate dynamic cubemaps (with normal mapping textures)? ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72606#72606 ___ osg-users mailing

Re: [osg-users] Warning: Error in reading to jpg images

2017-11-05 Thread Rômulo Cerqueira
Follows attached my output info when OSG_NOTIFY_LEVEL = DEBUG. ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72310#72310 Attachments: http://forum.openscenegraph.org//files/debug_596.txt

Re: [osg-users] Warning: Error in reading to jpg images

2017-11-07 Thread Rômulo Cerqueira
Hi Christian and Robert, I solved in an alternative way: converting my images to PNG. I did not change anything in the source code and it worked! ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72323#72323

[osg-users] TBN Matrix for Normal Mapping - OSG and GLSL

2017-11-07 Thread Rômulo Cerqueira
Hi, I have used normal mapping using GLSL and OSG for my application (an imaging sonar simulation) and I got problems by calculating the TBN matrix on shaders. The normal vectors contain lower resolution on border in comparison with the center of image. Follows my vertex code: Code:

Re: [osg-users] TBN Matrix for Normal Mapping - OSG and GLSL

2017-11-08 Thread Rômulo Cerqueira
Hi Jordi and Sebastian, thanks for your replies. I will have a look on osg::TangentSpaceVisitor, however I have a question: I will have in my OSG scene a lot of objects with/without normal mapping. How can I handle different normal textures using the same osg::TangentSpaceVisitor? ... Thank

[osg-users] Warning: Error in reading to jpg images

2017-11-04 Thread Rômulo Cerqueira
Hi community! I got some problems by loading JPG images using OSG. When I read them directly using osgviewer, the images are loaded with success. Code: osgviewer --image /home/romulo/gray_texture_n.jpg However, the problem occurs when I read the images by OSG code, as presented in my

Re: [osg-users] dynamic cube map

2017-12-08 Thread Rômulo Cerqueira
Thanks a lot, Nick. I will have a look in this source code. If I have some doubts, I will ask. ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72552#72552 ___

Re: [osg-users] dynamic cube map

2017-12-05 Thread Rômulo Cerqueira
Thanks a lot, Robert! Do you have some example with dynamic cube map with OSG and GLSL? ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72540#72540 ___ osg-users

Re: [osg-users] dynamic cube map

2017-12-05 Thread Rômulo Cerqueira
Hi Robert, my idea is to compute the secondary reflections by using dynamic cubemap. I need to get the normal and depth from cube map reflections. Is it possible? ... Thank you! Cheers, Rômulo -- Read this topic online here:

Re: [osg-users] dynamic cube map

2017-12-11 Thread Rômulo Cerqueira
Hi Nick, how can I encode the normal and depth data in the env texture? ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72565#72565 ___ osg-users mailing list

Re: [osg-users] dynamic cube map

2017-12-09 Thread Rômulo Cerqueira
Hi Nick, I have a deep look in your code and I have a doubt. The cube mapping results provides the reflected color. Is it possible to get the normal and depth instead of the reflected color? Best regards, ... Thank you! Cheers, Rômulo -- Read this topic online here:

Re: [osg-users] Problems with MRT

2018-05-14 Thread Rômulo Cerqueira
Folks! Any tips here? Thanks in advance, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73636#73636 ___ osg-users mailing list osg-users@lists.openscenegraph.org

Re: [osg-users] FBO-RTT doubt

2018-05-12 Thread Rômulo Cerqueira
Hi Robert, thanks for your reply. Nowadays this topic is outdated. I will create a new topic in OSG forum and explain better the scenario. Thanks for the tip. ... Thank you! Cheers, Rômulo -- Read this topic online here:

[osg-users] MRT doubts

2018-05-12 Thread Rômulo Cerqueira
iewMatrix( osg::Matrixd::identity() ); postRenderCamera->setProjectionMatrix( osg::Matrixd::identity() ); postRenderCamera->addChild( geode ); root->addChild(postRenderCamera); // setup the callback SnapImage* finalDrawCallback = new SnapImage(viewer.getCamera()->get

Re: [osg-users] Problems with MRT

2018-05-18 Thread Rômulo Cerqueira
Hi Sebastian and Julien, thanks for your comments. I tried your suggestions without success, even output image in different formats (BMP, PNG, TIFF...). It is funny, because I can handle the image data as GL_FLOAT, but the image is only properly written in disk as UNSIGNED_BYTE. At this

Re: [osg-users] Problems with MRT

2018-05-15 Thread Rômulo Cerqueira
Hi, just updating my progress: What have I got so far? [ ✓ ] Allow rendering for color or depth buffers on the same camera; [ ✓ ] Display only the color buffer in the post render camera; [ ✓ ] Read color or depth buffer in the final draw callback; [ ✗ ] Write collected image (color or depth) in

[osg-users] FBO-RTT doubt

2018-04-30 Thread Rômulo Cerqueira
botics/simulation-normal_depth_map/blob/master/src/ImageViewerCaptureTool.hpp - ImageViewerCaptureTool.cpp: https://github.com/Brazilian-Institute-of-Robotics/simulation-normal_depth_map/blob/master/src/ImageViewerCaptureTool.cpp Thanks in advance, Rômulo Cerqueira[/url] -- Read this

Re: [osg-users] Normal Mapping using Dynamic Cubemap

2018-01-11 Thread Rômulo Cerqueira
Hi Sebastian, I believe copying and pasting code is not the case here. I have read a lot about MRT, RTT and FBO and debugged some source code examples (including your hints), however I still have problems in my side to compute the normal. So let's go to new doubts: - In Kapelko's example, if I

Re: [osg-users] Normal Mapping using Dynamic Cubemap

2018-01-11 Thread Rômulo Cerqueira
Moreover, I installed the openscenegraph-examples package (using Ubuntu), however the osgdeferred example does not contain all complementary data (i.e. data/shaders/simpleShader01, data/shaders/colorTextureShader and data/shaders/lightingPass). I could not find these shader codes in

Re: [osg-users] Normal Mapping using Dynamic Cubemap

2018-01-29 Thread Rômulo Cerqueira
Hi, I still have problems to manage the normal view from reflected objects (using dynamic cubemaps technique). Please any tip here? ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72885#72885

Re: [osg-users] Normal Mapping using Dynamic Cubemap

2018-02-03 Thread Rômulo Cerqueira
Hi Sebastian, thanks for all comments. Do you know how I can manage these six faces of cubemap? I can handle all faces using one texture or I need to create six textures? I really need help with this...It's essential to my project. ... Thank you! Cheers, Rômulo -- Read this

Re: [osg-users] Normal Mapping using Dynamic Cubemap

2018-02-03 Thread Rômulo Cerqueira
Hi Sebastian, I have managed the normal and depth using MRT-FBO. I changed the osgdeferred example to display the normal (blue) and depth (green). Now I need to repeat this process for each six faces of cubemap. I have a question: to capture the normal/depth data, as seen in Figure, I used

Re: [osg-users] Normal Mapping using Dynamic Cubemap

2017-12-26 Thread Rômulo Cerqueira
Hi Roberto and Sebastian, sorry for my duplicated post. I need to render the depth/normal surface to texture of reflected objects by cube maps. Until this moment, I got the depth data. Could you help me to get the normal data too (as single channel data). My current code follows below: C++

[osg-users] Problem with output - OSG/Shader

2018-08-04 Thread Rômulo Cerqueira
Hi, I would like to write the output/buffer of fragment shader to texture (RTT) as I wish (e.g. all red), however this result is depending of the model's shapes visible in the scene. How can I proceed with this correctly? Follow below my minimal source code and the results. Thanks in advance!

Re: [osg-users] Problem with output - OSG/Shader

2018-08-05 Thread Rômulo Cerqueira
Hi Johny, I would like to draw what I want... the red was just an example. My main goal is to simulate the reverberation phenomena using rasterization (for the first reflection) + ray tracing (for the second reflection). I would like to output the surface of reflected scenes, which are always

Re: [osg-users] Cheaper way to implement rendering-to-texture and post-processing pipeline?

2018-04-23 Thread Rômulo Cerqueira
Folks, is there any example to implement FBO without cameras? Where can I find it? ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73488#73488 ___ osg-users mailing

Re: [osg-users] osg::Vec3Array as uniform to Shader

2018-03-03 Thread Rômulo Cerqueira
Hi, I found a way to solve this problem: converting the array to texture. Follows an example: Code: osg::ref_ptr image = new osg::Image; image->setImage(myVec3Array->size(), 1, 1, GL_RGBA8, GL_RGBA, GL_FLOAT, (unsigned char*) [0], osg::Image::NO_DELETE); osg::ref_ptr texture = new

[osg-users] osg::Vec3Array as uniform to Shader

2018-03-03 Thread Rômulo Cerqueira
Hi, can I pass a osg::Vec3Array as uniform to Shader? ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73010#73010 ___ osg-users mailing list

Re: [osg-users] osg::Vec3Array as uniform to Shader

2018-03-05 Thread Rômulo Cerqueira
Thanks, Robert. ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73022#73022 ___ osg-users mailing list osg-users@lists.openscenegraph.org

[osg-users] Read Image from RTT

2018-09-27 Thread Rômulo Cerqueira
Hi, I have tried to read image from RTT (where the image is "not attached", but available on buffer) using a osg::Camera::DrawCallback, the compilation is working, however the executable brings me a segmentation fault during image rendering. How can I solve this? Code:

Re: [osg-users] Read Image from RTT

2018-09-27 Thread Rômulo Cerqueira
Hi Martin, I never faced with this problem. Do you have some tip to solve it? ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=74984#74984 ___ osg-users mailing list

Re: [osg-users] Read Image from RTT

2018-09-27 Thread Rômulo Cerqueira
Solved the problem! Perhaps readImageFromCurentTexture() works only with osg::ref_ptr instead of osg::Image*. ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=74986#74986

Re: [osg-users] Resizing FBO camera while rendering

2018-10-02 Thread Rômulo Cerqueira
Hi Robert, I use the method setupViewer() "to resize" the FBO as well (by instantiating the viewer, camera, texture and callback again). This approach was the best way so far to minimize this problem. ... Thank you! Cheers, Rômulo -- Read this topic online here:

Re: [osg-users] Resizing FBO camera while rendering

2018-10-02 Thread Rômulo Cerqueira
Hi, > So you are setting a whole new graphics context and associated data on > each resize? Yes, Robert. ... Thank you! Cheers, Rômulo -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75019#75019

Re: [osg-users] Resizing FBO camera while rendering

2018-10-02 Thread Rômulo Cerqueira
Hi Robert, I use the method setupViewer() "to resize" the FBO as well (by instantiating the viewer, camera, texture and callback again). This approach was the best way so far to minimize this problem. ... Thank you! Cheers, Rômulo -- Read this topic online here:

Re: [osg-users] Resizing FBO camera while rendering

2018-10-02 Thread Rômulo Cerqueira
> Is it only the FBO that is forcing you to do this? Yes. Do you have any tip how can I solve this issue? I found similar problems into links below, but I could not have the same success. https://groups.google.com/forum/#!topic/osg-users/Oxb9QF8Myyo

[osg-users] Resizing FBO camera while rendering

2018-10-01 Thread Rômulo Cerqueira
Hi, I have rendered a FBO camera to image by using a callback (as seen in the code below), however some OpenGL warnings/erros are raised when I resize at runtime by setupViewer() method. I debugged the code by using Code: export OSG_GL_ERROR_CHECKING=ON and got the following error: