Godmaster Posted July 7, 2006 Report Share Posted July 7, 2006 Hello Anyone knows how to make a wavy distortion in water (not only for the background)? How I can do this in GM6 registered? Link to comment Share on other sites More sharing options...
VectorSatyr Posted July 7, 2006 Report Share Posted July 7, 2006 I have a technique, but I don't plan to release it 'till after SAGE. You can ask Dami about it, though, since I showed it to him. Link to comment Share on other sites More sharing options...
Yoshi Posted July 7, 2006 Report Share Posted July 7, 2006 The best way to do it would probably be by using surfaces, but the way I am going mine, it only works well with the background. Link to comment Share on other sites More sharing options...
Damizean Posted July 7, 2006 Report Share Posted July 7, 2006 You first need to capture the screen. We can do that using a surface and screen_redraw. We just need to create an objDistortion, and on step event, capture the screen like this: // Capture the screen surface_set_target(screen_surface); draw_clear_alpha(c_black, 0); // Clear surface screen_redraw(); // Call all redraw events surface_reset_target(); // End with screen capture This way, the only thing we have left is to then draw the surface distorted, wich you probably want to do it using sin, and some kind of angle. I'm uploading an example on how to do this water distortion: Download it here With it, it comes two ways: Normal and average x distortion, and another with also distorts y coordinates. Enjoy! Link to comment Share on other sites More sharing options...
Zonar Games Posted July 7, 2006 Report Share Posted July 7, 2006 Damizean is a genious... Link to comment Share on other sites More sharing options...
VectorSatyr Posted July 7, 2006 Report Share Posted July 7, 2006 I gets no love. ;_; 1 Link to comment Share on other sites More sharing options...
Zonar Games Posted July 7, 2006 Report Share Posted July 7, 2006 ,lol AeroGP you are a genious too, you and damizean...i'm serious. Link to comment Share on other sites More sharing options...
Godmaster Posted July 7, 2006 Author Report Share Posted July 7, 2006 Whoa! Too cool! I'll implement this in my project, thank you ^^ Link to comment Share on other sites More sharing options...
Kain Posted July 8, 2006 Report Share Posted July 8, 2006 You know, you can still use textures that are not powers of squares in draw_primitive_**** functions. It's just converted to a texture of the lowest square above it's width/height, so as long as you can multiply the text values by tha_actual_width/the_lowest_square_above to get the results you want: if (global.capture == false) { current_angle += angle_increment; // Draw the screen as a distorted surface angle = current_angle; draw_set_alpha(0.7); draw_set_color(c_white); draw_primitive_begin_texture(pr_trianglestrip,surface_get_texture(screen_surface)); for (y=0; y<=480; y+=increment) { // Draw the "y" scanline of the surface, but in a offset, to give the distortion effect draw_vertex_texture(view_xview + sin(angle)*wave_offset, view_yview + y, 0, y/480 * 480/512); draw_vertex_texture(view_xview + 640 + sin(angle)*wave_offset, view_yview + y, 640/1024, y/480 * 480/512); angle += wave_pitch*increment; } draw_primitive_end(); } I didn't experience any significant speed increase (what the increment was set to didn't effect the speed), but it went from 110 fps max to 132 fps max using this method. Link to comment Share on other sites More sharing options...
Damizean Posted July 8, 2006 Report Share Posted July 8, 2006 Interesting Very good method there! As for Aero, give him credits instead of me, he deserves more than me ;o Link to comment Share on other sites More sharing options...
Recommended Posts