You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
float4 integrate( in float4 sum, in float dif, in float den, in float3 bgcol, in float t )
{
// lighting
float3 lin = vec3(0.9,0.95,1.0) + 0.5vec3(0.7, 0.5, 0.3)dif * smoothstep(-0.3, 0.3, v3sunDir.y);
float4 col = vec4( lerp( 1.15vec3(1.0,0.95,0.8), vec3(0.65), den ), den );
col.xyz = lin;
//col.xyz = lerp( col.xyz, bgcol, 1.0-exp(-0.003tt) );
// front to back blending
col.a *= 0.4;
col.rgb = col.a;
return sum + col(1.0-sum.a);
}
// Turbulence and Day/Night cycle added by Michael Olson - OMGparticles/2015
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// Volumetric clouds. It performs level of detail (LOD) for faster rendering and antialiasing
float fTurbulence = 0.35;
float fSunSpeed = 0.35;
float3 vNightColor = vec3(.15, 0.3, 0.6);
float3 vHorizonColor = vec3(0.6, 0.3, 0.4);
float3 vDayColor = vec3(0.7,0.8,1);
float3 vSunColor = vec3(1.0,0.8,0.6);
float3 vSunRimColor = vec3(1.0,0.66,0.33);
float3 v3sunDir;
void updateSun() {
float fSpeed = fSunSpeed * _Time.y;
v3sunDir = normalize( vec3(cos(fSpeed),sin(fSpeed),0.0) );
}
float noise( in float3 x )
{
float3 p = floor(x);
float3 f = frac(x);
f = fff*(3.0-2.0*f);
float2 uv = (p.xy+vec2(37.0,17.0)p.z) + f.xy;
float4 rg = tex2D( _MainTex, (uv+ 0.5)/256.0, -100.0 );
return (-1.0+2.0lerp( rg.g, rg.r, f.z ));
}
float map5( in float3 p )
{
float3 q = p - vec3(0.0,0.1,1.0)_Time.y;
float f;
f = 0.50000noise( q ); q = q2.02 + _Time.y * fTurbulence * 1.0;
f += 0.25000noise( q ); q = q2.03 + _Time.y * fTurbulence * 2.0;
f += 0.12500noise( q ); q = q2.01 + _Time.y * fTurbulence * 4.0;
f += 0.06250noise( q ); q = q2.02 + _Time.y * fTurbulence * 8.0;
f += 0.03125noise( q );
return clamp( 1.5 - p.y - 2.0 + 1.75*f, 0.0, 1.0 );
}
float map4( in float3 p )
{
float3 q = p - vec3(0.0,0.1,1.0)_Time.y;
float f;
f = 0.50000noise( q ); q = q2.02 + _Time.y * fTurbulence * 1.0;
f += 0.25000noise( q ); q = q2.03 + _Time.y * fTurbulence * 2.0;
f += 0.12500noise( q ); q = q2.01 + _Time.y * fTurbulence * 4.0;
f += 0.06250noise( q );
return clamp( 1.5 - p.y - 2.0 + 1.75f, 0.0, 1.0 );
}
float map3( in float3 p )
{
float3 q = p - vec3(0.0,0.1,1.0)_Time.y;
float f;
f = 0.50000noise( q ); q = q2.02 + _Time.y * fTurbulence * 1.0;
f += 0.25000noise( q ); q = q2.03 + _Time.y * fTurbulence * 2.0;
f += 0.12500noise( q );
return clamp( 1.5 - p.y - 2.0 + 1.75f, 0.0, 1.0 );
}
float map2( in float3 p )
{
float3 q = p - vec3(0.0,0.1,1.0)_Time.y;
float f;
f = 0.50000noise( q ); q = q2.02 + _Time.y * fTurbulence * 1.0;
f += 0.25000noise( q );
return clamp( 1.5 - p.y - 2.0 + 1.75*f, 0.0, 1.0 );
}
float4 integrate( in float4 sum, in float dif, in float den, in float3 bgcol, in float t )
{
// lighting
float3 lin = vec3(0.9,0.95,1.0) + 0.5vec3(0.7, 0.5, 0.3)dif * smoothstep(-0.3, 0.3, v3sunDir.y);
float4 col = vec4( lerp( 1.15vec3(1.0,0.95,0.8), vec3(0.65), den ), den );
col.xyz = lin;
//col.xyz = lerp( col.xyz, bgcol, 1.0-exp(-0.003tt) );
// front to back blending
col.a *= 0.4;
col.rgb = col.a;
return sum + col(1.0-sum.a);
}
#define MARCH(STEPS,MAPLOD) [unroll(100)]
for(int i=0; i<STEPS; i++) { float3 pos = ro + trd; if( pos.y<-3.0 || pos.y>2.0 || sum.a > 0.99 ) break; float den = MAPLOD( pos ); if( den>0.01 ) { float dif = clamp((den - MAPLOD(pos+0.3v3sunDir))/0.6, 0.0, 1.0 ); sum = integrate( sum, dif, den, bgcol, t ); } t += max(0.01float(i),0.02t); }
float4 raymarch( in float3 ro, in float3 rd, in float3 bgcol )
{
float4 sum = vec4(0.0);
}
float3x3 setCamera( in float3 ro, in float3 ta, float cr )
{
float3 cw = normalize(ta-ro);
float3 cp = vec3(sin(cr), cos(cr),0.0);
float3 cu = normalize( cross(cw,cp) );
float3 cv = normalize( cross(cu,cw) );
return float3x3( cu, cv, cw );
}
float4 render( in float3 ro, in float3 rd )
{
float sun = clamp( dot(v3sunDir,rd), 0.0, 1.0 );
}
}
void mainVR( out float4 fragColor, in float2 vertex_output.uv, in float3 fragRayOri, in float3 fragRayDir )
{
return render( fragRayOri, fragRayDir );
}
}
The text was updated successfully, but these errors were encountered: