On Thu, Feb 13, 2020 at 10:53 AM Brian Schott <schott.br...@gmail.com> wrote:
> Bill (et al),
>
> Can you comment on my initial assumption that shader.ijs is not really
> moving the cube but is moving the eye in relation to the cube, (and that a
> more common way to move **multiple** objects is to move them, not the eye.)

That's... a point of view that might sometimes be useful?

I haven't taken time to study this example, but... generally speaking,
there's two kinds of shaders in common use in opengl:

vertex shaders
pixel shaders

A relatively common operation that might appear in a vertex shader is
a matrix multiplication which is uniformly applied to the entire
system. This operation could be thought of as "moving the eye in
relation to the cube". You could substitute "camera" or "coordinate
system origin" for "eye" there, also.

But that's not the only possible operation, of course. Vertex shaders
can apply any implementable algorithm to move different vertices to
different places. So (one example) a vertex shader might stretch the
cube along one diagonal.

Meanwhile, pixel shaders choose what color to paint a single pixel (on
the surface of the cube, for example). And their power is that of
array operations -- their operations can be applied to every pixel in
the scene.  (Leading to the examples you can see at shadertoy.com --
though you'll probably need to make sure that hardware support for
opengl is enabled in your browser to view those examples. It's
relatively common nowadays to have that turned off, for security
reasons.) Anyways, depending on what you have set up, it should also
be possible to use the "moving the eye in relation to the cube"
abstraction in a pixel shader (but, almost certainly, that would not
be applicable to the code you're working with today).

I hope this helps,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to