New 3d Perspective Shader

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.
  • It's not finished, optimized or ported to DX11 yet, but just thought I'd show off my progress so far, since I know a few people have been waiting for a shader like this, and there are some others who like tinkering with shaders...

    Download: Please login to see this link.

    Please login to see this picture.

    Not sure why there are visual artifacts at the edges...

    Edited 3 times, last by MuddyMole (December 2, 2022 at 10:47 AM).

  • Cheers!
    The code needs commenting, and variable names need changing to something more descriptive, so those people interested in how it works can understand what's going on (it's actually pretty simple, believe it or not).
    There's room for optimization - doing the 3D rotations by matrix multiplication, for example.
    I'll probably add a "zoom(-out)" parameter, so you don't need to add an empty border around the image.
    I'd like to fix those visual artifacts at the edges somehow...
    I'm not promising anything, but there's also the potential for lighting effects (Phong shading, specular maps...).

    I definitely won't be porting to Android/iOS, as I don't have any means of testing on those runtimes. I should be able to do a DX11 port, but I might not get around to it for a while... So yeah, go ahead if you want to - or maybe wait until there's a more "final" version.
    As always, anyone is free to modify, share and use the shader in any way they like.


    EDIT: If you set the border to transparent instead of white, those visual artifacts go away :)

    Edited once, last by MuddyMole (December 2, 2022 at 12:02 PM).

  • I've changed it now, but the original picture of the dog had a white border. That was necessary because otherwise as the image rotates, it no longer fits the object and bits get cut off (hence the idea of a zoom-out parameter). I thought that since the background of the frame was white, you wouldn't be able to see the border, but for some reason there are those ugly visual artifacts at the edges. But if you use a border of transparent pixels instead of white, those disappear.

    I can't quite tell if this example:
    Please login to see this link.
    ...is using per-pixel lighting or not?
    You might be able to get that effect by just having a "highlight" layer overlaying the card, and varying its opacity according to the angle of the card. That would be more efficient that doing it in the shader anyway, since it's then one calculation per object, not one per pixel.

  • Well, on the video it has a fingerprint overlay that has some blending mode to it...
    I'm not sure if that's per-pixel or just a overlay...

    Btw, here's my ports, proper alpha channel support included, also added a zoom parameter (this has all files, not just the port)
    Should work on DX11, Android, iOS/Mac!

  • Very cool idea, MuddyMole. Thanks!
    So, a Phong Shading effect would be realizable as well? :D
    You are blazingly fast with code conversion process, NaitorStudios!
    btw NaitorStudios - did you actually receive the test archive with gimp files etc. from my latest shader topic?

    Besides Windows EXE Runtime - are most other Exporters already capable to interprete these specific shader controlled transitions correctly?

    Currently working on ... [SIGPIC][/SIGPIC] ... a Puzzle Platformer

    Edited 5 times, last by Wodjanoi (December 2, 2022 at 8:30 PM).

  • I've noticed (and should have anticipated) that the shader only works perfectly with square textures, so if your object is not square, you should add transparent margins to make it square. I have a feeling this would be tough to fix.

    Flat shading is not too complicated, but I'm still not sure if it's a good idea to put it in the shader. As mentioned earlier, it's probably better to do the calculations once using CF2.5 events, rather than repeating them for each of the texture's thousands of pixels in the shader. Per pixel shading probably isn't worth it anyway, since we're only talking about simple flat surfaces without shadows, multiple light sources, etc.


  • btw NaitorStudios - did you actually receive the test archive with gimp files etc. from my latest shader topic?

    Yes, but I've been extremely busy with 5 paid projects...
    I often do a port or something that doesn't require thinking too much whenever I'm too burned out.
    In all cases, from what I've seen converting LCh seems really messy, I'm not sure if that would perform well enough for it to be applied to multiple instances.
    Image editing softwares have these kind of things cause they don't need to render 60 times per second or more, so realtime speed isn't really a concern for something like Gimp or Photoshop...

    Found these snippets of code about the conversion:
    Please login to see this link.

  • Sorry NaitorStudios, you're going to hate me, but I've updated the shader...

    Download: Please login to see this link. (version 1.1)

    Changes:
    + Commented all shader code (in case anyone's interested).
    + Should now work properly with non-square textures.
    + Added adjustable ambient lighting and a single configurable directional light source.

    Please login to see this picture.

    Edited once, last by MuddyMole (December 3, 2022 at 2:03 PM).

  • Here's the DX11 Port :)
    Also fixed the light intensity that wasn't connected to anything...

    Oh, I just forgot to remove the light intensity parameter from the xml - I was testing it with that first, before swapping to a float4 colour instead. There's no reason to have both, since a lighter colour is the same as a more intense light anyway (unless you want super intense lights, I suppose).
    Cheers though

  • Just wondering like a playing card, is there a way to have two different sides to a rotating card (front and back)?

    I've modified the shader to add an image parameter for the reverse side of the object. Lighting still only works correctly for the front side (this is proving hard to fix), so if you're using both sides, you will need to disable it by setting the ambient light to pure white, and the directional light to pure black.

    Download: Please login to see this link. (version 1.2)

    Edited once, last by MuddyMole (December 4, 2022 at 2:22 PM).

  • I do believe I've finally cracked the lighting problem!

    Please login to see this picture.

    Just need to fix up the code a bit (it's full of hacks and the remnants of failed attempts right now lol), and then I should be able to provide a link to the file soon...

    Edited once, last by MuddyMole (December 4, 2022 at 5:19 PM).

Participate now!

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