Jump to content
  • Advertisement

Alex Gomez Cortes

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Alex Gomez Cortes

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Alex Gomez Cortes

    Weird lighting when translating object

    Thank you for yur reply! It is what I did but it didnt fix the problem. What happened is that I have the same specular for every object, and that specular was the specular of a plastic. Greetings.
  2. Alex Gomez Cortes

    Weird lighting when translating object

    Thanks a lot, it was that. Hello and thank you very much for your reply! You have explained it perfectly, I understood everything. But now, I have a problem. Some white spots have appeared and I didnt have them earlier. Maybe some normals are wrong and this formula: diff = max(dot(v_Normal, lightDir), 0.2f); returns a number that is too high. Screenshot: Forget about that lake, I am trying to figure out the uvs of the plane so I can apply there a reflection and refraction texture. Greetings. Edit: Nevermind, it was the specular. Thank you!
  3. Alex Gomez Cortes

    Weird lighting when translating object

    Hello and thanks for your reply! I modify the normals every frame because the multiplication of the normals is made on the vertex shader. I understand what you said, but if dont multiply the normals then I cannot rotate the object. Isnt there a way to have the normals a way the object can be rotated and translated without having any problem?
  4. Hello everyone, About a month ago I finished programming the lighting (or at least it is what I thought), because a few hours ago I realized that when I translate the object, the lighting breaks (not when rotating, because I multiply the normals by the transpose of the inverse of the modelMatrix), only if I move the object from the 0,0,0. I only have one light, a directional one. Here the rock is at 0,0,0. T Here the rock is at -10,0,0. I only moved it to the left, and as you can see looks like the normals are wrong, but I do not touch them, except when I multiply them by the transpose of the inverse of the modelMatrix (if I do not multply the normals by that matrix the lighting doesnt break but when the object rotates the light rotates with it). So, is there a way to have the normals well for translating and rotating? Now I can translate the object and the lighting doesnt brake, but if I rotate it the light rotates with it. Now I can rotate it but if I move it the lighting breaks. Thanks a lot!!
  5. Alex Gomez Cortes

    Problem with Gerstner waves in vertex shader

    @_WeirdCat_ Hello and thanks for your reply! I dont need temp_vertices in the shader. When I calculate the waves through the cpu I need temp_vertices[] because I need to know the difference between the initial position and the new position after applying the formulas. As you can see, vertices[] is being modified every frame, so every frame I need to reset it with temp_vertices[] (it has the initial positions) in order to recalculate the difference between points again. In the shader, I dont need temp_vertices[] because vertices[] is not being modified, I just pass vertices[] to the shader and it acts like temp_vertices[] and pos acts as vertices[]. Thanks for your reply!
  6. Alex Gomez Cortes

    Problem with Gerstner waves in vertex shader

    @Reitano Thanks for your answer! The problem was what you said, I was multiplying the w component. But I have two questions: Why should the vector k be 2D? If I want to make a wave that moves along z axis I can't then. What is the offset of the wave? Thank you! @_Silence_ First of all thanks for your answer! olas is not the L uniform. L, k, w, speed, A are the attributes of the waves, so what I do is: when I call the draw function, I make a foor loop where in every iteration i pass to the shader olas.w, olas.k, etc. as uniforms. I'll read about passing arrays to the shader because right now only the last wave is being rendered, the previous no, so I think I can pass several arrays (one array of w components, another one of L components, etc) and iterate inside the vertex shader applying the formulas with the right variables. Thank you very much!
  7. Hello everyone! I am working in a openGL framework lately, and I found a problem when implementing Gerstner waves. The problem is that when I calculate the waves through the CPU, it works really good, but when i copy and paste the code to the vertex shader(with some changes, uniforms, etc) the waves become weird af. I am going to post some pictures so you can get a better idea about what is going on. CPU waves: GPU waves: Code comparison: k->wave direction w-> frequency A-> amplitude of the wave L-> distance between crests If someone knows what is going on, please tell me. Thank you in advance!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!