summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--halos.cginc12
-rw-r--r--tooner.shader6
-rw-r--r--tooner_lighting.cginc2
3 files changed, 11 insertions, 9 deletions
diff --git a/halos.cginc b/halos.cginc
index aa0b731..d2601ab 100644
--- a/halos.cginc
+++ b/halos.cginc
@@ -77,7 +77,7 @@ float3 halo00_calc_normal(float3 p, Halo00Params params)
void __halo00_march(float3 ro, float3 rd, Halo00Params params, out Halo00PBR result)
{
float total_distance_traveled = 0.0;
- const float MINIMUM_HIT_DISTANCE = 0.001;
+ const float MINIMUM_HIT_DISTANCE = 0.0001;
const float MAXIMUM_TRACE_DISTANCE = 10.0;
ro -= (1 - (params.count % 2)) * params.period * 0.5;
@@ -123,9 +123,13 @@ Halo00PBR halo00_march(float3 worldPos, float2 uv)
params.count = 5;
params.uv = uv;
- float3 camera_position = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos.xyz, 1));
- float3 ro = camera_position;
- float3 rd = normalize(mul(unity_WorldToObject, float4(worldPos - _WorldSpaceCameraPos.xyz, 1)));
+#define COORD_SCALE 2
+#define SCALEF4(f4, scale) float4((f4).x * (scale), (f4).y * (scale), (f4).z * (scale), (f4).w)
+#define F42OBJ(f4) mul(unity_WorldToObject, (SCALEF4(f4, COORD_SCALE))).xyz
+ float3 cam_pos = F42OBJ(float4(_WorldSpaceCameraPos, 1)).xyz;
+ float3 mesh_pos = F42OBJ(float4(worldPos, 1)).xyz;
+ float3 ro = cam_pos;
+ float3 rd = normalize((mesh_pos - cam_pos).xyz);
__halo00_march(ro, rd, params, result);
diff --git a/tooner.shader b/tooner.shader
index 6ab0076..e98092f 100644
--- a/tooner.shader
+++ b/tooner.shader
@@ -3,12 +3,12 @@ Shader "yum_food/tooner"
// Unity fucking sucks ass and sometimes incorrectly uses an old cached
// version of the shader. Bump the nonce below to encourage it to use the
// current version.
- // Build nonce: 24
+ // Build nonce: 28
Properties
{
_Color("Base color", Color) = (0.8, 0.8, 0.8, 1)
_Metallic("Metallic", Range(0, 1)) = 0
- _Roughness("Roughness", Range(0, 1)) = 1
+ _Roughness("Roughness", Range(0, 4)) = 1
_Roughness_Invert("Roughness invert", Float) = 0
_Clearcoat_Enabled("Clearcoat enabled", Float) = 0
@@ -592,7 +592,6 @@ Shader "yum_food/tooner"
#include "tooner_lighting.cginc"
ENDCG
}
- /*
Pass {
Tags {
"RenderType"="Opaque"
@@ -672,7 +671,6 @@ Shader "yum_food/tooner"
#include "mochie_shadow_caster.cginc"
ENDCG
}
- */
}
CustomEditor "ToonerGUI"
}
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc
index fad3e5e..80e8400 100644
--- a/tooner_lighting.cginc
+++ b/tooner_lighting.cginc
@@ -30,7 +30,7 @@
void getVertexLightColor(inout v2f i)
{
#if defined(VERTEXLIGHT_ON)
- float3 view_dir = normalize(_WorldSPaceCameraPos.xyz - i.worldPos);
+ float3 view_dir = normalize(_WorldSpaceCameraPos.xyz - i.worldPos);
uint normals_mode = round(_Mesh_Normals_Mode);
bool flat = (normals_mode == 0);
float3 flat_normal = normalize(