User Tag List

Results 1 to 2 of 2

Thread: Zoom Pixel Shader (Request)

  1. #1
    Clicker Fusion 2.5 DeveloperSWF Export ModuleMac Export Module

    Join Date
    Jan 2009
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Zoom Pixel Shader (Request)

    Hi,

    I've been making a zoom function in my game and I've been using "complex software's zoom shader", but the pixel shader I found makes some sort of border around everything as you can see on this picture:

    Click image for larger version. 

Name:	first.jpg 
Views:	417 
Size:	14.5 KB 
ID:	7471
    Click image for larger version. 

Name:	second.jpg 
Views:	357 
Size:	16.0 KB 
ID:	7472
    (The clouds aren't supposed to have that gray/black border on the bottom)

    Since I am using another shader to do the reflection in the water, the zoom shader is putting an outline on that object and makes it appear as a black box :/

    I was wondering if it's possible to make a shader that zooms in without adding that weird border around everything.

    Here is the code for the shader I'm using if that's any help:
    Code:
    // Pixel shader input structure
    struct PS_INPUT
    {
        float4 Position   : POSITION;
        float2 Texture    : TEXCOORD0;
    };
    
    // Pixel shader output structure
    struct PS_OUTPUT
    {
        float4 Color   : COLOR0;
    };
    
    // Global variables
    sampler2D Tex0;
    
    float fWidth;
    float fHeight;
    float fZoomX;
    float fZoomY;
    
    PS_OUTPUT ps_main( in PS_INPUT In )
    {
        // Output pixel
        PS_OUTPUT Out;
    	
        In.Texture.x = In.Texture.x + fZoomX*(fWidth-1.0f);
    	In.Texture.y = In.Texture.y + fZoomY*(fHeight-1.0f);
    	Out.Color = tex2D(Tex0, float2(In.Texture.x/fWidth,In.Texture.y/fHeight));
    	
        return Out;
    }
    
    // Effect technique
    technique tech_main
    {
        pass P0
        {
            // shaders
            VertexShader = NULL;
            PixelShader  = compile ps_2_0 ps_main();
        }  
    }

  2. #2
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)
    That's because it interpolates the pixels and the pixels without any colour are black because that's your transparent color. Make an alpha channel for those and fill the transparent areas with the border color.

Similar Threads

  1. Request pixel shader "Convex polygon"
    By SEELE in forum Hardware Accelerated Runtime
    Replies: 33
    Last Post: 4th August 2013, 10:17 PM
  2. Tilemap Pixel Shader (aka "texture atlas" shader)
    By MuddyMole in forum Hardware Accelerated Runtime
    Replies: 3
    Last Post: 10th May 2013, 08:21 PM
  3. Zoom Shader without Blur
    By frogman200 in forum Hardware Accelerated Runtime
    Replies: 3
    Last Post: 4th January 2011, 02:13 PM
  4. Pixel shader request.
    By Nifflas in forum Hardware Accelerated Runtime
    Replies: 5
    Last Post: 8th May 2008, 11:50 AM
  5. Sub-Pixel Positioning Pixel Shader
    By LazyCoder in forum Hardware Accelerated Runtime
    Replies: 15
    Last Post: 16th March 2008, 11:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •