Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:52:41+00:00 2026-06-15T14:52:41+00:00

I’m making a simple application/wallpaper, that adds simple water ripple effect to background image.

  • 0

I’m making a simple application/wallpaper, that adds simple water ripple effect to background image.

I’m testing on HTC Desire (Android 2.2).

I have found this explanation of how this is done and implemented it for android Adrian Boeing: Blog.

The problem now is very low performance. If I have still image (with normal shader) the fps is around 40-50fps. If I add the part that calculates sinc function and than use new calculated value for texture fps drops to 20fps.

Problem is I want to add more than just 1 ripple, and fps drops /2 by number of ripples (t.i 2 ripples = 10fps, 3 ripples 5 fps etc…).

Have I badly implemented this shader and it there some room for drastically optimization, or are effects like this done in some other way?

The effect is similar to that default live wallpaper on Android called Water (Autumn leaves tumble to rippling pond below).

Here is code of my shader:

    private final String fragmentShaderCode = 
        "precision mediump float;" + 
        "uniform sampler2D uTexture;"+ 
        "varying vec2 vTexCoordinate;"+ 
        "uniform float mTime;"+ //time variable 
        "uniform float offX;"+//center of wave 
        "uniform float offY;"+//center of wave 
        "uniform float size;"+//size of wave (so you can make it smaller over time) 
        "void main() {" + 
        "        vec2 off2 = vec2(offX,offY);"+ 
        "        vec2 cPos = -1.0 + 2.0 * vTexCoordinate.xy;" + //bring coordinate to middle of screen 
        "        vec2 ofvec = cPos+off2;"+ //doda offset 
        "        float r = length(ofvec);"+ //length of vector 
        "        cPos = vTexCoordinate + (size)/(r*2.0)*sin(r*100.0-mTime); "+ //sinc function for wave simulation 
        "        gl_FragColor = texture2D(uTexture,cPos);" + //draw texture 
        "}"; 

Note: I added this code for it’s simplicity to read. The code that uses multiple touch events, just uses vector for offX,offY, and does the code below in for loop.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:52:42+00:00Added an answer on June 15, 2026 at 2:52 pm

    A lot of heavy computations in fragment shaders badly affects performance. The quite common practice for optimization for mobile OpenGL ES devices is to move heavy computations to vertex shaders.

    In this case you will need to reconsider logic of shaders and modify geometry too. I propose to make a mesh with good enough tessellation to simulate water waves, and alter vertex positions to make ripple effect.

    Alternatively, you can leave all logic within fragment shader but alter computation of UV offset using external baked texture with offset data. This way you will have the same quality of effect but with significantly improved performance. You have to store in separate texture baked data for UV deltas for given distances and read ready pre-computed value from this texture. All mobile devices GPUs has at least 2 texture samplers so additional texture2D() call is almost free.

    To have an idea how it works, please read this article http://prideout.net/blog/?p=56 It is about path deform, but you should take a look at the method of sampling certain pre-calculated data from texture.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.