Noob - How to use shaders

I’ve been looking at these shader thingies with some interest and have a couple of questions about them.
(Please bear in mind that I don’t understand them at all)

  • How easy are they to use?

  • Can they be used as a fill for an object? (if so how?)

Sorry if these seem like stupid questions. 

Hi.

I put up a couple projects, and Vlad S. added another, on the Code Exchange: examples

(I should update mine… where I do “discard;” there, I now do “return vec4(0.);”)

The how-to docs are here: Custom Shader Effects Guide

They can be used in fills, yes. Basically, these are what those look like, behind the scenes.

They should be easy to use, if their interface is nice. You can see in those examples how they get defined and hooked up.

The stuff you might have seen in the playground is fragment kernel-only (for the moment?). As such, they may not be representative of “production” use, where some work might make more sense done in the vertex kernel. But it is a “playground”, after all.  :slight_smile:

The shaders themselves are just per-vertex and per-fragment programs, with a few constraints. The demos are only scary because they throw tons of (often unexplained!) math at you.  :D In time some “best practices” and “common techniques” lists should emerge.

I’d say they are quite easy to use. The actual fragment (which I just think of as ‘per pixel’) code is not lua, but really if you can program, then it won’t be very difficult. The majority of shader programming is just plain programming anyway (manipulating values). There are just a few extra things like how to read the pixel colour of the texture you are working from, and that’s pretty much it.

As soon as you get your first one running, you’ll be fine from then on pretty much!

Hi.

I put up a couple projects, and Vlad S. added another, on the Code Exchange: examples

(I should update mine… where I do “discard;” there, I now do “return vec4(0.);”)

The how-to docs are here: Custom Shader Effects Guide

They can be used in fills, yes. Basically, these are what those look like, behind the scenes.

They should be easy to use, if their interface is nice. You can see in those examples how they get defined and hooked up.

The stuff you might have seen in the playground is fragment kernel-only (for the moment?). As such, they may not be representative of “production” use, where some work might make more sense done in the vertex kernel. But it is a “playground”, after all.  :slight_smile:

The shaders themselves are just per-vertex and per-fragment programs, with a few constraints. The demos are only scary because they throw tons of (often unexplained!) math at you.  :D In time some “best practices” and “common techniques” lists should emerge.

I’d say they are quite easy to use. The actual fragment (which I just think of as ‘per pixel’) code is not lua, but really if you can program, then it won’t be very difficult. The majority of shader programming is just plain programming anyway (manipulating values). There are just a few extra things like how to read the pixel colour of the texture you are working from, and that’s pretty much it.

As soon as you get your first one running, you’ll be fine from then on pretty much!