Game Development Community

Constantly scaling material in Shadergen? Is it possible?

by Dave Calabrese · in Torque Game Engine Advanced · 12/11/2007 (5:12 pm) · 6 replies

I am attempting to make a material using just ShaderGen that constantly scales. If anyone has played Kingdom Hearts, think of the large heart shaped portal in Hollow Bastion... that effect. It's almost as if the texture is scrolling outwards from the center, but just repeats when it gets to the end.

I can... sorta do this, so far, with Shadergen, using the Wave Animation properties. However, this one will scroll outwards, then shoot back into the center, and start over again. I want it to just keep scrolling!

Any thoughts on how to do this in Shadergen? Mind you, we are unable to use custom HLSL shaders for this project.

Thanks in advance!
-Dave C.
21-6 Productions

#1
12/12/2007 (12:02 am)
Quote:Any thoughts on how to do this in Shadergen? Mind you, we are unable to use custom HLSL shaders for this project.

Why?
If you use ShaderGen shaders, then there is no reason not to use costum ones ...
Because if you did so it would be far simpler by just using a Pixelshader that moves the coordinates away from a given center at a given speed.
#2
12/12/2007 (12:58 am)
Restraints on our current project prevent us from using custom shaders, unfortunately. =/ However I do realize this would be many epic eons easier to do with custom shaders.

I did, however, figure out how to do this with Shadergen. You have to use the 'rotation' flag, then unwrap the mesh in a creative fashion.

-Dave C.
21-6 Productions
#3
12/12/2007 (1:49 am)
Interesting attempt to solve it :)
#4
12/12/2007 (1:54 am)
To be a little less vague than 'Creative Fashion'... move around the verts so they are not properly aligned to the material, and make sure that the offset for the rotation is not the very center of the material (unless you want that kind of an effect). The trick you are attempting for here is for the material to rotate on very uneven planes, causing it to warp, stretch and distort in a very liquid-like fashion. (Providing the objects don't get cut, check out our next game for an example of this in action).

-Dave C.
21-6 Productions
#5
12/12/2007 (2:18 am)
So a similar way like for example "spiral sphere" unwrapping (I know that this does not really exist but a spiral would make sure it moves outward)
#6
12/12/2007 (10:28 am)
Use in fragment shader:

Out.col = tex2D(diffuseMap, In.texCoord * Scale);

For animation use FOR cycle with Scale.
You also need Time (PC_ACCUM_TIME)