Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Problem of environment mapping

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    11

    Question Problem of environment mapping

    Hi, all.

    I encounter a odd phenomenon when I make a environment mapping effect on a cube.

    It is shown as follow :

    Click image for larger version. 

Name:	未命名.jpg 
Views:	75 
Size:	15.3 KB 
ID:	1020


    Does some one encounter same situation as like as mine ?

    (P.S I calculate the reflect vector in world matrix, I don't use the gl_NormalMatrix. My cube only have a translation, no rotation and scale.)
    Last edited by LaLaChen; 05-09-2013 at 06:58 AM.

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    7
    hello
    I want from y
    to gave me delay instruction in opengl
    ex i want to draw sphere in first time then in second time i will draw cube etc.

    how can i make this?

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    11
    Quote Originally Posted by marahalsaidan View Post
    hello
    I want from y
    to gave me delay instruction in opengl
    ex i want to draw sphere in first time then in second time i will draw cube etc.

    how can i make this?
    Does you mean that you want to draw sphere at current frame and then exchange the one to cube at next frame ?

    If you want to do this thing, you can use the function glutSolidCube and glutSolidSphere with glut.

    you can get the example and specification of those functions in Internet.

    Then you can change drawn object by if-else statement in display function.

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    11
    Hi, all.

    Does someone happen the odd situation as like as mine?

    Click image for larger version. 

Name:	未命名.jpg 
Views:	48 
Size:	16.4 KB 
ID:	1026

    I attempt to check my matrix, but I think that isn't related with my problem.

    Because I saw my plane looked like two different plane in large reflect angle.

    This problem confuse me already two weeks.

    And I have no idea how and what I should check.

    My code is as follow :

    vertex shader :

    varying vec4 object_reflect_dir;

    (In calculate world information function)
    world_vertex = world_matrix * gl_Vertex;
    world_normal = normalize(world_matrix * vec4(gl_Normal,0.0));
    (In calculate world eye information function)
    world_e = vec4(normalize(eye_position.xyz - world_vertex.xyz),0.0);

    (In calculate world reflect dir information function)
    vec4 world_reflect_dir = vec4(normalize(reflect((-1.0) * world_e.xyz,world_normal.xyz)),0.0);
    object_reflect_dir = normalize(world_reflect_dir);

    Fragment Shader :

    varying vec4 object_reflect_dir;

    (calculate cube map color)

    vec4 reflect_pixel_color = textureCube(environment_map,normalize(object_refle ct_dir.xyz));

    environment_color = reflect_pixel_color;

    return environment_color;

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    11
    Hi, All.

    I already solve this problem.

    The reason causing the odd situation is that I normalize the vector from world eye position to world vertex position before calculate the reflect vector.

    Maybe I should to calculate the mathematics about reflect vector calculating.

    I will got my answer afher I understand it.

    Thans a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •