[osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-01 Thread antiro black
Hi, I am converting a project written in pure opengl to use OSG to improve compatibility and reduce maintenance. The original project used a deferred rendering pipeline with a pretty big set of custom shaders. I would like to reuse these shaders with minimum adjustments. In order to do this I

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-01 Thread antiro black
Hi Sebastian, Thanks for the quick response. The osg_XXX matrices work perfectly. The setUseVertexAttributeAliasing() however does not seem to work. Where I had some output before, now don't get anything with it enabled Does osg always give the exact layout which you posted? or is this dependen

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-01 Thread antiro black
Hi Sebastian, I was under the impression that the "layout(...) in ..." command was essentially a variable declaration and that hence only the location and type needed to match. I now also changed the name, this does not seem to have any effect though.. new vertex shader code: Code: #version 3

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-01 Thread antiro black
Hi Sebastian, I'm using the latest stable version from git (which is indeed 3.4.something). I applied it to the camera of the viewer. Should I have also changed the state of the camera's which are used to render to the textures (they are part of the scenegraph of the viewer)? After trying every

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-02 Thread antiro black
Hi, When using the shaders to render only one of color/normal/position to a normal viewer/camera (not to a texture) they all seem to work. I continued to modify a small MRT example which used older shader code which relied on gl_Vertex / gl_Normal etc. The moment I added a setUseVertexAttribu

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-02 Thread antiro black
Hi, I'm still struggling with getting setUseVertexAttributeAliasing(true) to combine rendering to textures. To this end, I made made a tiny change to the osgmultiplerendertargets example to see if I could adapt that example to work with setUseVertexAttributeAliasing(true). Aside from adding s

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-02 Thread antiro black
Hi Sebastian, I'm compiling under debian jessie 64 bits and am running a NVIDIA GTX 970. The drivers have been updates recently and I am running version 384.69 now. I included a compilable minimal example based on the osgmultiplerendertargets example. Without VertexAttributeAliasing it generate

Re: [osg-users] using modern shaders with osg - setting vertex attribute layout

2017-09-03 Thread antiro black
Hi Sebastian, Thank you so much for all the time you've put into this! After adding the shaders to the CreateTextureDisplayQuad() function in the big project which I'm porting to OSG, it now also has the same output with aliasing on. I would have probably spend weeks hitting my head against the

[osg-users] Multiple pointlights deferred rendering in OSG, how to setup scenegraph?

2017-09-08 Thread antiro black
Hi, I'm slowly porting my pure opengl deferred rendering engine to make it OSG based. In the original project I kept track of a list of all point lights. For each light I'd store its properties and a light volume. When rendering a frame, I'd go over this list and do a stencil pass followed by

[osg-users] Problem blending multiple render passes

2017-09-09 Thread antiro black
Hi, I'm trying to compute the effect of multiple lights in a deferred shading setup. The subgraph of my scenegraph which is supposed to take care of this consists of a root node with a number of RTT cameras as children. All cameras are configured to write the effect of a single light to the exa

Re: [osg-users] Problem blending multiple render passes

2017-09-09 Thread antiro black
Hi Sebastian, So I screwed up on both the color clearing and the depth writing, I tried to disable both is follows. On the cameras: Code: //Disable depth buffer writing osg::ref_ptr depth = new osg::Depth(osg::Depth::LESS,0,1,false); camera->getOrCreateStateSet()->setAttribute(depth); //Disabl

Re: [osg-users] Problem blending multiple render passes

2017-09-09 Thread antiro black
Hi, 1. I enabled blending on the root node of the subtree containing the camera's, I'm assuming this is carried over to the camera nodes. 2. I am using deferred rendering, all lighting calculations are based on the information in the GBuffer. I tried to get it to work with one camera and a sub

[osg-users] Executing subtree multiple times / repeater node?

2017-09-14 Thread antiro black
Hi, I am implementing a Gaussian blur effect by alternating between a horizontal and a vertical blur shader (in the implementation they are the same shader, switching based on a uniform). In OSG I managed to implement this by adding the two shaders to geometry nodes containing a screen sized q

Re: [osg-users] Post Processing Effect - Vertex Shader not working

2017-09-16 Thread antiro black
Hi Guy, Have you enabled the tracking of model,view and projection matrices as well as the vertex attribute aliasing? I use this in my own code: // switch on the uniforms that track the modelview and projection matrices mViewer->getCamera()->getGraphicsContext()->getState()->setUseModelViewAndPro

[osg-users] Passing input to viewer/camera (using osg with custom input handler)

2017-09-16 Thread antiro black
Hi, I am trying to incorporate OSG into a system that has its own input handling and abstraction layers. Most of the input is handled by the different components of the system, but I want OSG to handle the camera input. As such I need forward a part of my input to the OSG viewer (or perhaps direct

[osg-users] Specifying indices of triangle vertices when creating osg::geometry

2017-12-21 Thread antiro black
Hi, I want to create a specific mesh using osg. I have a set of vertices and a set of indices for the triangles which the mesh should consist of. I tried using osg::geometry to create this mesh but I can't figure out how to specify the triangle vertex indices. Do I need an osg::IndexArray for t

[osg-users] problem setting texture min/mag filter

2018-02-11 Thread antiro black
Hi, I'm trying to use a texture to get some data to a shader. The texure is created by first creating an osg::Image, setting its pixel values manually and then assigning the image to a texture. I have verified that the image is created correctly by writing it to a file. As for the actual textu

Re: [osg-users] problem setting texture min/mag filter

2018-02-19 Thread antiro black
Hi, Thank you for response robertos, I've been playing around with the code the last few days and it seems like the filters are doing something, it is just not what I expected. I'm wondering if I misinterpreted the meaning of a "NEAREST" filter. As I understand it, putting both the min and mag

Re: [osg-users] problem setting texture min/mag filter

2018-02-20 Thread antiro black
Hi, As far as I can tell it does not seem to be rendering related, the shader is really sampling data from the texture that was never in the original image. A summary of my experiments: Input is an image which is half red (255,0,0) and half black (0,0,0) and it is set as a texture for the shad

Re: [osg-users] problem setting texture min/mag filter

2018-02-20 Thread antiro black
Hi, I made an executable example based on the osgtexture2D example. I removed the code to render the different walls of the cube with the exception of the filter wall. I kept the rest as close to the original as possible. changes to the code have been marked using comments. Essentially all I'm

Re: [osg-users] problem setting texture min/mag filter

2018-02-20 Thread antiro black
Hi Robertos, setting "texture->setResizeNonPowerOfTwoHint(false);" fixed the problem After being stuck on this problem for more than a week I can safely say that I would never have found that without your help. I checked the data after generating the image at which point it was still OK, bu