Archived

This topic is now archived and is closed to further replies.

FX files and fixed-function parameters

This topic is 5093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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 :-)

Share this post


Link to post
Share on other sites