VOGONS

Common searches


3dfx filter shader!

Topic actions

  • This topic is locked. You cannot reply or edit posts.

First post, by leileilol

User metadata
Rank l33t++
Rank
l33t++

Has there ever been an attempt to replicate the old 4x1 filtering of the earlier 3dfx Voodoo cards in a GLSL shader?

It would also need a dithering shader before that too. I'm not too sure how the green/purple alpha hatching overdraw effect would be done though

Last edited by leileilol on 2013-11-08, 16:09. Edited 2 times in total.

apsosig.png
long live PCem

Reply 2 of 67, by leileilol

User metadata
Rank l33t++
Rank
l33t++

Well guess what?

I'm attempting it.

Currently the shader is being prototyped in Darkplaces (relies on pixelsize which is a vec2 of 1 / screen width and 1 / screen height)

Attachments

  • Filename
    3dfxshagfer.png
    File size
    175.49 KiB
    Downloads
    No downloads
    File license
    Fair use/fair dealing exception
  • 3dfx6.png
    Filename
    3dfx6.png
    File size
    192.75 KiB
    Views
    9664 views
    File license
    Fair use/fair dealing exception

apsosig.png
long live PCem

Reply 4 of 67, by leileilol

User metadata
Rank l33t++
Rank
l33t++

Alright, i've ported it to eFX+SweetFX 😁

Attachments

  • 3dfx20.jpg
    Filename
    3dfx20.jpg
    File size
    57.19 KiB
    Views
    9537 views
    File license
    Fair use/fair dealing exception
  • 3dfx15.png
    Filename
    3dfx15.png
    File size
    244.14 KiB
    Views
    9547 views
    File license
    Fair use/fair dealing exception

apsosig.png
long live PCem

Reply 5 of 67, by leileilol

User metadata
Rank l33t++
Rank
l33t++

Here are the EFX+SweetFX shaders so far, which could use a *lot* of improvement in the 'dither' and 'filter' aspects:

http://leileilol.mancubus.net/shaders/cg/leifx_reduct.h
http://leileilol.mancubus.net/shaders/cg/leifx_filter.h

EDIT: I've updated with a 5-pass method which kills a lot of awful ringing artifacts i've had. But.......

IS ANYONE HERE EVEN REMOTELY INTERESTED IN ANYTHING LIKE THIS?

apsosig.png
long live PCem

Reply 6 of 67, by DracoNihil

User metadata
Rank Oldbie
Rank
Oldbie

Well I am, I just don't have much to say since I had a voodoo 2 card and not a early voodoo 1. I don't remember the voodoo 2 having this kind of filtering going on but I do remember it's unique way of dithering translucency.

“I am the dragon without a name…”
― Κυνικός Δράκων

Reply 7 of 67, by VileR

User metadata
Rank l33t
Rank
l33t
leileilol wrote:

IS ANYONE HERE EVEN REMOTELY INTERESTED IN ANYTHING LIKE THIS?

3dfx stuff hovers a wee bit outside my personal nostalgia range, but those shots sure do approximate the way I remember it looking... plus I always appreciate a good show of shader trickery; well done. :D

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 8 of 67, by Targaff

User metadata
Rank Member
Rank
Member

I'm interested. Can't help any, but I'm all up for a good shader.

Intel CC820 | PIII 667 | 2x128MB SDRAM | 3Dfx Voodoo 5 5500 @ Dell P790 | Creative SB PCI128 | Fujitsu MPC3064AT 6GB + QUANTUM FIREBALLlct10 10 GB | SAMSUNG DVD-ROM SD-608 | IOMEGA ZIP 100 | Realtek RTL8139C | Agere Win Modem

Reply 9 of 67, by leileilol

User metadata
Rank l33t++
Rank
l33t++

Thanks for the support, guys. The shaders will be here. Requires the efx + SweetFX bundle found in the recent posts of this thread.

While it's still buggy and highly approximate (no proper dither) i'm very pleased on the way it's turned out so far. Been playing for HOURS at its current stage unable to think of ways to make it better (For the moment).

Maybe I should set sights on the 2x2 filter?

Attachments

  • 3dfx29.png
    Filename
    3dfx29.png
    File size
    567 KiB
    Views
    9415 views
    File license
    Fair use/fair dealing exception

apsosig.png
long live PCem

Reply 12 of 67, by leileilol

User metadata
Rank l33t++
Rank
l33t++

I don't have any VGA captures to work with and i'm going by staring at a CRT running a Voodoo2.

Sadly I don't think I can do a shader to replicate the alpha blending artifacts given the limitations of eFX to be pure postprocessing (rather than allowing to alter blending functions)

I'm not claiming this is accurate at all - it still needs dithering overhauled to look like the dither seen in an unfiltered Voodoo capture, and when it comes to HLSL/CG syntax, i'm still a complete idiot.....

I would post about it on Falconfly (for the learnening of the techniques used) - if registrations were open 😒

apsosig.png
long live PCem

Reply 13 of 67, by leileilol

User metadata
Rank l33t++
Rank
l33t++

Bleh. My attempt at porting the shader to DOSBox (to use with kekko's software emulation of Glide, and the Direct3D patch) kinda failed. It needs 5 passes for it to work (including the gamma pass + lines) and I couldn't seem to do that.

// "LeiFX" shader - Pixel filtering process
//
// Copyright (C) 2013 leilei
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your option)
// any later version.


#include "shader.code"

float scaling : SCALING = 2.0;

// The name of this effect
string name : NAME = "leifxfilter";

// combineTechnique: Final combine steps. Outputs to destination frame buffer
string combineTechique : COMBINETECHNIQUE = "leifxfilter";

float2 px;

// Source Texture
texture SourceTexture : SOURCETEXTURE;
texture LeiFXTexture : SOURCETEXTURE;

// Point Sampler
sampler SourcePointSampler = sampler_state {
Texture = (SourceTexture);
MinFilter = POINT;
MagFilter = POINT;
};

// for passes
sampler Peww = sampler_state {
Texture = (LeiFXTexture);
MinFilter = POINT;
MagFilter = POINT;
};

// Vertex Shader Output
struct VS_OUTPUT_PRODUCT {
float4 coord : POSITION;
float2 TexCoord : TEXCOORD0;
};



// Vertex shader
VS_OUTPUT_PRODUCT S_VERTEX (float3 p : POSITION, float2 tc : TEXCOORD0)
{
VS_OUTPUT_PRODUCT OUT = (VS_OUTPUT_PRODUCT)0;
OUT.coord = mul(float4(p,1),WorldViewProjection);
OUT.TexCoord = tc;
return OUT;
}


// Pixel shader
float4 S_FRAGMENT ( in VS_OUTPUT_PRODUCT VAR ) : COLOR
Show last 61 lines
{
half3 fragcolor = tex2D(Peww, VAR.TexCoord).rgb; // the unmodified pixels
half4 meh = 1;
meh.rgb = fragcolor.rgb;

// Sample things.

float blendy; // to blend unblended with blend... trying to smooth the jag :(
float blenda;

float blendfactor;

float3 pixel1 = tex2D(Peww, VAR.TexCoord + float2(ps.x*0.5, 0)) .rgb;
float3 pixel2 = tex2D(Peww, VAR.TexCoord + float2(ps.x*-1.2, 0)) .rgb;
float3 pixel3 = tex2D(Peww, VAR.TexCoord + float2(ps.x*-2.2, 0)) .rgb;
float3 pixel4 = tex2D(Peww, VAR.TexCoord + float2(ps.x*-3.2, 0)) .rgb;
float3 pixel0 = tex2D(Peww, VAR.TexCoord) .rgb;


float3 pixelblend;


float gary1 = dot(pixel1.rgb,1);
float gary2 = dot(pixel2.rgb,1);

float mean = 1.0;
mean = gary1 - gary2;

if (mean < 0) mean *= -1;
if (mean > 1) mean = 1;
mean = pow(mean, 0.98f); // Adjust this value if you want to control the blur...

if (mean > 1) mean = 1;
meh.rgb = fragcolor.rgb;
// New less crappy way
{
// variably BLEND IT ALL TO H*CK!!!!
blendy = 1 - mean;
blenda = 1 - blendy;
pixel0 /= 5;
pixel1 /= 5;
pixel2 /= 5;
pixel3 /= 5;
pixel4 /= 5;
pixelblend.rgb = pixel0 + pixel1 + pixel2 + pixel3 + pixel4;
meh.rgb = (pixelblend.rgb * blendy) + (meh.rgb * blenda);
}

return meh;
}

technique leifxfilter
{
pass P0
{
VertexShader = compile vs_3_0 S_VERTEX();
PixelShader = compile ps_3_0 S_FRAGMENT();
}

}

Attachments

  • Filename
    tomb3dfsux.jpg
    File size
    124.58 KiB
    Downloads
    No downloads
    File license
    Fair use/fair dealing exception

apsosig.png
long live PCem

Reply 15 of 67, by DracoNihil

User metadata
Rank Oldbie
Rank
Oldbie

Who is that character you're using as the test image?

Also if I knew a damn thing about GLSL I wouldn't mind trying to recreate your thing in that, but I'm still trying to learn how to even touch OpenGL 3...

“I am the dragon without a name…”
― Κυνικός Δράκων

Reply 18 of 67, by DracoNihil

User metadata
Rank Oldbie
Rank
Oldbie

If I'm reading this right... You went from using 3 textures and 2286 tris down to just 1 and 1900 tris?

That's a really good model too by the way. For some reason it made me think of OpenArena.

On topic of the filter shader though... the dithering you mean by this right?: http://en.wikipedia.org/wiki/Ordered_dithering

Because for some reason I remember the dither looking a bit different than that. Of course the only game I remember vividly playing on just a plain non SLI VooDoo 2 was Uprising 2: Lead and Destroy.

also who really cares for tops anyways? (awaits a impending smack across the face)

“I am the dragon without a name…”
― Κυνικός Δράκων

Reply 19 of 67, by leileilol

User metadata
Rank l33t++
Rank
l33t++

That's because the Voodoo actually has real ordered dither. My dither is just fake with no regards to error at all, it's literally a bunch of lines on lines with a bunch of ifs ands and buts to make some dot pattern. It's functionally closer to nVidia TNT/Geforce dither than it is to the Voodoo dither, and is something I need the most serious help with. If you look really close in my shader captures you'll notice some slight dot pattern that shouldn't be there...

I do know Kekko's glide software renderer has extremely close ordered dither but that's not something I can directly port to a shader language.

apsosig.png
long live PCem