Skip to main content
gamedev.net
🔒 Locked

FX files and fixed-function parameters

Started by hplus0603 Jan 7, 2004 at 1:51 AM 1 replies 1.1k views
Original Post
hplus0603
hplus0603
It seems to me as if the fixed-function parameters (such as light direction) get baked when you first load the effect, whereas the same parameter for shaders gets updated correctly. If I have
float3 CamPos : CAMPOS = { 0, 0, 0 };

technique t0 {
  pass p0 {
    LightPosition[0]  = (CamPos);
    ...
    VertexShader = NULL;
  }
}

technique t1 {
  pass p0 {
    VertexShader = compile vs_1_1 VS();
  }
}
 
and VS() references CamPos, then the t1 technique will do the right thing as I update the CAMPOS semantic, but the t0 will "bake" the light position at whatever the camera position was when I started. What is the appropriate fix for this? Could I tag the LightPosition[0] argument using : CAMPOS semantic? Is this a known bug or limitation? Something I could be doing wrong that I could change?
enum Bool { True, False, FileNotFound };
Muhammad Haggag
Muhammad Haggag
quote:
and VS() references CamPos, then the t 1technique will do the right thing as I update the CAMPOS semantic, but the t 0will "bake" the light position at whatever the camera position was when I started.

What is the appropriate fix for this? Could I tag the LightPosition[0] argument using : CAMPOS semantic? Is this a known bug or limitation? Something I could be doing wrong that I could change?

- Are you sure? This seems like an app bug to me, because I've used FX files with the FPP and it always correctly used my updated constants.

- I don't think you can define custom semantics, there's no CAMPOS semantic.

- Could you show the whole FX file? (or the VShader and the FFP setup, at least)

Muhammad Haggag

[edited by - Coder on January 7, 2004 4:04:21 AM]

hplus0603
hplus0603
In 9.0, you can absolutely define your own semantics, and query for them in the effect, and then set values on them. In fact, I don''t use the fixed-function way of specifying parameters at all (i e, world, view and projection matrices arrive through semantics; I never assign to Device.Transforms at all)

However, I found the problem in my effect; it was a typo. Thanks for the offer of a second set of eyes; I''ll definitely need that sometime in the future :-)
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.