Shader ignores rotate_anim / scroll_anim ?!?!

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Shader ignores rotate_anim / scroll_anim ?!?!

Post 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
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
psquare
Hobgoblin
Posts: 554
Joined: Tue Nov 14, 2006 3:26 pm
x 7

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by psquare »

Yes, scroll_anim , etc won't work in a programmable pipeline (= shader). This is mentioned in the manual/docs too.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post 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 ;)
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
psquare
Hobgoblin
Posts: 554
Joined: Tue Nov 14, 2006 3:26 pm
x 7

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post 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.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post 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.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
havokentity
Halfling
Posts: 71
Joined: Tue Mar 31, 2009 8:01 am
x 1

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post 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
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post 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.
User avatar
havokentity
Halfling
Posts: 71
Joined: Tue Mar 31, 2009 8:01 am
x 1

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post 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?
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post 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;
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
havokentity
Halfling
Posts: 71
Joined: Tue Mar 31, 2009 8:01 am
x 1

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post 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.
Post Reply