Search Unity

Question Can somebody help me with transfering this from code to shader graph

Discussion in 'Shader Graph' started by bugaj, Jan 16, 2020.

  1. bugaj

    bugaj

    Joined:
    Jun 28, 2015
    Posts:
    58
    float3 binormal = cross(v.normal, v.tangent.xyz) * v.tangent.w;
    float3x3 rotation = float3x3(v.tangent.xyz, binormal, v.normal);
    o.tangentToWorld = mul((float3x3)unity_ObjectToWorld, transpose(rotation));
    float3 worldViewDir = normalize (UnityWorldSpaceViewDir(worldPos));
    o.viewDir = worldViewDir;

    float3 shade = ShadeSH9(float4(o.normal,1));
    shade = max(shade, (unity_AmbientSky + unity_AmbientGround + unity_AmbientEquator) * 0.15); //Don't go to 0 even if there's no significant lighting data
    o.vertLight.xyz = lerp(1, shade, _LightStr);
    //vertlight.w is currently unused
     
  2. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    I wish i could haha, im pretty sure im halfway through adapting the same shader. Is this an excerpt from FXVille's Blood Shader?

    Feel free to add me on discord and perhaps we can figure it out (Subliminum#3844) or even better if you've already worked it out, help me fix my ShaderGraph? haha :)