Page 1 of 1

Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Mon Mar 15, 2010 6:54 pm
by spacegaier
First of all: I am not 100%ly sure whether I am just doing something wrong or whether it really can't be done currently:

I have a pass with a shader and a texture_unit. Now I wanted to rotate/scroll the texture and then afterwards use it as the input for the shader. But I think that these animatations aren't taken into account by the shader, as it seems to look up the texture colour values an the base of the default orientation. Is this correct?

I will now alter the texture in my shader itself, which however will cause me to feed in an extra timestamp parameter on whose base I can alter the texture's orientation, so that's not the nicest way. But it is not a really important feature request on the other hand (if any at all ;) ). I could imagine that the same applies here as for the lightning: As soon as you leave the fixed-function-pipeline, you are on your own.

Cheers
spacegaier

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Tue Mar 16, 2010 4:13 pm
by psquare
Yes, scroll_anim , etc won't work in a programmable pipeline (= shader). This is mentioned in the manual/docs too.

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Tue Mar 16, 2010 5:41 pm
by spacegaier
psquare wrote:Yes, scroll_anim , etc won't work in a programmable pipeline (= shader). This is mentioned in the manual/docs too.
Do you have a link to the referenced place? I have looked into the manual quite some times in the last days, but this line never appeared to me ;)

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Wed Mar 17, 2010 3:17 am
by psquare
I could swear I had seen it in the manual, maybe it got updated, because I don't see it now either :-)

But here's the docs:
http://www.ogre3d.org/docs/api/html/cla ... a8206d3dd4
Note: Has no effect in the programmable pipeline.

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Wed Mar 17, 2010 8:40 am
by spacegaier
Okay, so there is nothing the manual, perhaps that should be changed. But thanks for pointing my to the API in this case.

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Sun Mar 21, 2010 5:50 am
by havokentity
Hi spacegaier and psquare,

Texture matrix animations work with shaders,

Kojack and sinbad have clarified that this works, and it worked for me after I saw Kojacks sample and what struck me was that Kojack defined is auto param in the vertex_program_ref.

Please take a look at: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=56317

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Sun Mar 21, 2010 6:22 am
by Kojack
Instead of "Note: Has no effect in the programmable pipeline." the manual should say something like "Note: Has no effect in the programmable pipeline if your shader doesn't explicitly support it.".
It's the same as lights, adding a light to the ogre scene has no effect if you don't bind it to shader parameters and add lighting code yourself to the shader.

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Sun Mar 21, 2010 9:39 am
by havokentity
Yep that change should be made to the docs. But I guess its understood

but,

remember I did bind my texture_matrix auto param, so I followed a similar procedure of how I used lights and others, but texture_matrix
alone did not work when bound in default_params, I think it might have been due to the pass inheritance?

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Sun Mar 21, 2010 12:18 pm
by spacegaier
Okay, I had this scroll_anim in the texture_unit and hoped that it would affect the shader as well. In the meantime I solved it like this:

In the material:

Code: Select all

param_named_auto time time_0_x 500
param_named animSpeed float 0.002
and in the shader:

Code: Select all

uv += time * animSpeed;

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Posted: Sun Mar 21, 2010 1:40 pm
by havokentity
Yep thats the obvious next step if texture matrices didn't work,

However,
using the texture matrix I think is more efficient and gives us more possibilities, because Ogre3D's TextureUnitState
animation helpers support wave function, rotation and scrolling animation.