3D Shader by Werbad Issues in DX9+

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Please login to see this attachment.

    Im trying to make a game similar to GTA1 and everything is going well but...
    when I change the display mode to DX 8/9/11 the 3d Shader doesnt seem to work :(

    Please login to see this attachment.

    It says DX9+ but it doesnt work? or am I doing something wrong?

    Facebook Page: Please login to see this link.
    My Project Releases: Please login to see this link.

  • It's probably not you. I just tried the GTA building examples that I made years ago using Werbad's shader, which definitely DID work, but are now all broken. Clickteam must have changed something. Whatever they did, it seems to have broken the "Quad deform" shader that I made as well. In both cases, Fusion seems to display only one of the two triangles needed to draw a quad (curiously, it looks okay in the frame editor, but not at runtime).

    Shaders don't work in standard mode - you need to use at least DX9 for them to have any effect, and DX11 requires you to use specially converted shader files.

  • Was this always like this?
    That's how it looks on MMF2...
    I'm sure Quad shader looks a lot better...

    Please login to see this picture.

    But it's concerning that a shader with nothing really special broke.
    Makes me think if some of the stuff I've tried and didn't worked was because of the same issue.

    Edit: the math on this other examples seems better, but still got a few issues on MMF2...
    Please login to see this link.
    Please login to see this picture.

    Edited 2 times, last by NaitorStudios (December 11, 2021 at 4:39 PM).

  • That's strange...

    I've just had another look though.
    The latest version (which I decided to call "QuadPlus" for some reason) doesn't work - Please login to see this link.

    The two earlier versions - "Quad" (w/o lighting) and "QuadDeform" (w lighting) - ARE both still working.

    So, that would be an option for SHINGEN to use instead of Werbad's shader (you use it differently, but it can produce exactly the same results)
    Please login to see this link.

    I don't recall Werbad's shader being particularly complex though, so maybe it just needs tweaking somehow...

  • Was this always like this?
    That's how it looks on MMF2...
    I'm sure Quad shader looks a lot better...

    Please login to see this picture.

    But it's concerning that a shader with nothing really special broke.
    Makes me think if some of the stuff I've tried and didn't worked was because of the same issue.

    Edit: the math on this other examples seems better, but still got a few issues on MMF2...
    Please login to see this link.
    Please login to see this picture.

    Nope. It's broken. The wall objects are being positioned and resized correctly, but that's not what the shader was for - the shader was to make the corners look right.

    Have a look at this example that I built as an .exe back when Werbad's shader still worked:
    Please login to see this link.

    It still works fine for me, whereas the .mfa doesn't.

  • Okay, soooo...
    I just tested Werbad's shader on its own, and it actually works fine.
    Which means that the problem is with the events - and I think I've found it!
    The issue is with passing integers as parameters that should be floats.

    Whenever there's expression to set a shader parameter, like this:
    ( ( Y Top( "Roof" ) - Min(Y Top( "Floor" ), Y Top( "Roof" )) ) + ( _Height( "Roof" ) * 50 ) ) / ( Max(Y Bottom( "Floor" ), Y Bottom( "Roof" )) - Min(Y Top( "Floor" ), Y Top( "Roof" )) )

    ...if you force Fusion to use floats (eg. replace "50" with "50.0"), it will work.

    This never used to be an issue, but apparently now is.

  • There is a difference with Quad shader between dx9 and dx11 where dx9 will crop pixels out of range and dx11 will bend the pixels maybe a difference in the sampler settings

    It shouldn't actually have anything to do with sampler settings. The way it checks for the pixel being within the quad is this part:

    Code
    float a = (xA - texCoord.x) * (yB - texCoord.y) - (xB - texCoord.x) * (yA - texCoord.y);
    float b = (xB - texCoord.x) * (yC - texCoord.y) - (xC - texCoord.x) * (yB - texCoord.y);
    float c = (xC - texCoord.x) * (yD - texCoord.y) - (xD - texCoord.x) * (yC - texCoord.y);
    float d = (xD - texCoord.x) * (yA - texCoord.y) - (xA - texCoord.x) * (yD - texCoord.y);
    if (sign(a) == sign(b) && sign(b) == sign(c) && sign(c) == sign(d)) {


    (a fairly standard algorithm to check if a point lies within an arbitrary convex quadrilateral)

    I forget why I did it that way now (it was a very long time ago). It would seem simpler to just check l and m are between 0 and 1, or there's probably even a sampler setting for it, like you say.

    Code
    getColor = tex2D(img, float2( l, m ));
  • I can now confirm using floats definately works :)
    Im so happy I can now use DX11
    Thanks again

    Please login to see this attachment.

    Facebook Page: Please login to see this link.
    My Project Releases: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!