Sign in to follow this  

Animate textures

This topic is 1098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I'm working on a model that I would like to animate some part of.

 

[attachment=24943:coils.jpg]

 

Here the red rings of each coil should glow, while the timing of the glow should make it look like it is going down the complete coil.

 

For "normal" animation by skinning or even vertex keyframes I have the habit of keeping all of the vertices in one object. But as far as I can tell there is no good way to keep all the rings in one object and still animate this color transition separate for each ring. Maybe I could have 2 sets of uv's? But even then I don't see a flexible way of changing the timings: duration of glow, delay between next ring to start glowing, delay before first ring starts next sequence.

 

One solution I see is making each ring its own object so it can have its own timing variable for the shader. But I don't like this as it increases the draw calls by a lot.

 

Is there a better way to animate something like this?

 

Thanks,

Mox

Share this post


Link to post
Share on other sites

Do you mean doing another render pass to only draw the coils? To set the parts of the coil that should glow? I think that still leaves me with the task of finding out what part of the coil should be setting the mask.

If not, what should the texture mask look like?

 

I also thought about making a complete linear glow, that could be based on the z-coordinate of the vertices. But I would like to keep the glow of a ring the same for all the vertices off the ring. Something like the following.

 

[attachment=24944:coils2.jpg]

 

I don't know yet whether I will like this 'discrete' glow, but I want to animate this before trying the complete linear approach.

Share this post


Link to post
Share on other sites

You could add a per-vertex "ring index" that would be the same for all vertices in a ring (you could stash this in the vertex color channel, if you're not using it), and then have a custom shader that colors things appropriately.

Share this post


Link to post
Share on other sites
Hi.

You could have a your mesh as it is have glow material. And also have a single ring mesh that you render on top of the other main mesh then you can move the single mesh up and down

Share this post


Link to post
Share on other sites

Having a glow material would require me to render it as a separate pass would it not?

And the single ring mesh above that would be another pass, for each ring that I move it up and down for. So that is a lot of passes.

Making it really glow instead of only changing the diffuse saturation would probably require another pass, but I would like to keep the passes to a minimum.

 

 

For encoding the ring index I was also thinking of adding it as the alpha channel for the diffuse channel. Decoding this could be messy, but should work. Although this will mean that every ring will have to get its own uv space, this should probably only be a few pixels for each ring. Without this every ring could occupy the same uv-space.But including a color attribute will also waste space. In the end you always have to store it somewhere happy.png

 

--edit

I guess storing an int in the alpha value could be problematic with mipmapping. You wouldn't want the indices to blend together. Otherwise it seems to work.

But I guess separate vertex attributes are better. Be it as color or as extra uvs.

Edited by MtSMox

Share this post


Link to post
Share on other sites
Maybe it's time to have glow maps. I never had a glow map until 3 month ago and I wished I set one up before I got into more work on my app. Because it was a lot of rework to setup multi render targets and full screen quad. What I'm saying is it may be time to have glow maps they change the way the app look and now day all good apps use some form of glow. Time to sprouse the goose.

Share this post


Link to post
Share on other sites

One solution is to use a texture mask and have the glow result based on it. You can also mix that with a lerp to have linear glow value from start to actual mask value.

That's what I wanted to say with mask to set the glow value based on it. Using one "if" and a good greyscale mask texture you can have what you want I think.

Edited by Alundra

Share this post


Link to post
Share on other sites

Maybe it's time to have glow maps. I never had a glow map until 3 month ago and I wished I set one up before I got into more work on my app. Because it was a lot of rework to setup multi render targets and full screen quad. What I'm saying is it may be time to have glow maps they change the way the app look and now day all good apps use some form of glow. Time to sprouse the goose.

 

I've recently also been looking into outlining and I guess this could use the same techniques. Rendering to a texture, blurring the texture and then render the result back on a fullscreen quad.

 

Would this not be a problem with occlusion? The blur could probably go over the occluding object, could it not?

 

But I do think you make a good point. I should think about my rendering needs and setup the required architecture. Lately i've also been looking a deferred shading, which could also help here I think. Though I'm not sure if that is overkill right now.

Share this post


Link to post
Share on other sites

You could offset the UV coordinates for each ring a bit and just use a downscrolling texture with bands of glow. If you offest it by the right amount it should look like the glow is going from one ring to the next.

Share this post


Link to post
Share on other sites
If the mesh is not a skinned mesh. And made up of frames you could add the extra ring in the main mesh place it at the ring you want to start at then in the app keep a pointer to the frame ring and move it up and down by changing it's frame matrix then you don't need the other draw call.

Share this post


Link to post
Share on other sites

You could offset the UV coordinates for each ring a bit and just use a downscrolling texture with bands of glow. If you offest it by the right amount it should look like the glow is going from one ring to the next.

 

I think it will come down to something like this.

 

 

If the mesh is not a skinned mesh. And made up of frames you could add the extra ring in the main mesh place it at the ring you want to start at then in the app keep a pointer to the frame ring and move it up and down by changing it's frame matrix then you don't need the other draw call.

 

I don't really understand what you are saying here. Do you mean frames as in multiple copies of the same mesh in one vertexbuffer? You mentioning a matrix makes it look like a skinned mesh again.

Share this post


Link to post
Share on other sites

I call a mesh made up of many meshes a Frame Hierarchy. And each mesh has its own matrix to position it to the root mesh.

 

Then what you do is find the name of the frame(the ring) and store its pointer so you can change its matrix at run time(Y only if the models up is +Y)

You will need to find its max and min movement amounts trial and error. or you could build the markers into the mesh when creating it.

 

I do this for the scroll bar in my UI as there made from meshes.

Share this post


Link to post
Share on other sites

This topic is 1098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this