MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

OllieDixon
MAME Fan
Reged: 09/26/14
Posts: 4
Send PM


HLSL scale2x not possible anymore?
#332331 - 09/26/14 07:32 AM


I love the look of scale2x and Real_Scanlines.png. In an older version of MAME, I used to be able to just replace the deconverge.fx with one set up to recreate hq2x or scale2x. I just started using MAME 154.. Something has changed i guess as it no longer works.

I know i could just use MAME Plus!... I just dislike it. Need to find random BIOS files and tons of random games don't work from the official mame set.

Any ideas?

EDIT: This is what i used to use.


Code:

//-----------------------------------------------------------------------------
// Scale2x Effect
//-----------------------------------------------------------------------------

texture Diffuse;

sampler DiffuseSampler = sampler_state
{
Texture = ;
MipFilter = POINT;
MinFilter = POINT;
MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
};

//-----------------------------------------------------------------------------
// Vertex Definitions
//-----------------------------------------------------------------------------

struct VS_OUTPUT
{
float4 Position : POSITION;
float2 TexCoord : TEXCOORD0;
float2 LeftCoord : TEXCOORD1;
float2 RightCoord : TEXCOORD2;
float2 TopCoord : TEXCOORD3;
float2 BottomCoord : TEXCOORD4;
};

struct VS_INPUT
{
float4 Position : POSITION;
float4 Color : COLOR0;
float2 TexCoord : TEXCOORD0;
};

struct PS_INPUT
{
float2 TexCoord : TEXCOORD0;
float2 LeftCoord : TEXCOORD1;
float2 RightCoord : TEXCOORD2;
float2 TopCoord : TEXCOORD3;
float2 BottomCoord : TEXCOORD4;
};

//-----------------------------------------------------------------------------
// Scale2x Vertex Shader
//-----------------------------------------------------------------------------

float TargetWidth;
float TargetHeight;

float RawWidth;
float RawHeight;

VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;

Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.x /= TargetWidth;
Output.Position.y /= TargetHeight;
Output.Position.y = 1.0f - Output.Position.y;
Output.Position.x -= 0.5f;
Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);

float2 PixWidth = float2(1.0f / RawWidth, 0.0f);
float2 PixHeight = float2(0.0f, 1.0f / RawHeight);

Output.TexCoord = Input.TexCoord;
Output.LeftCoord = Input.TexCoord - PixWidth;
Output.RightCoord = Input.TexCoord + PixWidth;
Output.TopCoord = Input.TexCoord - PixHeight;
Output.BottomCoord = Input.TexCoord + PixHeight;

return Output;
}

//-----------------------------------------------------------------------------
// Scale2x Pixel Shader
//-----------------------------------------------------------------------------

float4 ps_main(PS_INPUT Input) : COLOR
{
float4 Center = tex2D(DiffuseSampler, Input.TexCoord);
float4 Left = tex2D(DiffuseSampler, Input.LeftCoord);
float4 Right = tex2D(DiffuseSampler, Input.RightCoord);
float4 Up = tex2D(DiffuseSampler, Input.TopCoord);
float4 Bottom = tex2D(DiffuseSampler, Input.BottomCoord);

float2 PixelSize = frac(Input.TexCoord * float2(RawWidth, RawHeight));

// Split along the texel centerpoint
if(PixelSize.y >= 0.5f)
{
float4 swap = Up;
Up = Bottom;
Bottom = swap;
}

if(PixelSize.x >= 0.5f)
{
float4 swap = Left;
Left = Right;
Right = swap;
}

float Match1 = Up == Left;
float Match2 = Up != Right;
float Match3 = Left != Bottom;

if(Match1 && Match2 && Match3)
{
Center = Left;
}

return Center;
}

//-----------------------------------------------------------------------------
// Scale2x Effect
//-----------------------------------------------------------------------------

technique DeconvergeTechnique
{
pass Pass0
{
Lighting = FALSE;

VertexShader = compile vs_3_0 vs_main();
PixelShader = compile ps_3_0 ps_main();
}
}



Edited by OllieDixon (09/26/14 08:12 AM)



lamprey
MAME Fan
Reged: 12/01/11
Posts: 238
Send PM


Re: HLSL scale2x not possible anymore? new [Re: OllieDixon]
#332332 - 09/26/14 07:59 AM


I'm not sure what version of mame you are talking about as I never used scale2x nor Real_Scanlines. Here are a couple of links that may or may not help:

http://www.aep-emu.de/PNphpBB2-file-viewtopic-t-18991.html

http://shmups.system11.org/viewtopic.php?p=961794&sid=843fd5d557e22cfd243f586b26ff729f#p961794

EDIT: If it helps, here is a link to the translated version of the first link:

https://translate.google.com/translate?s...&edit-text=

Edited by lamprey (09/26/14 08:00 AM)



Mamesick
Troll Lamer
Reged: 09/21/03
Posts: 1649
Loc: Italy
Send PM


Re: HLSL scale2x not possible anymore? new [Re: lamprey]
#332333 - 09/26/14 08:58 AM


Real_Scanlines.png is an overlay effect made by me and distributed with MAMEUIFX. My build doesn't support SCALE2X so I don't know for the rest.



OllieDixon
MAME Fan
Reged: 09/26/14
Posts: 4
Send PM


Re: HLSL scale2x not possible anymore? new [Re: Mamesick]
#332334 - 09/26/14 09:24 AM


Yea. I copy the png over to all my mame artwork folders. Been doing it for quite a while.



Outrun2006
MAME Fan
Reged: 03/15/07
Posts: 557
Send PM


Re: HLSL scale2x not possible anymore? new [Re: OllieDixon]
#332461 - 09/28/14 02:44 PM


whats wrong with the default scanline effects built into HLSL?



OllieDixon
MAME Fan
Reged: 09/26/14
Posts: 4
Send PM


Re: HLSL scale2x not possible anymore? new [Re: Outrun2006]
#332486 - 09/28/14 10:20 PM


Who said anything was wrong with it?



Traso
MAME Fan
Reged: 01/15/13
Posts: 2687
Send PM


Re: HLSL scale2x not possible anymore? new [Re: OllieDixon]
#332545 - 09/30/14 05:02 AM


> Who said anything was wrong with it?

.....but I prefer this. Right? Maybe? Bueller?



Scifi frauds. SF illuminates.
_________________

Culture General Contact Unit (Eccentric)



OllieDixon
MAME Fan
Reged: 09/26/14
Posts: 4
Send PM


Re: HLSL scale2x not possible anymore? new [Re: Traso]
#332633 - 10/02/14 03:08 AM


oh..


Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 153 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2439