Quantcast
Channel: Questions in topic: "issue"
Viewing all articles
Browse latest Browse all 827

Surface Shader issue: property color gets changed

$
0
0
Hey guys, i'm currently writing a surface toon shader, which has among others an outlineColor property. This is by default black. However, if the shader is used on scaled objects, this color changes also. Properties { //... _OutColor ("Outline Color", Color) = (-1,-1,-1,1) //.. } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM #pragma surface surf Toon fixed4 _OutColor; half4 LightingToon (SurfaceOutput s, half3 lightDir, half3 viewDir, half atten) { // other shader code fixed4 c = _OutColor; // only access in the whole shader // c = fixed4(-1,-1,-1,1) -> if i would do this, every outline would be black // other shader code, where c is modified, if we are at no border at the moment return c; } struct Input { float2 uv_MainTex; float4 customColor; }; void surf (Input IN, inout SurfaceOutput o) { o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb * _Color.rgb; } ENDCG } I can hardly post more code, I'm sry. Here is a picture of an object where this shader is used. The spheres are scaled (1, 1, 1), whereas the connections inbetween them are scaled (2, 0.25, 2). You can see that these connections don't have black borders. ![alt text][1] [1]: /storage/temp/48014-example.png EDIT: I just testet what happens if I change the scale of a sphere. Result nothing. However, if I reset the shader during runtime in the Unity Editor then its working like it should.

Viewing all articles
Browse latest Browse all 827

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>