Is there any tutorial or example for viewport shaders?

I've looked around the wiki and while it appears that viewports can use shaders, there doesn't seem to be any example that I can find of doing so.

Is there any way someone can provide an example of say, tinting the screen red? Maybe a Gaussian blur?

Tagged:

Comments

  • I asked the same question a long time ago and was recommended by Iarwain to rather use an object the size of your viewport, and then a shader on the object. I am having trouble finding the conversation and the reasons for not doing it directly to the viewport itself.

    I'll keep digging around.

  • Found it! Here is the discussion about viewport shaders: https://gitter.im/orx/orx?at=56dc09c168c077746482d1e3

  • @sausage said:
    Found it! Here is the discussion about viewport shaders: https://gitter.im/orx/orx?at=56dc09c168c077746482d1e3

    I've reviewed the discussion, but I'm still at a loss for how to properly set up anything I'm looking for :(

  • Hi GaryM. Sorry for the late reply. It was more centred around the advice to add a shader to an object as it's the better method. The object should be the size of the viewport. You can use the existing tutorials to do this part.

    By the way, you can join us in gitter if you like.

  • Hi @GaryM and welcome here. Sorry for the late reply on my side, I was out on vacation until yesterday.

    So yes, you can use a shader on a viewport by simply using a ShaderList property on it.
    There's an example in the compositing tutorial, unfortunately the wiki entry is a bit outdated and doesn't show the data-driven approach to it, however the actual project should help: https://bitbucket.org/iarwain/compositing/src/default/data/compositing.ini

    If you look at BounceAlt.ini, which is the playground used to develop and test orx (in /code/bin), you'll also find another example of such a shader.

    The biggest notable differences of using a shader on a viewport instead of on an object are:

    • the time property will use the time that ellapsed since the start of the application with a shader while it'll be the object's age on an object
    • undefined shader parameters will use the current active texture on an object however there's no equivalent with a viewport.

    Let us know if you have any other questions.

Sign In or Register to comment.