Horde3D

Next-Generation Graphics Engine
It is currently 15.10.2024, 19:17

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 04.03.2012, 16:01 
Offline

Joined: 30.12.2011, 14:17
Posts: 2
Hi guys, I'm presently trying to implement a few post-processing effects in a pipeline (basically at an experimental stage atm), but I can't seem to get things to work.

My custom pipeline is, to a large extent, simply the forward light one extended with a post-processing stage, and it looks something like:
Code:
<Pipeline>
   <Setup>
      <RenderTarget id="PRBUFFER" depthBuf="true" numColBufs="1" format="RGBA8" scale="1.0" />
   </Setup>

   <CommandQueue>
      <Stage id="Geometry" link="pipelines/globalSettings.material.xml">
         <SwitchTarget target="PRBUFFER"/>
         <ClearTarget depthBuf="true" colBuf0="true"/>
         
         <DrawGeometry context="AMBIENT" class="~Translucent"/>
         <DoForwardLightLoop class="~Translucent"/>
         
         <DrawGeometry context="TRANSLUCENT" class="Translucent" order="BACK_TO_FRONT"/>
      </Stage>
      
      <Stage id="PostProcess">
         <SwitchTarget target=""/>
         <ClearTarget colBuf0="true"/>
         
         <BindBuffer sampler="buf0" sourceRT="PRBUFFER" bufIndex="0"/>
         <DrawQuad material="materials/pproc.material.xml" context="PPROC"/>
         <UnbindBuffers/>
      </Stage>
      
      <Stage id="Overlays">
         <DrawOverlays contexc="OVERLAY"/>
      </Stage>
      
   </CommandQueue>
</Pipeline>

The referenced "pproc" material looks like
Code:
<Material>
   <Shader source="shaders/pproc.shader"/>
</Material>

And that shader contains
Code:
[[FX]]

sampler2D buf0 = sampler_state
{
   Address = Clamp;
};

context PPROC
{
   VertexShader = compile GLSL VS_FSQUAD;
   PixelShader = compile GLSL FS_PPROC;

   ZWriteEnable = false;
}

[[VS_FSQUAD]]
uniform mat4 projMat;
attribute vec3 vertPos;
varying vec2 texCoords;
            
void main( void )
{
   texCoords = vertPos.xy;
   gl_Position = projMat*vec4(vertPos, 1);
}

[[FS_PPROC]]
uniform sampler2D buf0;
varying vec2 texCoord;

void main(void)
{
   gl_FragColor = texture2D(buf0, texCoord);
}

Now, as far as I've understood things, this ought to produce output that is identical to a normal forward lighting pass, as the post-processing pass actually doesn't do anything yet. Except, the result is that the entire screen is rendered in a single-colour (which one changes as you look around, so at least *something* is happening). Removing the post-processing stage and setting the render target to "" for the first stage results in the scene looking exactly as expected.

So, what am I missing or doing wrong?


Top
 Profile  
Reply with quote  
PostPosted: 04.03.2012, 17:23 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
Looks like simple typo. You have texCoords in vertex shader, but texCoord in pixel. That could be a problem.


Top
 Profile  
Reply with quote  
PostPosted: 04.03.2012, 18:21 
Offline

Joined: 30.12.2011, 14:17
Posts: 2
God damn, how did I miss that? I poured over the stuff for hours before posting about it here... Guess I'll blame it on sleep deprivation.

Anyway, thanks, that cleared everything up!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group