Jump to content

Bigger but slower sway


L B
 Share

Recommended Posts

As title says.

 

Here's the starting code:

#ifdef LW_SWAY
float seed = mod(apptime / 100.0 * 0.25,360.0);
seed += mat[3].x*33.0 + mat[3].y*67.8 + mat[3].z*123.5;
seed += gl_Vertex.x + gl_Vertex.y + gl_Vertex.z;
vec4 movement = vec4( vec3( gl_Color.x * gl_Normal * LW_SWAY * 3 * (sin(seed)+0.25*cos(seed*5.2+3.2)) ),0.0);		
modelvertex += movement;
fragcolor = color;
#endif

I already made it bigger by multiplying the "movement" by 3 (5th line). Now I need to make it slower. Ideas?

Link to comment
Share on other sites

 float seed = mod(apptime / 100.0 * 0.25,360.0);

 

I think changing the "apptime / 100.0" should do something.

 

 

 

 

Then, of course, I could be completely off the track here.

Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64

Link to comment
Share on other sites

Yay, thanks.

Final code for a more fantasy-like look:

	#ifdef LW_SWAY
	float seed = mod(apptime / 500.0 * 0.25,360.0);
	seed += mat[3].x*33.0 + mat[3].y*67.8 + mat[3].z*123.5;
	seed += gl_Vertex.x + gl_Vertex.y + gl_Vertex.z;
	vec4 movement = vec4( vec3( gl_Color.x * gl_Normal * LW_SWAY * 30 * (sin(seed)+0.25*cos(seed*5.2+3.2)) ),0.0);		
	modelvertex += movement;
	fragcolor = color;
#endif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...