Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/shaders/material/gpu_shader_material_tex_wave.glsl
| float calc_wave( | float calc_wave( | ||||
| vec3 p, float distortion, float detail, float detail_scale, int wave_type, int wave_profile) | vec3 p, float distortion, float detail, float detail_scale, int wave_type, int wave_profile) | ||||
| { | { | ||||
| float n; | float n; | ||||
| if (wave_type == 0) { /* type bands */ | if (wave_type == 0) { /* type bands */ | ||||
| n = (p.x + p.y + p.z) * 10.0; | n = (p.x + p.y + p.z) * 10.0; | ||||
| } | } | ||||
| else { /* type rings */ | else { /* type rings */ | ||||
| n = length(p) * 20.0; | n = length(p) * 20.0; | ||||
| } | } | ||||
| if (distortion != 0.0) { | if (distortion != 0.0) { | ||||
| n += distortion * noise_turbulence(p * detail_scale, detail, 0); | n += distortion * fractal_noise(p * detail_scale, detail); | ||||
| } | } | ||||
| if (wave_profile == 0) { /* profile sin */ | if (wave_profile == 0) { /* profile sin */ | ||||
| return 0.5 + 0.5 * sin(n); | return 0.5 + 0.5 * sin(n); | ||||
| } | } | ||||
| else { /* profile saw */ | else { /* profile saw */ | ||||
| n /= 2.0 * M_PI; | n /= 2.0 * M_PI; | ||||
| n -= int(n); | n -= int(n); | ||||
| Show All 20 Lines | |||||