User Tag List

Results 1 to 4 of 4

Thread: Restore effect parameter defaults at runtime?

  1. #1
    No Products Registered

    Join Date
    Sep 2007
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Restore effect parameter defaults at runtime?

    Hello,

    a simple question. When setting an effect at runtime, is it possible to restore any or all effects parameter defaults? When I write a shader, I have tried specifying defaults in both the xml file and the fx file. However, when changing the effect at runtime, all effect parameters seem to reset to 0 regardless of the shader's default values. Is this intended behavior? If it is, will there be any way to reset a parameter to its default as specified in the XML file ?

    Thanks for your time.

    Edit: I am running HWA build #249 . Perhaps this behavior has changed in a new build, but I'm not sure.

  2. #2
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,479
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    Re: Restore effect parameter defaults at runtime?

    If I remember correctly, the default values in the XML files are only used in the preview in the effect list.
    I was wrong, preview values are a different option. EDIT: in fact I don't see what you mean...

  3. #3
    No Products Registered

    Join Date
    Sep 2007
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Restore effect parameter defaults at runtime?

    So, for example, when I have in the xml file, a <value> parameter, it of course sets the parameter's value to this when an effect is selected from design time.

    However, if you were to set the effect via events at runtime, the effect parameter is effectively 0, regardless of the <value> in the XML file.

    I have included an example MFA and simple shader to demonstrate. The effect parameter "Intensity" has a default value in the XML to 1.0, which is the strongest value of the effect. It will turn a texture into 100% white values. Clicking the first button sets the Effect to "None" at runtime. The second button sets it to this shader, without specifying any parameter values, and the 3rd specifies an explicit "1" for the Intensity parameter.

    The expected result for pressing Button 2 is the result for Button 3, based on the default values. However, when loading the effect at runtime without specifically setting parameter values, the values are not initialized to the XML default value. Even if we were to define "float Intensity=1.0;" in the .FX itself, it will always initialize the effect parameter when it is loaded at runtime to 0. This is not a problem for shaders with only a few parameters, but for shaders with 5-10 parameters this becomes cumbersome when swapping shaders at runtime. Furthermore, shaders which rely on being initialized to nonzero values to display properly will likely fail when loaded at runtime without specifying all the required parameters explicitly.

    Attached files Attached files

  4. #4
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,479
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    Re: Restore effect parameter defaults at runtime?

    I see, thanks for the example.

    The default values are not saved in the EXE, I'll check if I can change this.

Similar Threads

  1. Can't change effect during runtime?
    By Storsorgen in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 27th November 2013, 09:44 PM
  2. Restore animation et restore frame
    By imothep85 in forum Multimedia Fusion 2 - Technical Support
    Replies: 31
    Last Post: 11th September 2012, 01:20 PM
  3. Restore colors
    By Aasland in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 8th May 2011, 06:55 AM
  4. Changing Layer Effect at runtime
    By MechatheSlag in forum Hardware Accelerated Runtime
    Replies: 9
    Last Post: 11th June 2008, 05:30 AM
  5. Restore Colors
    By Pkeod in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 25th February 2007, 01:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •