Results 1 to 7 of 7

Thread: HELP - How to create a Shaky effect?

  1. #1
    Guest

    HELP - How to create a Shaky effect?

    If i'm walking through a pipe,how to create the shaky effect(in terms of view). In 3Dgames if we walk through a tunnel, the walking effect is depicted as a shaky effect(in terms if view). I want to create something like that.

    I'm using glLookAt for viewing. I introduced a variable for y axis(which is my updirection) and i keep adding and subtracting(0.2) alternatively.


    zz - variable for walking
    yy - variable for shaky effect

    ...
    gluLookAt(7, -12+yy, 5+zz, 3, -12, 5, 0, 1, 0);
    .....


    window_idle()
    ...
    changed yy value to -1 and +1
    ....


    But I can't see the effect. Anything wrong in my logic or this logic won't work to create that effect?

  2. #2
    Guest

    Re: HELP - How to create a Shaky effect?

    guys, any idea?

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: HELP - How to create a Shaky effect?

    You're redrawing the scene after you change gluLookAt, right?

    A bit more code might be helpful
    Deiussum
    Software Engineer and OpenGL enthusiast

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: HELP - How to create a Shaky effect?

    Try shaking the reference point in addition to shaking the eye point (not necessarily by the same amount or phase). Also you might want to implement a smoother shaking algorithm, one that continuously (or rather piecewise continuously) oscillates rather than makes discrete steps.


    [This message has been edited by DFrey (edited 04-15-2002).]

  5. #5
    Guest

    Re: HELP - How to create a Shaky effect?

    I got it. but now i have new trouble. I'm not able to retain a value in a variable in windows_idle function

    window_idle()
    {
    if (*p=0)
    {
    yy=yy+1.0;
    printf("I'm in");
    *p=1;
    }
    else
    {
    yy=yy-1.0;
    printf("I'm in p= %d",&p);
    *p=0;
    }
    glutPostRedisplay();
    }

    p is a global pointer and 'pp' holds the value 0 or 1. I assigned the pointer to pp in initialising function. but no effect. it always fails in the if condition and executes the else part. so the viewpoint moves away from the model.

    help me guys

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: HELP - How to create a Shaky effect?

    You have an assignment expression in that if clause rather than a relational expression. Looks like you typed = when you meant ==.

  7. #7
    Guest

    Re: HELP - How to create a Shaky effect?

    Thanks for pointing out the mistake Mr.Frey. I got it. It works.

Similar Threads

  1. Texture or Point Rendering to create effect in drawing app.
    By abaababb in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-02-2017, 06:20 AM
  2. How to create 2D glowing effect
    By wrymnn in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 07-26-2015, 04:20 AM
  3. How to create a sand effect\pile up?
    By Capt.Yoda in forum OpenGL: General
    Replies: 0
    Last Post: 05-27-2014, 02:54 PM
  4. Shader to create RGB Transition effect
    By swathi in forum OpenGL ES
    Replies: 3
    Last Post: 06-18-2012, 01:25 AM
  5. gamedarwinia: digital sky - howto create similiar effect?
    By herc in forum OpenGL: Basic Coding
    Replies: 16
    Last Post: 04-24-2006, 01:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean