Geometrieentzerrung mit hoher Qualität (Shader)
-
-
FoLLgoTT Welchen Wert hast du denn für deine Isco z.B. bei der Anamorphotenkorrektur eingestellt?
Meinst du den Verzerrungsfaktor? 1,31, meine ich.
-
Meinst du den Verzerrungsfaktor? 1,31, meine ich.
Ich meinelinearityCorrectionX
-
Ich meinelinearityCorrectionX
Das steht auf 0.98, also nur leicht korrigiert. Ich habe nicht gemessen, wie viel dann noch übrig bleibt. Im Film fällt mir die restliche Linearitätsverzerrung jedenfalls nicht auf.
-
Alles klar, danke.
Gibts eigentlich noch irgenwas in Verbindung mit MadVR zu beachten? Sobald ich als Ausgabe MadVR nutze, kann der Warping Shader nicht genutzt werden.
Und hier? Gibts da noch was zu beachten?
-
Alles klar, danke.
Und hier? Gibts da noch was zu beachten?
vermutlich musst du im LAV Video Decoder das "DXVA2 (copy-back)" bei ""Hardware Decoder to use" auswählen
-
Müsst ich mal checken, bin mir aber ziemlich sicher das ich das habe.
-
Und hier? Gibts da noch was zu beachten?
Der LAV-Decoder hat damit nichts zu tun, das funktioniert auch im Native-Modus. Der Shader wird ja auf der GPU ausgeführt.
Das heißt, bei dir funktioniert der Shader nur mit einem anderen Renderer?
Es müsste in madVR auch sichtbar sein, das ein Custom Shader aktiviert ist.
-
Ja genau.
MPC-HC ist die 1.9.23 und MadVR die letzte offizielle 0.9.17 vll muss ich die 113b mal testen..
Der player sagt dann beim Start schon „ Shader konnte nicht eingerichtet werden“
-
Hmm, die Meldung sagt mir nichts. Ich nutze die neueste Beta, zu den älteren Versionen kann ich nichts sagen. Ich wüsste aber nicht, dass Custom Shader ein neueres Feature wäre, aber vielleicht wurde auch etwas an madVR korrigiert.
-
Okey, ich check das nochmal mit ner aktuellen Version
-
Sind deine ganzen shader alle als post prozessing eingetragen. Bei mir scheint momentan auch mit der 163 gar kein shader zu funktionieren. Kann dir aber gerne mal die Debugger Meldung von MPC hier anhängen.
-
Sind deine ganzen shader alle als post prozessing eingetragen.
Ja, als Post processing.
Bei mir scheint momentan auch mit der 163 gar kein shader zu funktionieren. Kann dir aber gerne mal die Debugger Meldung von MPC hier anhängen.
Ja, stell mal rein. Vielleicht kann ich was erkennen.
-
-
Kannst du mal deine gesamte HLSL hier rein kopieren?
-
ja klar, hier
Code
Alles anzeigenstatic const float widthNative = 1920; // set native x resolution here static const float distortionFactorX = 0.0; // higher = more curved distortion static const float distortionFactorY = 0.1; // higher = more curved distortion static const float distortionCenterX = 1.0; // 1 = symmetrical to y. 0 = only bottom. 2 = only top. static const float distortionCenterY = 0.0; // 1 = symmetrical to y. 0 = only bottom. 2 = only top. static const float distortionBowY = 1.3; // 1 = none. >1 bow to bottom. <1 bow to top static const float trapezTop = 1.0; // trapezoid distortion factor for the top of the picture static const float trapezBottom = 1.0; // trapezoid distortion factor for the bottom of the picture static const float linearityCorrectionX = 0.98; // corrects horizontal linearity for anamorphic lens static const float linearityCorrectionY = 1.0; // corrects vertical linearity for anamorphic lens SamplerState samp : register(s0); float4 p0 : register(c0); #define width (p0[0]) #define height (p0[1]) float BicubicWeight(float d) { d = abs(d); if(2.0 < d){ return 0.0; } const float a = -1.0; float d2 = d * d; float d3 = d * d * d; if(1.0 < d){ return a * d3 - 5.0 * a * d2 + 8.0 * a * d - 4.0 * a; } return (a + 2.0) * d3 - (a+3.0) * d2 + 1.0; } float3 Bicubic(float2 uv, float2 InvResolution) { float2 center = uv - (fmod(uv / InvResolution, 1.0) - 0.5) * InvResolution; // texel center float2 offset = (uv - center) / InvResolution; // relevant texel position in the range -0.5~+0.5 float3 col = float3(0,0,0); float weight = 0.0; for(int x = -2; x <= 2; x++) { for(int y = -2; y <= 2; y++) { float wx = BicubicWeight(float(x) - offset.x); float wy = BicubicWeight(float(y) - offset.y); float w = wx * wy; float2 coord = center + float2(x, y) * InvResolution; if(coord.x >= 0.0 && coord.x <= 1.0 && coord.y >= 0.0 && coord.y <= 1.0) // ignore pixels outside the picture col += w * tex2D(samp, coord).rgb; weight += w; } } col /= weight; return col; } float4 main(float2 uv : TEXCOORD0) : COLOR { float zoom = width / widthNative; float xZoomed = (uv.x - 0.5) * zoom + 0.5; float yZoomed = (uv.y - 0.5) * zoom + 0.5; // perform distortion for curved screen (follows a parabola) uv.x += distortionFactorX * (-2.0 * xZoomed + distortionCenterX) * yZoomed * (yZoomed - 1.0); uv.y += distortionFactorY * (-2.0 * pow(yZoomed, distortionBowY) + distortionCenterY) * xZoomed * (xZoomed - 1.0); // trapezoid if(trapezTop != 1.0 || trapezBottom != 1.0) { float size = lerp(trapezTop, trapezBottom, yZoomed); float reciprocal = 1.0 / size; uv.x = uv.x * reciprocal + (1.0 - reciprocal) / 2.0; } // linearity if(linearityCorrectionX != 1.0) { float x = xZoomed - 0.5; uv.x = lerp(x * abs(x) * 2.000001, uv.x - 0.5, linearityCorrectionX) + 0.5; } if(linearityCorrectionY != 1.0) { float y = yZoomed - 0.5; uv.y = lerp(y * abs(y) * 2.00001, uv.y - 0.5, linearityCorrectionY) + 0.5; } float3 result = Bicubic(uv, 1.0 / float2(width, height)); return float4(result, 1.0); }
-
hier der Debugger:
Bei mir funktioniert dein Shader und verzerrt das Bild wie gewünscht. Kannst du mal auf "PS 3.0" drücken, dann sollte zumindest im Debug-Fenster kein Fehler mehr sein.
Meine Debug-Informationen sehen so aus:
Code
Alles anzeigenC:\Program Files (x86)\MPC-HC\Shaders\warping.hlsl(76,41-68): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them // // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.18611 // #define MPC_HC_SHADER_PROFILE 3 // // Parameters: // // float4 p0; // sampler2D samp; // // // Registers: // // Name Reg Size // ------------ ----- ---- // p0 c0 1 // samp s0 1 // ps_3_0 def c1, 0.00052083336, -0.5, 0.5, 1.29999995 def c2, 0, -2, 2, 1 def c3, -0.200000003, 2.00000095, 0.980000019, 5 def c4, -8, 4, 0, 0 defi i0, 5, 0, 0, 0 dcl_texcoord v0.xy // uv<0,1> dcl_2d s0 #line 70 "C:\Program Files (x86)\MPC-HC\Shaders\warping.hlsl" mov r0.x, c1.x mul r0.x, r0.x, c0.x // ::zoom<0> add r0.yzw, c1.y, v0.xxyx mul r1.x, r0.x, r0.w // ::x<0> #line 76 mad r0.xyz, r0.yzww, r0.x, c1.zzyw // ::xZoomed<0>, ::yZoomed<0> pow r1.y, r0.y, c1.w mul r0.x, r0.x, r1.y mul r0.x, r0.x, c3.x mad r0.y, r0.x, r0.z, v0.y // uv<1> #line 90 mul r0.z, r1_abs.x, r1.x mul r1.x, r0.z, c3.y mad r0.z, r0.z, -c3.y, r0.w mad r0.z, r0.z, c3.z, r1.x add r0.x, r0.z, c1.z // uv<0> #line 98 rcp r1.x, c0.x // Bicubic::InvResolution<0> rcp r1.y, c0.y // Bicubic::InvResolution<1> #line 43 mul r0.zw, r0.xyxy, c0.xyxy frc r1.zw, r0_abs cmp r0.zw, r0, r1, -r1 add r0.zw, r0, c1.y mad r0.zw, r0, -r1.xyxy, r0.xyxy // ::center<0,1> add r0.xy, -r0.zwzw, r0 #line 48 mov r2.xyz, c2.x // ::col<0,1,2> mov r1.z, c2.x // ::weight<0> mov r3.x, c2.y // ::x<0> rep i0 #line 52 mad r1.w, r0.x, -c0.x, r3.x // BicubicWeight::d<0> #line 31 mul r2.w, r1_abs.w, r1_abs.w // ::d2<0> mul r3.z, r1_abs.w, r2.w // ::d3<0> add r4.xy, -r1_abs.w, c2.zwzw mad r3.w, r2.w, c3.w, -r3.z mad r1.w, r1_abs.w, c4.x, r3.w add r1.w, r1.w, c4.y // ::BicubicWeight<0> #line 38 mad r2.w, r2.w, -c2.z, r3.z add r2.w, r2.w, c2.w // ::BicubicWeight<0> cmp r1.w, r4.y, r2.w, r1.w // ::BicubicWeight<0> cmp r1.w, r4.x, r1.w, c2.x // ::BicubicWeight<0> #line 50 mov r4.xyz, r2 // ::col<0,1,2> mov r2.w, r1.z // ::weight<0> mov r3.y, c2.y // ::y<0> rep i0 #line 53 mad r3.z, r0.y, -c0.y, r3.y // BicubicWeight::d<0> #line 31 mul r3.w, r3_abs.z, r3_abs.z // ::d2<0> mul r4.w, r3_abs.z, r3.w // ::d3<0> add r5.xy, -r3_abs.z, c2.zwzw mad r5.z, r3.w, c3.w, -r4.w mad r3.z, r3_abs.z, c4.x, r5.z add r3.z, r3.z, c4.y // ::BicubicWeight<0> #line 38 mad r3.w, r3.w, -c2.z, r4.w add r3.w, r3.w, c2.w // ::BicubicWeight<0> cmp r3.z, r5.y, r3.w, r3.z // ::BicubicWeight<0> cmp r3.z, r5.x, r3.z, c2.x // ::BicubicWeight<0> #line 54 mul r3.z, r1.w, r3.z // ::w<0> mad r5.xy, r3, r1, r0.zwzw // ::coord<0,1> add r5.zw, -r5.xyxy, c2.w texld r6, r5, s0 mad r6.xyz, r3.z, r6, r4 // ::col<0,1,2> cmp r3.w, r5.w, -c2.w, -c2.x cmp r3.w, r5.y, r3.w, c2.x cmp r3.w, r5.z, r3.w, c2.x cmp r3.w, r5.x, r3.w, c2.x cmp r4.xyz, r3.w, r4, r6 // ::col<0,1,2> add r2.w, r2.w, r3.z // ::weight<0> #line 50 add r3.y, r3.y, c2.w // ::y<0> #line 61 endrep mov r2.xyz, r4 // ::col<0,1,2> mov r1.z, r2.w // ::weight<0> #line 48 add r3.x, r3.x, c2.w // ::x<0> #line 62 endrep rcp r0.x, r1.z mul oC0.xyz, r0.x, r2 // ::main<0,1,2> mov oC0.w, c2.w // ::main<3> // approximately 80 instruction slots used (1 texture, 79 arithmetic)
-
Ne, bei PS 3.0 sind keine Fehler.
-
Funktionieren denn andere Shader bei dir mit madVR oder kommt da auch immer diese Fehlermeldung, dass der Shader nicht geladen werden kann?
-
Kein Shader funktioniert mit MadVR.
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!