Community shaders
GLSL shader by kshminivlog969@gmail.com · created 2026-09-19 · 10s loop · 2 passes
This is the best realistic shader ✅Medium device ✅High and device
Tags: Community shaders
This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.
Shader source (GLSL)
Common
#define pi acos(-1.)
#define deg pi/180. //1 degree
#define time iTime*2.*pi/10. //sin(time) loops 10 seconds
#define R iResolution.xy //shorthand
#define ar R.x/R.y //aspect ratio
#define M iMouse //shorthand
#define xm (M.xy/R) //normalized mouse
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5) //aspect ratio correction
vec3 cs = vec3(1.,2.,3.);
mat2 r2d(float a) {
return mat2(cos(a),sin(a),-sin(a),cos(a));
}
Buffer A (iChannel0)
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy / iResolution.xy;
vec2 tv = uv;
uv -= 0.5;
uv.x *= ar;
vec3 col = vec3(0.);
col += vec3(uv.x,uv.y,sin(iTime));
fragColor = vec4(col, 1.0);
}// ShaderKit Compatible Ultra Realistic PBR Shader
// GGX Distribution Function
float DistributionGGX(vec3 N, vec3 H, float roughness) {
float a = roughness * roughness;
float a2 = a * a;
float NdotH = max(dot(N, H), 0.0);
float NdotH2 = NdotH * NdotH;
float num = a2;
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
denom = 3.14159265 * denom * denom;
return num / max(denom, 0.0001);
}
// Fresnel Schlick Approximation
vec3 fresnelSchlick(float cosTheta, vec3 F0) {
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
// Screen UV Normalization (-1 to 1)
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
// 3D Sphere Normal Calculation (Preview ke liye)
float r = length(uv);
if (r > 0.4) {
// Background Color
fragColor = vec4(0.05, 0.05, 0.08, 1.0);
return;
}
// Sphere Surface Normal
float z = sqrt(0.4 * 0.4 - r * r);
vec3 N = normalize(vec3(uv, z));
// Camera aur Light Positions
vec3 V = vec3(0.0, 0.0, 1.0); // View direction
// Mouse movement se light position control hogi
vec2 mouse = (iMouse.xy - 0.5 * iResolution.xy) / iResolution.y;
vec3 L = normalize(vec3(mouse.x * 2.0, mouse.y * 2.0, 1.0));
if (iMouse.z <= 0.0) {
// Automatic moving light agar mouse touch na ho
L = normalize(vec3(sin(iTime), cos(iTime), 1.0));
}
vec3 H = normalize(V + L);
// Material Properties (Ultra Realistic Metallic/Roughness)
vec3 uAlbedo = vec3(0.95, 0.71, 0.29); // Metallic Gold Color
float uRoughness = 0.25; // Smoothness (0 = Shiny, 1 = Rough)
float uMetallic = 0.9; // Metallic Value
// Base Reflectivity (F0)
vec3 F0 = vec3(0.04);
F0 = mix(F0, uAlbedo, uMetallic);
// Cook-Torrance Specular BRDF
float NDF = DistributionGGX(N, H, uRoughness);
vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);
vec3 kS = F;
vec3 kD = vec3(1.0) - kS;
kD *= 1.0 - uMetallic;
float NdotL = max(dot(N, L), 0.0);
vec3 diffuse = kD * uAlbedo / 3.14159265;
vec3 specular = (NDF * F) / 4.0;
vec3 color = (diffuse + specular) * NdotL * vec3(2.5); // Light Intensity
// Ambient Lighting
color += uAlbedo * 0.05;
// ACES Filmic Tone Mapping (Realism)
color = color / (color + vec3(1.0));
fragColor = vec4(color, 1.0);
}
Image
Not used
Browse all public shaders · All shaders by kshminivlog969@gmail.com · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.