opengl es - Libgdx GLSL vertex world position? -


I'm trying a simple light shader that supports the point and directional light. Directional lights were completed, but I am struggling with point lights. How can I get the status of the top world to calculate the light direction? I am using Libgdx and a Phantom Baitter, and also an orthographic camera. For now, I am now (dirty) hack which is going to hand over the situation of the current phantom to the crumbler (center position), and it is going through its work. For what I have read in GLSL, I can get the ModelView matrix and multiply it with the current top position (I think this will be the "A_position" attribute) but I was unable to do this ...

Vertex shader:

  attribute vec4 a_position; Attribute vec2 a_texCoord0; Uniform Mat 4 U_prose trance; Vec3 status changes; Zero Main () {vTexCoord = a_texCoord0; Position = a_position.xyz; Gl_Position = u_projTranance * a_position; }   

Fragment shader:

  Miscellaneous vec2 vTexCoord; Vec3 status changes; Uniform Sample 2D u_texture0; // Diffuse map uniform sample 2D u_texture1; // Normal Map Uniform vec4 light_pos [2]; Uniform VC4 Light Colors [2]; // similar vec3 spritepos; // "hack" variable with phantom status ... zero main () {float attenFactor; Vec4 light ambient diffus = vc4 (0.0.0.0.0.0.0.0.0); Vec4 lightSpecular = vec4 (0.0.0.0,0.0,0.0); Vec3 ambient_light = vec3 (0.1.0.1,0.1); Vec3 eye deer = VC3 (0.0.0.0, -1.0); Vec3 LightDeir; Float Shinness = 10.0; Int Total Lights = 2; Vec3 general = normal ((Texture 2D (u_texture1, vTexCoord.st) .rgb * 2.0) - 1.0); Vec3 pos = position; // pos = Phantom; // This is what works for me to do (int i = 0; i   

The pause variable is the same which I send from my application.

Ok, how does it go? I have created a libgdx project that will work fine in the intelligencer < / P>

Open the project, run build.gradle. Set your work-directory in your run-configuration in the Android / Assets folder Edit: Oh, and maybe do not forget to specify the correct path for your Android SDK too!

Perhaps there was something wrong with passing your uniform, etc. There were some different pieces that were present in the vertexshader.

One more thing is that you do not have to use your texturecord-vector at the end, because it is already a vec2 and does not need to be inserted in any other shape. I think that the conference will have to be used. Anyway.st anyway!

A tip for variable naming:

  for different v_name for the u_name attribute for a_name m_name in the main function for value   

Best wishes with your project!

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -