Guest User

Untitled

a guest
Jun 25th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. --------------------------------------------------------------------
  2. This works...
  3.  
  4. float2 UV;
  5. //simplifying grid projection
  6. if(IN.worldNormal.y>0.5) UV = IN.worldPos.xz; // top
  7. else if(abs(IN.worldNormal.x)>0.5) UV = IN.worldPos.yz; // side
  8. else UV = IN.worldPos.xy; // front
  9.  
  10. float4 gc0 = tex2D (_GridTex, UV/100);
  11.  
  12.  
  13. --------------------------------------------------------------------
  14. This doesn't. It works on windows, it works on my mac (with an ATI card and not updated to Lion)
  15. Most areas just become black. (probably areas pointing in certain angles, like straight up etc, hard to say).
  16.  
  17. fixed4 gc0 = tex2D (_GridTex, IN.worldPos.xy/100);
  18. fixed4 gc1 = tex2D (_GridTex, IN.worldPos.zx/100);
  19. fixed4 gc2 = tex2D (_GridTex, IN.worldPos.zy/100);
  20.  
  21. IN.worldNormal = normalize(IN.worldNormal);
  22. float3 projnormal = saturate(pow(IN.worldNormal*1.5, 4));
  23.  
  24. gc0 = lerp(gc1, gc0, projnormal.z);
  25. gc0 = lerp(gc0, gc2, projnormal.x);
  26.  
  27.  
  28. --------------------------------------------------------------------
  29. However, bypassing the projection normal DOES work... (so it's not the texture lookups that's messing up). This is obviously not doing what it's supposed to, just here to point out where the issue is.
  30.  
  31. fixed4 gc0 = tex2D (_GridTex, IN.worldPos.xy/100);
  32. fixed4 gc1 = tex2D (_GridTex, IN.worldPos.zx/100);
  33. fixed4 gc2 = tex2D (_GridTex, IN.worldPos.zy/100);
  34.  
  35. gc0 = lerp(gc1, gc0, 0.5);
  36. gc0 = lerp(gc0, gc2, 0.5);
Add Comment
Please, Sign In to add comment