java - Why do my lighting calculations cause colors to jump to black? -
I have a view in which the map originated from the altitude map. I can take this map to the X and Y axis. , Where the map moves up or down, as if the map geometry pierces the original. There is a light above the map, which is always 5 units above the height of geometry on the coordination of its X and Y.
When the camera is located close to the origin of the scene, then all the light behaves okay, the more I walk away from it, though, the more triangle is to bright white before jumping first, after which they are black Be almost instantaneously. I am not able to understand what is the reason for it.
Here is an overview of the structure of the visual graph:
- In the examples of the container, the Open Glow state does not change
- Shader Node Shader activates the pair is shown below.
- The problem also exists when using a fixed function pipeline.
- The scene has been rotated before rendering the view and the view graph
I am certainly sure that there is a problem with the creation of this problem, but I Not quite sure.
Here are some screenshots of effect, first of all, where the light is close to the camera, and where the camera is located at a distance of distance from the scene:
Note that the light is shown in the form of a goal, marked by a red circle has been done. Second, one where the light is away from the camera:
I am also underlining the general rules for reference. The brightness visible in this photo is always present, no matter where the light is located than the camera.
These are my shaders. I am doing quite a lot because they work, because they work correctly ShaderMaker:
Vertex shader:
vec3 is changing normally; Vec3 status changes; Zero main (zero) {gl_Position = ftransform (); Gl_TexCoord [0] = gl_MultiTexCoord0; Normal = gl_NormalMatrix * gl_Normal; Position = (gl_ModelViewMatrix * gl_Vertex) .xyz; }
piece sha ader:
curve 3 is changing normally; Vec3 status changes; Vec4 light source (vec3 model, see vec3, gl_LightSourceParameters light) {vec3 lightVector = normal (see light.position.xyz - see); Vec3 reflection = normal (lightweight - view.exe); Flat diffactor = Max (0, dot (ideal, lightweight)); Float specular dot = max (0, dot (ideal, reflection)); Float specular factor = POW (specular dot, glove_frenchmateriary, shinness); Return gl_FrontMaterial.ambient * light.ambient + gl_FrontMaterial.diffuse * light.diffuse * diffuseFactor + gl_FrontMaterial.specular * light.specular * specularFactor; } Vec4 light () {// normal linear interpolation may be damaged by Vec3 ideal = normal (normal); Return gl_FrontMaterial.emission + gl_FrontMaterial.ambient * gl_LightModel.ambient + lightSource (ideal, position, gl_LightSource [0]); } Zero main () {gl_FragColor = light (); The solution to the problem was that I was implementing glFrustrum () on the modelView, I
Comments
Post a Comment