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: 4293
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 2
Contact:

Shader ignores rotate_anim / scroll_anim ?!?!

Post by spacegaier » Mon Mar 15, 2010 6:54 pm

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
0 x
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

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by psquare » Tue Mar 16, 2010 4:13 pm

Yes, scroll_anim , etc won't work in a programmable pipeline (= shader). This is mentioned in the manual/docs too.
0 x

User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4293
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 2
Contact:

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by spacegaier » Tue Mar 16, 2010 5:41 pm

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 ;)
0 x
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

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by psquare » Wed Mar 17, 2010 3:17 am

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.
0 x

User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4293
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 2
Contact:

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by spacegaier » Wed Mar 17, 2010 8:40 am

Okay, so there is nothing the manual, perhaps that should be changed. But thanks for pointing my to the API in this case.
0 x
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

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by havokentity » Sun Mar 21, 2010 5:50 am

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
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7152
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 19

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by Kojack » Sun Mar 21, 2010 6:22 am

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.
0 x

User avatar
havokentity
Halfling
Posts: 71
Joined: Tue Mar 31, 2009 8:01 am

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by havokentity » Sun Mar 21, 2010 9:39 am

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?
0 x

User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4293
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 2
Contact:

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by spacegaier » Sun Mar 21, 2010 12:18 pm

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;
0 x
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

Re: Shader ignores rotate_anim / scroll_anim ?!?!

Post by havokentity » Sun Mar 21, 2010 1:40 pm

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.
0 x

Post Reply