Adding material into light calculation?

Started by
14 comments, last by cozzie 11 years, 3 months ago

Aah I get it, sorry, didn't see it right away.

Just changed it, and now it works :) thanks!

What would you think would be best performance wise, doing the separate calculations or doing it at once?

(like I did up till now)

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Advertisement
As far as I know, and someone correct me if I'm wrong but I don't see how it would create more operations for the hardware to do then doing it in a single line. And as far as the extra variable goes, it could be quite possible that the compiler sees this as redundant anyway and replaces it with the "single-line" approach. I'm not an expert on this though. Worst case scenario is having wasted a few bytes of graphics memory for those extra variables but having a much cleaner and readable code. But that's just me :)

Check the generated shader assembly output to find out if they're equivalent.

Thanks,I'm trying it right away.

Do get some errors though when checking it using 'fxc.exe' from the DX sdk:

- working.fx(70,28): warning X3206: 'dot': implicit truncation of vector type

- working.fx(73,16): warning X3206: 'implicit truncation of vector type

- error X3501: 'main' entrypoint not found

compilation failed; no code producted

Could this have to do with DX10/DX9 compilation for the FX/ shader?

I'm using DX9 and read that in the SDK the compilations will be done based on syntax/ compilation of DX10 (and 11?).

If I open the same file in effectedit (also DX SDK) I don't get these errors.

Wíll try to figure out if there's a warning level or something in effectedit.

By the way strange that D3DXCreateEffectFromFile gives back a D3D_OK and the result is also as expected..

Any hints how to pick this up?

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Sorry, being stupid, forgot to give the /T parameter with fx_2_0 (since i use d3d9). Will keep you posted on the output comparison of the 2 styles of calculations

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Good news, I got the compilation comparison done :)

Here are the 2 results (TXT files):

www.sierracosworth.nl/gamedev/output1.txt

www.sierracosworth.nl/gamedev/output2.txt

When I compare the results, both outputs are 100% the same.

Good to know this, so I can tweak the shader to how I can read and work with it best, without affecting the result/ performance.

Thanks again for your help.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

This topic is closed to new replies.

Advertisement