Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment map support in PBR renderer #7

Merged
merged 3 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/shaders/pbr_material.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ layout(set = 1, binding = 0) uniform ubo10 { PbrDrawCall draw_call; };
layout(set = 1, binding = 1) uniform sampler2D albedo_tex;
layout(set = 1, binding = 2) uniform sampler2D normal_tex;
layout(set = 1, binding = 3) uniform sampler2D pbr_tex;
layout(set = 1, binding = 4) uniform sampler2D env_map;

bool flagSet(uint flag) { return (draw_call.draw_call_opts & flag) != 0; }

Expand Down
6 changes: 6 additions & 0 deletions data/shaders/shared/structures.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ struct SimpleDrawCall {

struct PbrDrawCall {
mat4 proj_view_matrix;
mat4 inv_proj_view_matrix;
vec4 material_color;
uint draw_call_opts;
vec4 world_camera_pos;
};

struct EnvMapDrawCall {
vec2 screen_size, inv_screen_size;
mat4 inv_proj_view_matrix;
};

struct Rect {
vec2 pos, size;
vec2 min_uv, max_uv;
Expand Down
Loading