diesen zB. umschreiben in HLSL Code, könnte man ihn benutzen in Purebasic als hübschen Effekt.
Leider fehlt mir das ausreichende Wissen um diese umzusetzen. Ich habe einige nette HLSL Codes hier und würde gern meine Sammlung erweitern.
Kann mir da jemand bei helfen?
hier mal ein Beispiel *.FX code der in PureBasic funktioniert:
Code: Alles auswählen
uniform float time;
uniform float2 resolution = float2(800,600);// change Resolution
static const float PI = 3.14159;
static const float RADIUS = 50.;
static const float CELL_SIZE = 8.;
static const float CELL_THICK = 0.2;
static const float CELL_RADIUS = .5*CELL_SIZE - CELL_THICK;
float squared_distance(const float2 a, const float2 b)
{
float2 d = a - b;
return dot(d, d);
}
float add_blob(const float2 center, const float2 gl_FragCoord)
{
return 2.5e5/(1. + squared_distance(gl_FragCoord.xy, center));
}
float mod(const float x, const float y)
{
return x - y * floor(x/y);
}
float4 main(float2 Tex : TEXCOORD, float4 gl_FragCoord : VPOS) : COLOR
{
gl_FragCoord.y = resolution.y - gl_FragCoord.y;
float2 origin = .5*resolution;
float v =
add_blob(origin + float2(150.*sin(2.1 + 1.6*time), 205.*cos(5.7 + 1.8*time)), gl_FragCoord) +
add_blob(origin + float2(100.*cos(.5 + 2.1*time), 100.*sin(7.5 + 5.2*time)), gl_FragCoord) +
add_blob(origin + float2(60.*sin(.3 + 1.6*time), 200.*cos(3.3 + 1.6*time)), gl_FragCoord);
float w = v - RADIUS;
float r = pow(1. + pow(w, 2.), -.2)*CELL_RADIUS;
float2 offs = float2(step(CELL_SIZE, mod(gl_FragCoord.y, 2.*CELL_SIZE))*.5*CELL_SIZE, 0);
float2 cell_center = offs + CELL_SIZE*floor((gl_FragCoord.xy - offs)/CELL_SIZE) + .5*float2(CELL_SIZE, CELL_SIZE);
float d = distance(gl_FragCoord.xy, cell_center);
float c = smoothstep(r + CELL_THICK, r, d);
return float4(c, c, c, 1);
}
// Vertex Shader
struct VS_INPUT
{
float3 position : POSITION;
float2 texture0 : TEXCOORD0;
};
struct VS_OUTPUT
{
float4 hposition : POSITION;
float2 texture0 : TEXCOORD0;
};
VS_OUTPUT myvs( VS_INPUT IN )
{
VS_OUTPUT OUT;
OUT.hposition = float4(IN.position.x ,IN.position.y ,IN.position.z, 1);
OUT.texture0 = IN.texture0;
return OUT;
}
technique Start
{
pass p1
{
VertexShader = compile vs_3_0 myvs();
PixelShader = compile ps_3_0 main();
}
}
Danke fürs lesen und evtl. kann mir jemand helfen
Hab Euch mal eine kompilierte Demo exe angehangen. Da kommt noch Scrollschrift und 3D Objekt und was weis ich noch drübber
www.inc-games-design.de/Tools/shaderDemo.rar
Grüße