Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader_type spatial;
- render_mode unshaded, depth_draw_always;
- uniform sampler2D background: source_color, filter_linear;
- vec4 getEnvironment(vec3 rayDirection) {
- const float PIm2 = 2.0 * PI;
- rayDirection = normalize(rayDirection);
- return texture(background, vec2((atan(rayDirection.z, rayDirection.x) / PIm2) - 0.25, acos(-rayDirection.y) / PI));
- }
- void fragment() {
- vec4 world_view = INV_VIEW_MATRIX * vec4(VIEW, 0);
- vec4 bg_color = getEnvironment(world_view.xyz);
- ALBEDO = bg_color.rgb;
- ALPHA = bg_color.a;
- }
Advertisement
Add Comment
Please, Sign In to add comment