Skip to content

Commit

Permalink
docs: replaced mock image with dummy shader
Browse files Browse the repository at this point in the history
  • Loading branch information
MSchmoecker committed Dec 2, 2022
1 parent eb15239 commit 9773d7b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
Binary file not shown.
55 changes: 53 additions & 2 deletions JotunnLib/Documentation/tutorials/asset-mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,57 @@ The only special case is shader mocking for custom materials.
The asset name isn't their object name, which means that renaming it will not result in a valid mock.

Instead, create a new stump shader or use the dummy shader from AssetRipper and change the first line to contain the `JVLmock_` prefix.
If you don't have dummy shaders but yaml shaders, set AssetRipper to export dummy shaders instead and make a second rip to copy them over.
Now you can use this shader as normally on your materials and Jötunn will resolve the right Shader for you.

![mocks assigned](../images/data/shader_mock_edit.png)
Properties that are set on the material will be used by the resolved shader.

This is a mock for the piece shader as an example:

```shaderlab
Shader "JVLmock_Custom/Piece" {
Properties {
_Color ("Color", Vector) = (1,1,1,1)
_Cutoff ("Alpha Cutoff", Range(0, 1)) = 0
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_MetallicTex ("Metallic", 2D) = "white" {}
_Metallic ("Metallic", Range(0, 1)) = 0
_MetallicAlphaGloss ("Metal smoothness", Range(0, 1)) = 0
[HDR] _MetalColor ("Metal color", Vector) = (1,1,1,1)
_BumpMap ("Normal Map", 2D) = "bump" {}
_BumpScale ("Normal intensity", Float) = 1
_Glossiness ("Smoothness", Range(0, 1)) = 0.5
_EmissionColor ("Emissive", Vector) = (0,0,0,0)
_RippleDistance ("Noise distance", Float) = 0
_RippleFreq ("Noise freq", Float) = 1
_ValueNoise ("ValueNoise", Float) = 0.5
[MaterialToggle] _ValueNoiseVertex ("Value noise per vertex", Float) = 0
[MaterialToggle] _TwoSidedNormals ("Twosided normals", Float) = 0
[Enum(Off,0,Back,2)] _Cull ("Cull", Float) = 2
[MaterialToggle] _AddRain ("Add Rain", Float) = 1
_NoiseTex ("Noise", 2D) = "white" {}
}
//DummyShaderTextExporter
SubShader{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard
#pragma target 3.0
sampler2D _MainTex;
fixed4 _Color;
struct Input
{
float2 uv_MainTex;
};
void surf(Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
}
```

0 comments on commit 9773d7b

Please sign in to comment.