User Tag List

Page 5 of 5 FirstFirst ... 3 4 5
Results 41 to 45 of 45

Thread: Converting DX9 shaders to DX11

  1. #41
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleSWF Export ModuleFirefly 3D Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    fnkycoldmadeanr's Avatar
    Join Date
    Jul 2017
    Location
    Melbourne, Australia
    Posts
    244
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    @Camomano99 @Eurobercik @piscesdreams

    Does anyone know the original author for this?

    Are you on the community Discord @piscesdreams?


    Water DX11
    WaterDX11.zip

  2. #42
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    piscesdreams's Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    1,054
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    @fnkycoldmadeanr You save the day again! I can't thank you enough, seriously.

    I don't know the original author of this particular shader. I am unsure if I found it on this thread or somewhere else, but did find it strange there was no author info.

    I'm not on the Discord, but probably should get on there at some point. I honestly don't really use Discord, but should probably change that at some point.

    Thank you again - many, many thanks!!

  3. #43
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,699
    Mentioned
    133 Post(s)
    Tagged
    0 Thread(s)
    Could somebody please convert this ZoomBox shader for me? I tried to do it myself but I probably did something wrong because I got an error when I tried to compile the fxc file using defisym's tool.

    The shader is by @muddymole from this thread

    This is the XML file:

    Code:
    <effect>
    <name>ZoomBox</name>
    <description>Displays a window containing a zoomed portion of the background.</description>
    <author>Sketchy/MuddyMole</author>
    	<parameter>
    		<name>sourceX</name>
    		<code>sourceX</code>
    		<description>The x position of the source box</description>
    		<type>int</type>
    		<property>edit</property>
    	</parameter>
    	<parameter>
    		<name>sourceY</name>
    		<code>sourceY</code>
    		<description>The y position of the source box</description>
    		<type>int</type>
    		<property>edit</property>
    	</parameter>
    	<parameter>
    		<name>sourceWidth</name>
    		<code>sourceWidth</code>
    		<description>The width of the source box</description>
    		<type>int</type>
    		<property>edit</property>
    	</parameter>
    	<parameter>
    		<name>sourceHeight</name>
    		<code>sourceHeight</code>
    		<description>The height of the source box</description>
    		<type>int</type>
    		<property>edit</property>
    	</parameter>
    	<parameter>
    		<name>windowX</name>
    		<code>windowX</code>
    		<description>The x position of the window</description>
    		<type>int</type>
    		<property>edit</property>
    	</parameter>
    	<parameter>
    		<name>windowY</name>
    		<code>windowY</code>
    		<description>The y position of the window</description>
    		<type>int</type>
    		<property>edit</property>
    	</parameter>
    	<parameter>
    		<name>windowWidth</name>
    		<code>windowWidth</code>
    		<description>The width of the window</description>
    		<type>int</type>
    		<property>edit</property>
    	</parameter>
    	<parameter>
    		<name>windowHeight</name>
    		<code>windowHeight</code>
    		<description>The height of the window</description>
    		<type>int</type>
    		<property>edit</property>
    	</parameter>
    <BackgroundTexture>1</BackgroundTexture>
    </effect>
    This is the FX code:

    Code:
    sampler2D bkd : register(s1);
    int sourceX, sourceY, sourceWidth, sourceHeight, windowX, windowY, windowWidth, windowHeight;
    float fPixelWidth, fPixelHeight;
    
    float4 ps_main( in float2 In : TEXCOORD0 ) : COLOR0 {
    	
    	float4 outColor = float4( 0, 0, 0, 0 );
    
    	float wndMinX = windowX * fPixelWidth;
    	float wndMaxX = ( windowX + windowWidth ) * fPixelWidth;
    	float wndMinY = windowY * fPixelHeight;
    	float wndMaxY = ( windowY + windowHeight ) * fPixelHeight;
    
    	if ( In.x >= wndMinX && In.x <= wndMaxX && In.y >= wndMinY && In.y <= wndMaxY ) {
    		float srcMinX = sourceX * fPixelWidth;
    		float srcMaxX = ( sourceX + sourceWidth ) * fPixelWidth;
    		float srcMinY = sourceY * fPixelHeight;
    		float srcMaxY = ( sourceY + sourceHeight ) * fPixelHeight;		
    		float posX = ( In.x - wndMinX ) / ( wndMaxX - wndMinX );
    		float posY = ( In.y - wndMinY ) / ( wndMaxY - wndMinY );
    		float2 posXY = float2( lerp( srcMinX, srcMaxX, posX ), lerp( srcMinY, srcMaxY, posY ));
    		outColor = tex2D( bkd, posXY );
    	}
    
    	return outColor;
    }
    
    technique tech_main {
    	pass P0 {
    		PixelShader = compile ps_2_a ps_main();
    	}
    }
    This is my attempt to create the HLSL file from the FX code:

    Code:
    struct PS_INPUT
    {
      float2 texCoord : TEXCOORD0;
    };
    
    Texture2D<float4> bkd : register(t1);
    	sampler bkdSampler : register(s1);
    
    
    cbuffer PS_VARIABLES : register(b0)
    {
    int sourceX;
    int sourceY;
    int sourceWidth;
    int sourceHeight;
    int windowX;
    int windowY;
    int windowWidth;
    int windowHeight;
    };
    
    cbuffer PS_PIXELSIZE : register(b1)
    {
    	float fPixelWidth;
    	float fPixelHeight;
    };
    
    float4 ps_main( in PS_INPUT In ) : SV_TARGET {
    	
    	float4 outColor = float4( 0, 0, 0, 0 );
    
    	float wndMinX = windowX * fPixelWidth;
    	float wndMaxX = ( windowX + windowWidth ) * fPixelWidth;
    	float wndMinY = windowY * fPixelHeight;
    	float wndMaxY = ( windowY + windowHeight ) * fPixelHeight;
    
    	if ( In.x >= wndMinX && In.x <= wndMaxX && In.y >= wndMinY && In.y <= wndMaxY ) {
    		float srcMinX = sourceX * fPixelWidth;
    		float srcMaxX = ( sourceX + sourceWidth ) * fPixelWidth;
    		float srcMinY = sourceY * fPixelHeight;
    		float srcMaxY = ( sourceY + sourceHeight ) * fPixelHeight;		
    		float posX = ( In.x - wndMinX ) / ( wndMaxX - wndMinX );
    		float posY = ( In.y - wndMinY ) / ( wndMaxY - wndMinY );
    		float2 posXY = float2( lerp( srcMinX, srcMaxX, posX ), lerp( srcMinY, srcMaxY, posY ));
    		outColor = bkd.Sample(bkdSampler, xy)* In.Tint;
    				
    	}
    
    	return outColor;
    }
    This is the error defisym's tool gave me when I tried to compile the HLSL-->FXC:

    ZoomBox.hlsl(37,7-10): error X3018: invalid subscript 'x'
    Thanks!

  4. #44
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleSWF Export ModuleFirefly 3D Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    fnkycoldmadeanr's Avatar
    Join Date
    Jul 2017
    Location
    Melbourne, Australia
    Posts
    244
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Volnaiskra View Post
    Could somebody please convert this ZoomBox shader for me? ...



    Thanks!
    ZoomBox.zip


    So close

    In.x in dx11 becomes In.texCoord.x
    xy should have been PosXY

  5. #45
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,699
    Mentioned
    133 Post(s)
    Tagged
    0 Thread(s)
    Excellent! Thanks so much, fnky!

Page 5 of 5 FirstFirst ... 3 4 5

Similar Threads

  1. Replies: 4
    Last Post: 6th November 2014, 03:44 PM
  2. Flipping(giant, high animated) active objects without shaders(or any better shaders?)
    By DinnerSonic in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th September 2013, 12:57 PM
  3. Curious on converting pixel shaders to background
    By Pixelthief in forum Hardware Accelerated Runtime
    Replies: 13
    Last Post: 3rd May 2010, 07:01 PM
  4. Converting to Hex
    By XanderChaos in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 9th February 2009, 05:32 PM

Posting Permissions

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