Hi I am having so much trouble in applying post effects when you have 3 cameras active in one frame.
First camera - which renders game play section of the game. Second Camera - GUI layer. Third Camera - Back Ground and animations.
Here I am trying to apply post processing effects like blur and bloom on the first camera, Which works fine but here comes the issue while post effects are enabled GUI, Back Ground animations are not visible but i am sure they are drawn. And if I give all the cameras as input render targets then i can see all the objects in that scene.
Not sure why this is happening can anyone please explain me what could be the reason thank you. Here I am Adding the Opengl Call log to see what exactly i am doing.
Problem is at Stats_layer and HudPage_layer they are not displayed after the post effects are enabled.
Marker: SceneBegin: ClearCamera
glBindFramebufferEXT(GL_FRAMEBUFFER, 2)
glClearColor(0, 0, 0, 1)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, {1})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glMatrixMode(GL_PROJECTION)
glLoadMatrixf({2.7457316, 0, 0, 0} {0, 0, 1.0001999, 1} {0, 1.8304877, 0, 0} {0, 0, -0.20001999, 0})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
Marker: RenderGroup: ClearCamera - Opaque
Marker: RenderGroup: ClearCamera - Immediate
Marker: RenderGroup: ClearCamera - Transparent
Marker: RenderGroup: ClearCamera - Overlay
Marker: PostProcess: PMaterial_GodRays_RadialBlur__2
glBindFramebufferEXT(GL_FRAMEBUFFER, 2)
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glMatrixMode(GL_PROJECTION)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glColor4f(0, 0, 0, 1)
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, {0, 0, 0, 1})
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, {0, 0, 0, 1})
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, {0, 0, 0, 1})
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0)
glActiveTexture(GL_TEXTURE0)
glDisable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, 0)
glMatrixMode(GL_TEXTURE)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glUniform2fv(0, 1, {0.5, 0.49836433})
glUniform1fv(1, 1, {0.050000001})
glActiveTexture(GL_TEXTURE1)
glBindTexture(GL_TEXTURE_2D, 88) [Context 1 - Texture 88: Context 1 - Texture 88]
glUniform1i(2, 1)
glBindBuffer(GL_ARRAY_BUFFER, 163)
glEnableClientState(GL_VERTEX_ARRAY)
glVertexPointer(3, GL_FLOAT, 32, 0x00000000)
glEnableClientState(GL_NORMAL_ARRAY)
glNormalPointer(GL_FLOAT, 32, 0x0000000C)
glClientActiveTexture(GL_TEXTURE0)
glEnableClientState(GL_TEXTURE_COORD_ARRAY)
glTexCoordPointer(2, GL_FLOAT, 32, 0x00000018)
glEnableVertexAttribArray(0)
glVertexAttribPointer(0, 3, GL_FLOAT, FALSE, 32, 0x00000000)
glEnableVertexAttribArray(1)
glVertexAttribPointer(1, 2, GL_FLOAT, FALSE, 32, 0x00000018)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 164)
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0x00000000)
glDisableClientState(GL_VERTEX_ARRAY)
glDisableClientState(GL_NORMAL_ARRAY)
glClientActiveTexture(GL_TEXTURE0)
glDisableClientState(GL_TEXTURE_COORD_ARRAY)
glDisableVertexAttribArray(0)
glDisableVertexAttribArray(1)
Marker: SceneBegin: ClearCamera
glBindFramebufferEXT(GL_FRAMEBUFFER, 3)
glClearColor(0, 0, 0, 1)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, {1})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glMatrixMode(GL_PROJECTION)
glLoadMatrixf({2.7457316, 0, 0, 0} {0, 0, 1.0001999, 1} {0, 1.8304877, 0, 0} {0, 0, -0.20001999, 0})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
Marker: RenderGroup: ClearCamera - Opaque
Marker: RenderGroup: ClearCamera - Immediate
Marker: RenderGroup: ClearCamera - Transparent
Marker: RenderGroup: ClearCamera - Overlay
Marker: PostProcess: PMaterial_GodRays_RadialBlur__3
glBindFramebufferEXT(GL_FRAMEBUFFER, 3)
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glMatrixMode(GL_PROJECTION)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glColor4f(0, 0, 0, 1)
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, {0, 0, 0, 1})
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, {0, 0, 0, 1})
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, {0, 0, 0, 1})
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0)
glActiveTexture(GL_TEXTURE0)
glDisable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, 0)
glMatrixMode(GL_TEXTURE)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glUniform2fv(0, 1, {0.5, 0.49836433})
glUniform1fv(1, 1, {0.1})
glActiveTexture(GL_TEXTURE1)
glBindTexture(GL_TEXTURE_2D, 87) [Context 1 - Texture 87: Context 1 - Texture 87]
glUniform1i(2, 1)
glBindBuffer(GL_ARRAY_BUFFER, 163)
glEnableClientState(GL_VERTEX_ARRAY)
glVertexPointer(3, GL_FLOAT, 32, 0x00000000)
glEnableClientState(GL_NORMAL_ARRAY)
glNormalPointer(GL_FLOAT, 32, 0x0000000C)
glClientActiveTexture(GL_TEXTURE0)
glEnableClientState(GL_TEXTURE_COORD_ARRAY)
glTexCoordPointer(2, GL_FLOAT, 32, 0x00000018)
glEnableVertexAttribArray(0)
glVertexAttribPointer(0, 3, GL_FLOAT, FALSE, 32, 0x00000000)
glEnableVertexAttribArray(1)
glVertexAttribPointer(1, 2, GL_FLOAT, FALSE, 32, 0x00000018)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 164)
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0x00000000)
glDisableClientState(GL_VERTEX_ARRAY)
glDisableClientState(GL_NORMAL_ARRAY)
glClientActiveTexture(GL_TEXTURE0)
glDisableClientState(GL_TEXTURE_COORD_ARRAY)
glDisableVertexAttribArray(0)
glDisableVertexAttribArray(1)
Marker: SceneBegin: STATS_LAYER
wglMakeCurrent(0x8C0119F2, 0x00010000)
glBindFramebufferEXT(GL_FRAMEBUFFER, 0)
glViewport(0, 0, 640, 960)
glScissor(0, 0, 640, 960)
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, {1})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glMatrixMode(GL_PROJECTION)
glLoadMatrixf({1, 0, 0, 0} {0, 0, 0.0066666668, 0} {0, 0.66666669, 0, 0} {0, 0, -0.33333334, 1})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
Marker: RenderGroup: STATS_LAYER - Opaque
Marker: RenderGroup: STATS_LAYER - Immediate
Marker: RenderGroup: STATS_LAYER - Transparent
Marker: RenderGroup: STATS_LAYER - Overlay
Marker: SceneBegin: HUDPAGE_LAYER
wglMakeCurrent(0x8C0119F2, 0x00010000)
glBindFramebufferEXT(GL_FRAMEBUFFER, 0)
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, {1})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
glMatrixMode(GL_PROJECTION)
glLoadMatrixf({1, 0, 0, 0} {0, 0, 0.0066666668, 0} {0, 0.66666669, 0, 0} {0, 0, -0.33333334, 1})
glMatrixMode(GL_MODELVIEW)
glLoadMatrixf({1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1})
Marker: RenderGroup: HUDPAGE_LAYER - Opaque
Marker: RenderGroup: HUDPAGE_LAYER - Immediate
Marker: RenderGroup: HUDPAGE_LAYER - Transparent
The Problem with the above question is with the way i am drawing objects once/before the post process is applied.
For example if i have 2 passes:
- Opaque.
- Transparent.
then i should be drawing Opaque objects in Opaque pass and transparent ones in the later one.
But instead for some reason(Noob me!) I am drawing opaque objects in a transparent pass.
I had to do a lot of debugging to found the root issue. I guess if we want to do graphics we have put things in a proper order before you start adding effects and stuff.
Learnt a lesson though(Hope i could post an answer with the code soon by making a sample project explaining the situation).
User contributions licensed under CC BY-SA 3.0