Animate textures

Started by
15 comments, last by Alundra 9 years, 4 months ago

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

Advertisement

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.

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.

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.

Yeah, I think that might do the trick. Gives me a lot of freedom to base the animation on. Thanks.

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

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.

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.

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.

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.

This topic is closed to new replies.

Advertisement