Results 1 to 2 of 2

Thread: Canīt view shadows in amd hardware

  1. #1
    Newbie Newbie
    Join Date
    Jun 2016
    Posts
    1

    Canīt view shadows in amd hardware

    Hi! iīm a student and iīm working with opengl and glsl.
    I have problems with shadow mapping. In pcīs with AMD hardware canīt see them.
    here is the fragment shader of my program.. it works with INTEL and NVidia..
    any ideas????

    Fragment Shader:

    Code glsl:
    in vec3 vLE;
    in vec3 vV;
    in vec3 vN;
     
    in vec2 fragTexCoor;
     
    uniform vec4 ka;
    uniform vec4 kd;
    uniform vec4 ks;
     
    uniform float CoefEsp;
     
    uniform sampler2D uTextureSampler;
     
    uniform struct Light {
        vec4 position;
        vec3 intensity;
    } luz;
     
    // --- SHADOW MAPPING ---
    // Sampler del shadow map.
    uniform sampler2D uShadowSampler;
     
    in vec4 fragPosLightSpace; //shadow coord
     
    out vec4 fColor;
     
     
    float ShadowCalculation(vec4 fragPosLightSpace)
    {
        vec3 lightDir = normalize(luz.position.xyz - fragPosLightSpace.xyz);
     
        float bias    = max(0.05 * (1.0 - dot(vN, lightDir)), 0.005);
     
        float shadowDepth = texture(uShadowSampler, vec2(fragPosLightSpace)).r;
     
        float fragDepth   = fragPosLightSpace.z;
     
     
     
            if (fragDepth > 1.0)
            return 1.0;
     
        if ((fragDepth - bias)<=shadowDepth)
            return 1.0f;
        else
            return 0.0f;
     
    }
     
     
    void main()
    {
     
        vec4 colorTex = texture2D(uTextureSampler, fragTexCoor);
     
        float dist = length(vLE);
        float fatt = 1 / (0.3 + 0.007 * dist + 0.000008 * dist * dist);
     
        vec3 L = normalize(vLE);
        vec3 V = normalize(vV);
        vec3 N = normalize(vN);
        vec3 R = normalize(-reflect(L,N));
     
        float dif        = max(dot(L,N), 0.0);
        float specPhong = pow(max(dot(R, V), 0.0), CoefEsp);
     
        if (dot(L,N) < 0.0) {
            specPhong = 0.0;
        }
     
        vec4 ambiente  = ka;
        vec4 difuso    = kd * dif * colorTex;
        vec4 especular = ks * specPhong;
     
        float visibility = ShadowCalculation(fragPosLightSpace);
     
        fColor = vec4(luz.intensity, 1.0) * fatt * (ambiente + visibility * (especular + difuso));
     
    }

  2. #2
    Member Contributor
    Join Date
    Nov 2016
    Posts
    67
    I know that Nvidia drivers are permissive and allow things to be rendered on screen even if there was an OpenGL error, but it could be the case with Intel too. Check with APItrace or glIntercept to know if your code does generate errors.

Similar Threads

  1. Canīt view shadows in amd hardware
    By aguuzr in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 06-19-2016, 05:12 PM
  2. Problem with point light shadows (cubemap shadows)
    By Ryno Engine in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-20-2015, 04:36 AM
  3. Replies: 2
    Last Post: 08-17-2003, 01:57 AM
  4. Shadows with current hardware are IMPOSSIBLE!!!
    By santyhamer in forum OpenGL: General
    Replies: 18
    Last Post: 10-08-2001, 02:41 PM
  5. Hardware View Frustrum culling---is it possible?
    By TheGecko in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-20-2001, 02:42 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