DirectX-Forum - Beitragsübersicht -
ThemaDX8: analglyph
Von (Nick-)Name
Datum 05. Juli 2011 um 17:38:26
Frage Hi
Was ist in DirectX8 die schnellste Methode für Anaglyph 3D?
LG
Antwort:
Von Nico
E-Mail nico.schertler@studentpartners.de
Datum 05. Juli 2011 um 20:06:22
Antwort Hi,

ich hatte vor einiger Zeit dazu auch einen Shader geschrieben.
Er bekommt die beiden Bilder als Texturen und die Einfärbung der Bilder (i.A. ist das rot/cyan, geht aber natürlich auch anders). Gerendert werden sollte das ganze als Fullscreen-Quad. Bei DX8 musst du da aber wegen der Texturkoordinaten aufpassen.

Nico
texture tex1;
sampler tex1Sampler = sampler_state {Texture = tex1;
minfilter = POINT;
magfilter = POINT;
mipfilter = POINT;
AddressU = Wrap;
AddressV = Wrap;};

texture tex2;
sampler tex2Sampler = sampler_state {Texture = tex2;
minfilter = POINT;
magfilter = POINT;
mipfilter = POINT;
AddressU = Wrap;
AddressV = Wrap;};

float4 Color1, Color2;

struct VSIN
{
float4 Position : POSITION;
float2 TextureCoordinates : TEXCOORD0;
};

struct VSOUT
{
float4 Position : POSITION;
float2 TextureCoordinates : TEXCOORD0;
};

VSOUT VS(VSIN Input)
{
Return Input;
}

float4 PS_grauanaglyph(VSOUT Input) : COLOR {
float4 FinalColor;
float3 c1 = tex2D(tex1Sampler, Input.TextureCoordinates).rgb;
float3 c2 = tex2D(tex2Sampler, Input.TextureCoordinates).rgb;
FinalColor.rgb = (c1.r+c1.g+c1.b)/3 * Color1.rgb + (c2.r+c2.g+c2.b)/3 * Color2.rgb;
FinalColor.a=1;
Return FinalColor;
}

float4 PS_farbanaglyph(VSOUT Input) : COLOR {
float4 FinalColor;
float3 c1 = tex2D(tex1Sampler, Input.TextureCoordinates).rgb;
float3 c2 = tex2D(tex2Sampler, Input.TextureCoordinates).rgb;
FinalColor.rgb = c1 * Color1.rgb + c2 * Color2.rgb;
FinalColor.a=1;
Return FinalColor;
}

PixelShader shaders[2] = {
compile ps_3_0 PS_grauanaglyph(),
compile ps_3_0 PS_farbanaglyph()
};
int techID = 1;

technique Anaglyph
{
pass P0
{
VertexShader = compile vs_3_0 VS();
PixelShader = (shaders[techID]);
}
}
[ Antwort schreiben | Zurück zum DirectX-Forum | Forum-Hilfe ]
Antworten
DX8: analglyph - (Nick-)Name 05. Juli 2011 um 17:38:26
Re: anaglyph - Michael Kenzel 05. Juli 2011 um 17:52:17
Re: anaglyph - (Nick-)Name 05. Juli 2011 um 19:52:46
Re: anaglyph - Nico 05. Juli 2011 um 20:06:22

Ihre Antwort
(Nick-)Name   Wichtige Informationen zur Namensangabe
E-Mail (opt.)  Wichtige Informationen zur Angabe einer eMail-Adresse
Thema   Wichtige Informationen zur Angabe eines Themas
Betrifft (IDE)  DirectX 8
Ihre Antwort
Smilies
Mehr...
FettKursivUnterstrichen   Übersicht der Tipp-KürzelÜbersicht der Projekt-KürzelÜbersicht der Bücher-Kürzel 
Homepage
Titel
Root-Smilies              
             
             
[ Zurück zum DirectX-Forum | Forum-Archiv | Forum-Hilfe | Chat ]

Zum Seitenanfang

Startseite | VB-/VBA-Tipps | Projekte | Tutorials | API-Referenz | Komponenten | Bücherecke | Gewinnspiele | VB.Net | .Net-Forum | DirectX | DirectX-Forum | Chat | Ausschreibungen | Links | Suchen | Stichwortverzeichnis | Feedback | Impressum

Seite empfehlen Bug-Report
Letzte Aktualisierung: Sonntag, 13. Dezember 2015