BBC BASIC
« D3D11 Pixel Shader »

Welcome Guest. Please Login or Register.
Mar 31st, 2018, 11:12pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Cross-platform BBC BASIC (Windows, Linux x86, Mac OS-X, Android, iOS, Raspberry Pi)
BBC BASIC Resources
BBC BASIC Help Documentation
BBC BASIC for Windows Home Page
BBC BASIC Programmers' Reference
BBC BASIC Beginners' Tutorial
BBC BASIC for SDL 2.0 Home Page
BBC BASIC Discussion Group

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: D3D11 Pixel Shader  (Read 154 times)
Ric
New Member
Image


member is offline

Avatar




PM


Posts: 30
xx Re: D3D11 Pixel Shader
« Reply #2 on: Dec 23rd, 2017, 9:59pm »

Thank you Richard, Ill ask Michael.
Ric
User IP Logged

You can't succeed without failing a few times first, CHIN UP.
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx 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.
User IP Logged

Ric
New Member
Image


member is offline

Avatar




PM


Posts: 30
xx 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
User IP Logged

You can't succeed without failing a few times first, CHIN UP.
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls