Author |
Topic: D3D11 Pixel Shader (Read 154 times) |
|
Ric
New Member
member is offline


Posts: 30
|
 |
Re: D3D11 Pixel Shader
« Reply #2 on: Dec 23rd, 2017, 9:59pm » |
|
Thank you Richard, Ill ask Michael. Ric
|
|
Logged
|
You can't succeed without failing a few times first, CHIN UP.
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: D3D11 Pixel Shader
« Reply #3 on: Dec 23rd, 2017, 10:45pm » |
|
on Dec 23rd, 2017, 9:59pm, Ric wrote:| Thank you Richard, Ill ask Michael. |
|
One comment I would make, ignoring the shader aspects and just looking at your calculations, is that your matrix dimensions look a bit strange to me. For example you have this:
Code:diffuseColor += dot((float3)vLightDir, normal); According to the declarations in your code, 'normal' is a float4 and you are casting 'vLightDir' to a float3, but - unless HLSL arithmetic is very different from conventional arithmetic - you can't perform a dot-product between two vectors of different sizes!
Here's another:
Code:output.Pos = mul(input.Pos, World);...normal = mul(input.Norm, World); The first of these two lines multiplies 'input.Pos', a float4, with 'World' and the second multiplies 'input.Norm', a float3, with 'World'. Again it may be because HLSL arithmetic is non-standard, but superficially that ought not to be possible (what dimensions would 'World' have?).
If your version is a cut-and-paste from known working code then obviously I must be wrong, but it sure looks odd!
You could try prototyping that code in BBC BASIC - it supports matrix arithmetic as you know - to check that it runs and produces the results you expect.
Richard.
|
|
Logged
|
|
|
|
Ric
New Member
member is offline


Posts: 30
|
 |
Re: D3D11 Pixel Shader
« Reply #4 on: Dec 24th, 2017, 10:02am » |
|
I agree it looks odd but it works just like it should in the vertex shader and produces the correct results. Must have automatic clipping etc...
Ric
|
|
Logged
|
You can't succeed without failing a few times first, CHIN UP.
|
|
|
|