User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18

Thread: One for Yves: Alpha with effect applied to layer

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jun 2007
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    One for Yves: Alpha with effect applied to layer

    Yves, a moment of your time good sir!

    You reported a known bug in one the earlier builds of HWA as follows:-

    Effects on layers are incompatible with the alpha channel of objects on this layer and with effects that affect the object transparency. I don't know yet if this issue will be fixed or not.

    An example for anyone who's interested!


    Alpha channels are extremly useful (as you are probably aware!) Creating glowing particles, soft edged shadows or blending textures or objects together are just a few examples of alpha channels in action! All that would have to be sacrificed the moment you add a layer effect, this seems a steep price to pay.

    Say you want your camera to zoom in and out of the battlefield, a night vision camera effect, an undulating water scene perhaps? This is where layer effects come into their own!

    It seems a heavy restriction on a build thats created solely for creating great looking graphics, I guess thats what I'm trying to say!

    Do you know if this will ever get resolved? My current project relies heavily on layer effect shaders and the lack of alpha channels is a real blow.




    Many Thanks
    John

  2. #2
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    14,009
    Mentioned
    279 Post(s)
    Tagged
    3 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    I'm sorry, I don't know if this will be resolved in MMF2, I tried to fix it and didn't find a solution. Maybe if I've an idea later...

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jun 2007
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    Come on Yves, work that keyboard, make that magic happen! YOU CAN DO IT!!

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    I believe it's an issue with how colour/alpha is written to the intermediate render buffer. Unfortunately it's a complete PITA to fix, you basically have to do your own alpha blending in the object's pixel shader, instead of letting direct-x do it.

    This is the code:
    NewBufferAlpha = Lerp(BufferAlpha, 1, ObjectAlpha)
    NewBufferColour = Lerp(BufferColour, ObjectColour, ObjectAlpha)

    And you would need to set the D3D blend mode to ONE,ZERO (i.e. overwrite behaviour) instead of SRCALPHA,INVSRCALPHA (alpha blend) when rendering into the layer, and then ONE,INVSRCALPHA when rendering the layer into the main buffer.

    EDIT: It's much easier in D3D10, unfortunately. You just set the render state to SRCALPHA,INVSRCALPHA for the colour and ONE,INVSRCALPHA for the alpha when drawing the objects into the layer, and you end up with a premultiplied-alpha texture. You can then blend that onto your output buffer with colour: ONE,INVSRCALPHA and alpha: whatever. If you set the alpha state to ONE,INVSRCALPHA again then you end up with another premultiplied-alpha buffer and can repeat the process

  5. #5
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    14,009
    Mentioned
    279 Post(s)
    Tagged
    3 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    Yes Dynasoft, that's exactly the problem.

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jun 2007
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    premultiplied-alpha buffer eh? wow.... Im not even going to pretend to know what all that meant!

  7. #7
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    Suffice to say I was talking about some very behind-the-scenes stuff that Yves has understood. It's unfortunate that the DX9 version of the fix is so nasty (requiring shader changes), Yves may decide not to implement it.

  8. #8
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    Well it would certainly be nice if it ever was :3
    I've been experiencing ages of problems with this with my current project, making me have to adjust the alpha values of all objects whenever I want to apply a layer shader, so it gets a lot of graphics artifacts. For example in my time engine thing, most transparent particle effects will be invisible while not overlapping the background while I apply the time-rewinding shader, because of their alpha channels. Its a pain on the eye :p


    *edit: and doing workarounds really IS a pita, mind, since I have to lerp the alpha values of overlapping objects to halve the distance between them or some odd thing like that, so some objects that had partial transparent sections will have those sections become fully transparent and the rest become partially transparent. I think I might rewrite the shader I'm using for the layers to accommodate for this if its not going to change, I'll have to remind myself that

  9. #9
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    Actually is there any generic way to modify a pixel shader that otherwise doesn't use alpha values to overcome this problem? It would sure be nice

    I mean Dyna if you had that as an example in a PS9 shader I'd be very thankful!

  10. #10
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: One for Yves: Alpha with effect applied to layer

    No, there's no way to fix it AFAIK without changing the blend formula.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. [request]Effect on layer
    By vittix in forum XNA Export Module Version 2.0
    Replies: 3
    Last Post: 20th September 2012, 09:23 AM
  2. Standard to HWA layer effect incompatibility(R249)
    By EE in forum Hardware Accelerated Runtime
    Replies: 5
    Last Post: 13th April 2011, 04:58 PM
  3. "Subtract" effect is buggy when applied to layer
    By alxmrg in forum Hardware Accelerated Runtime
    Replies: 6
    Last Post: 8th July 2009, 01:14 PM
  4. Changing Layer Effect at runtime
    By MechatheSlag in forum Hardware Accelerated Runtime
    Replies: 9
    Last Post: 11th June 2008, 05:30 AM
  5. Is add ink effect faster than alpha-blended
    By BrashMonkey in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 12th July 2006, 01:58 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
  •