Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 12:20

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 29.07.2007, 22:08 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Some people have reported that the Knight sample doesn't work on older cards or drivers. The reason for this is that the postprocessing shader is using a for-loop which is not supported on all hardware.

Here is a quick fix for the postprocessing.shader.xml file:

Code:
<Shader>
   <Context id="RADIALBLUR">
      <RenderConfig writeDepth="false" />
      
      <VertexShader>
         <DefCode>
         <![CDATA[
            void main( void )
            {
               gl_TexCoord[0] = gl_MultiTexCoord0;
               gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
            }
         ]]>
         </DefCode>
      </VertexShader>
      
      <FragmentShader>
         <DefCode>
         <![CDATA[
            uniform sampler2D buf0;
            uniform vec4 radblurParams;
            
            
            void main( void )
            {
               vec4 sum = vec4( 0, 0, 0, 0 );
               vec2 coord = gl_TexCoord[0].xy;
               vec2 distToCenter = vec2( 0.5, 0.5 ) - coord;
               
               
               // Unrolled loop (for older cards like Radeon 9600)
               sum += texture2D( buf0, coord );
               coord += distToCenter * radblurParams.x;
               sum += texture2D( buf0, coord );
               coord += distToCenter * radblurParams.x;
               sum += texture2D( buf0, coord );
               coord += distToCenter * radblurParams.x;
               sum += texture2D( buf0, coord );
               coord += distToCenter * radblurParams.x;
               
               gl_FragColor = sum / 4.0;
            }
         ]]>
         </DefCode>
      </FragmentShader>
   </Context>
</Shader>


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 13 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:  
Powered by phpBB® Forum Software © phpBB Group