-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Shaders don't compile #11
Comments
|
When I press the convert button I get this
Shader "ShaderMan/bubbles"
{
Properties{
//Properties
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
Pass
{
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct VertexInput {
fixed4 vertex : POSITION;
fixed2 uv:TEXCOORD0;
fixed4 tangent : TANGENT;
fixed3 normal : NORMAL;
//VertexInput
};
struct VertexOutput {
fixed4 pos : SV_POSITION;
fixed2 uv:TEXCOORD0;
//VertexOutput
};
//Variables
// Created by inigo quilez - iq/2013
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0
Unported License.
VertexOutput vert (VertexInput v)
{
VertexOutput o;
o.pos = UnityObjectToClipPos (v.vertex);
o.uv = v.uv;
//VertexFactory
return o;
}
fixed4 frag(VertexOutput i) : SV_Target
{
fixed2 uv = -1.0 + 2.0*i.uv / 1;
uv.x *= 1 / 1;
// background
fixed3 color = fixed3(0.8 + 0.2*uv.y,0.8 + 0.2*uv.y,0.8 + 0.2*uv.y);
// bubbles
[unroll(100)]
for( int i=0; i<40; i++ )
{
// bubble seeds
fixed pha = sin(fixed(i)*546.13+1.0)*0.5 + 0.5;
fixed siz = pow( sin(fixed(i)*651.74+5.0)*0.5 + 0.5, 4.0 );
fixed pox = sin(fixed(i)*321.55+4.1) * 1 / 1;
// buble size, position and color
fixed rad = 0.1 + 0.5*siz;
fixed2 pos = fixed2( pox, -1.0-rad +
(2.0+2.0*rad)*fmod(pha+0.1*_Time.y*(0.2+0.8*siz),1.0));
fixed dis = length( uv - pos );
fixed3 col = lerp( fixed3(0.94,0.3,0.0), fixed3(0.1,0.4,0.8),
0.5+0.5*sin(fixed(i)*1.2+1.9));
// col+= 8.0*smoothstep( rad*0.95, rad, dis );
// render
fixed f = length(uv-pos)/rad;
f = sqrt(clamp(1.0-f*f,0.0,1.0));
color -= col.zyx *(1.0-smoothstep( rad*0.95, rad, dis )) * f;
}
ENDCG
}
}
}
…On Fri, Sep 21, 2018 at 6:42 AM Seyed Morteza Kamali < ***@***.***> wrote:
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert #pragma fragment frag
struct v2f{
float4 position : SV_POSITION;
};
v2f vert(float4 v:POSITION) : SV_POSITION {
v2f o;
o.position = UnityObjectToClipPos (v);
return o;
}
fixed4 frag(v2f i) : SV_Target {
float2 uv = -1.0 + 2.0*i.position.xy/ _ScreenParams.xy;
uv.x *= _ScreenParams.x/ _ScreenParams.y ;
// Background
fixed4 outColour = fixed4(0.8+0.2*uv.y,0.8+0.2*uv.y,0.8+0.2*uv.y,1);
// Bubbles
for (int i = 0; i < 40; i++) {
// Bubble seeds
float pha = sin(float(i)*546.13+1.0)*0.5 + 0.5;
float siz = pow( sin(float(i)*651.74+5.0)*0.5 + 0.5, 4.0 );
float pox = sin(float(i)*321.55+4.1);
// Bubble size, position and color
float rad = 0.1 + 0.5*siz;
float2 pos = float2( pox, -1.0-rad + (2.0+2.0*rad)*fmod(pha+0.1*_Time.y*(0.2+0.8*siz),1.0));
float dis = length( uv - pos );
float3 col = lerp( float3(0.94,0.3,0.0), float3(0.1,0.4,0.8), 0.5+0.5*sin(float(i)*1.2+1.9));
// Add a black outline around each bubble
col+= 8.0*smoothstep( rad*0.95, rad, dis );
// Render
float f = length(uv-pos)/rad;
f = sqrt(clamp(1.0-f*f,0.0,1.0));
outColour.rgb -= col.zyx *(1.0-smoothstep( rad*0.95, rad, dis )) * f;
}
// Vignetting
outColour *= sqrt(1.5-0.5*length(uv));
return outColour;
}
ENDCG
}
}
}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF0vDd3-XBRqox0GcVIaaSeDkAK5xhlnks5udMKVgaJpZM4WzNDW>
.
|
I fixed the problem
|
Awesome! When are you going to commit it! I can't wait to try it! |
Just asking, but when do you think you will commit your fix for the convert button? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have tried converting the sample shader https://www.shadertoy.com/view/4dl3zn in Unity 5 and Unity 2018 but I get the compile error "Shader error in 'ShaderMan/bubbles': syntax error: unexpected end of file at line 86 (on d3d11)"
There's already a bubbles shader in the examples folder, but it's content looks a lot different then what is being converted now?
The text was updated successfully, but these errors were encountered: