|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| HLSL: Shader doing diff things on diff computers |
|
![]() Atrix256 Member since: 4/28/2009 From: Seattle, WA, United States |
||||
|
|
||||
| Hey Guys, I have a shader below that works just fine for me, but for another guy, there is a green tint on everything. Can anyone see anything weird with this? Thank you! ////////////////////////////////////////////////////////////////////// // STRUCTURES ////////////////////////////////////////////////////////////////////// // Vertex shader output structure struct VS_OUTPUT { float4 Position : POSITION; float2 Texture : TEXCOORD0; float4 Color : COLOR0; float3 Light : TEXCOORD1; float3 Norm : TEXCOORD2; }; ////////////////////////////////////////////////////////////////////// // GLOBALS ////////////////////////////////////////////////////////////////////// // vertex globals float4x4 WorldViewProj; float4x4 World; float4 Diffuse; // pixel variables sampler2D Tex0; ////////////////////////////////////////////////////////////////////// // VERTEX ////////////////////////////////////////////////////////////////////// VS_OUTPUT vs_main( float4 Position : POSITION, float2 Texture : TEXCOORD0, float3 Normal : NORMAL, float4 InColor : Color0 ) { VS_OUTPUT Out; //create an output vertex Out.Position = mul(Position,WorldViewProj); //apply vertex transformation Out.Texture = Texture; //copy original texcoords Out.Color = Diffuse * InColor; Out.Light = normalize(float3(3,2,1)); Out.Norm = -normalize(mul(Normal,World)); return Out; //return output vertex } ////////////////////////////////////////////////////////////////////// // PIXEL ////////////////////////////////////////////////////////////////////// float4 ps_main( float2 Texture : TEXCOORD0, float4 Color : COLOR0, float3 Light : TEXCOORD1, float3 Norm : TEXCOORD2) : COLOR { float4 Out; float4 Tx; Tx = tex2D(Tex0, Texture); //look up texture and multiply by color tint and ambient light Out = Tx; Out *= Color; Out *= float4(0.2,0.2,0.2,1.0); //add the diffuse light Out += saturate(dot(Light,Norm))* float4(1.0,1.0,1.0,0.0) * Tx; Out = saturate(Out); return Out; } |
||||
|
||||
![]() snake5 Member since: 11/2/2008 |
||||
|
|
||||
| That another guy should update his graphics card drivers. |
||||
|
||||
![]() Atrix256 Member since: 4/28/2009 From: Seattle, WA, United States |
||||
|
|
||||
| Thanks for the response Hrm well he said he updated em and it didnt fix it. Is that generally what this kind of thing boils down to? If it really is his drivers it makes me wonder how he can play other games and they don't have this problem though. The shader itself looks ok? ::sigh:: :P |
||||
|
||||
![]() MJP GDNet+ Member since: 3/29/2007 From: Irvine, CA, United States |
||||
|
|
||||
| Try running your app with the reference rasterizer. If it produces the intended results, then you probably hit a bug in the driver. If it produces the "bad" results, then you have a bug in your code. Matt Pettineo | DirectX/XNA MVP Ride into The Danger Zone PIX With XNA Tutorial |
||||
|
||||
![]() snake5 Member since: 11/2/2008 |
||||
|
|
||||
| Drivers are really complicated. So usually only some "special" shaders fail to work correctly. That means you can also try to refactor some parts of your shader, it might work. P.S. Other games are tested on many graphics cards. When the developers see a bug like that, they usually fix or report it. |
||||
|
||||
![]() Atrix256 Member since: 4/28/2009 From: Seattle, WA, United States |
||||
|
|
||||
| Ok i figured out what the problem is. The vertex shader takes Color0 as an input, but my FVF doesn't include a color. so, i guess for most people who tried this app out, their drivers/cards were using white for the unsent color. for my buddy who was having the weird green tint, his driver/card was using some uninitialized value. Thanks for the help guys! (: |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|