Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

[ad_1]

I’ve a top down digicam on my sport, and I am rendering a degree gentle on my opengl fragment shader.

When the purpose gentle is much away from the ground it appears to be like like I’d count on it ought to look, like an ideal sphere of sunshine.

enter image description here

However when the sunshine is near the ground is getting sliced not equally from the underside however diagonally.

enter image description here

Is there one thing mistaken with my implementation of the pointlight?

vertex

structure(location = 0) in vec2 v_position;
structure(location = 1) in vec3 v_light_position;

structure(location = 0) out vec2 place;
structure(location = 1) out vec2 light_position;

structure(binding = 0) uniform ubo {
    mat4 camera_view;
    vec3 light_color;
    float light_fade;
    float light_scatter;
}

void most important() {
    place = v_position;
    light_position = v_light_position;

    gl_Position = camera_view * vec4(place, 0., 1.);
}

fragment

structure(location = 0) out vec4 shade;

const vec3 BRIGHTNESS = vec3(.2126, .7152, .0722);

float brightness(vec3 worth) {
    return dot(worth, BRIGHTNESS);
}

void most important() {
    vec3 light_direction = normalize(
        vec3(light_position.x - place.x, place.y - light_position.y, light_position.z)
    );

    float light_distance = distance(place, light_position.xy);

    float attenuation = 1 / (1. + light_fade * light_distance + light_scatter * (light_distance * light_distance));
    
    shade.rgb = light_color.rgb * attenuation;
    shade.a = brightness(gentle);
}

Getting the sunshine clipped with the ground has sense, however the aircraft is completely flat with no slope, so it is awkward that is occurring.

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *