GLSL-Rendering von Schatten mit Shadowmapping (+moderngl)Python

Python-Programme
Anonymous
 GLSL-Rendering von Schatten mit Shadowmapping (+moderngl)

Post by Anonymous »

Also möchte ich meinem Rendering-Programm Schatten hinzufügen.
Ich verwende Python (mit ModernGL) und GLSL, aber die Schatten werden nicht gerendert...
Ohne die Verwendung von Arrays funktioniert es gut, aber ich muss sie verwenden (später werde ich versuchen, weitere Lichter hinzuzufügen).
Das Programm kehrt also nicht zurück Irgendein Fehler, aber es gibt keinen Schatten
Hier ist mein Vert-Shader (shadowCoord sind die Koordinaten der Schattenpunkte, die ich im Frag-Shader verwende, und m_view_l sind alle Lichtmatrizen, die ich jetzt nur verwende Verwenden Sie eins: also number_mat = 1)

Code: Select all

#version 410
#define MAX_SIZE 6

//in
layout (location = 0) in vec2 in_texcoord;
layout (location = 1) in vec3 in_position;
layout (location = 2) in vec3 in_normales;

//out
out vec2 uv_0;
out vec3 v_pos;
out vec3 v_normals;
out float rd_light_diffraction;
out vec2 pixel_pos;
out vec4 shadowCoord[MAX_SIZE];

//matrices
uniform mat4 m_proj;
uniform mat4 m_view;

uniform mat4 m_view_l[MAX_SIZE];
uniform int number_mat;
uniform mat4 m_proj_l;
uniform mat4 m_model;

uniform mat4 m_bias = mat4(
0.5,0.0,0.0,0.0,
0.0,0.5,0.0,0.0,
0.0,0.0,0.5,0.0,
0.5,0.5,0.5,1.0
);

float random(vec2 st){
return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);
}

void main(){

uv_0 = vec2(1.0-in_texcoord);
gl_Position = m_proj*m_view*m_model*vec4(in_position, 1.0);//vector4 for vertex pos
pixel_pos = vec2(gl_Position);

//depth textures
for (int i = 0; i[code]#version 410
#define MAX_SIZE 6

layout (location = 0) in vec2 uv_0;
layout (location = 1) in vec3 v_pos;
layout (location = 2) in vec3 v_normals;
layout (location = 3) in float rd_light_diffraction;
layout (location = 4) in vec2 pixel_pos;
in vec4 shadowCoord[MAX_SIZE];

out vec4 fragColor;

uniform vec3 cam_pos;

uniform sampler2D u_texture_0;
uniform sampler2DShadow shadowMap[MAX_SIZE];
uniform int number_mat;

//matrices
uniform mat4 m_proj;
uniform mat4 m_view;
uniform mat4 m_model;

uniform vec3 light_pos[20]; //max number of lights is 10
uniform vec3 light_color[20];
uniform float light_intensity[20];

//light params
float AMBIANT_LIGHT = 0.06;
float STRENGTH_DIFFUSE = 13.0; //the diffuse has more impact

float getShadow(){
float shadow = 0;
for (int i = 0; i

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post