L B Posted May 12, 2010 Share Posted May 12, 2010 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? Quote Link to comment Share on other sites More sharing options...
Kazar Posted May 12, 2010 Share Posted May 12, 2010 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. Quote Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64 Link to comment Share on other sites More sharing options...
Josh Posted May 13, 2010 Share Posted May 13, 2010 This will make it half as fast: float seed = mod(apptime / 200.0 * 0.25,360.0); Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
L B Posted May 13, 2010 Author Share Posted May 13, 2010 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 Quote Link to comment Share on other sites More sharing options...
Kazar Posted May 13, 2010 Share Posted May 13, 2010 Wow, I was right! Quote Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64 Link to comment Share on other sites More sharing options...
Recommended Posts
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.