Skip to content

Commit

Permalink
feat: add URP Lit shader example (#35)
Browse files Browse the repository at this point in the history
* feat: add urp lit shader sample

* docs: update urp sample

* fix: move shaders to URP assembly

* fix: update include path

---------

Co-authored-by: Till Davin <>
  • Loading branch information
happy-turtle authored Jun 2, 2024
1 parent 0ef936b commit 7f77cd9
Show file tree
Hide file tree
Showing 12 changed files with 903 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If in doubt try to import the sample you want to use and start from there.
- **Universal Render Pipeline:** Add the renderer feature `Order Independent Transparency Renderer` to your Universal Renderer Asset.
- **Post-Processing Stack v2:** Add the post-processing override `Order Independent Transparency` to a post-processing volume in your scene.

2. Change the material of every object that shall be rendered with order-independent transparency. They have to be rendered with a shader writing to the buffer used by the order-independent transparency implementation. Two sample shaders that you can use are included in this project: `OrderIndependentTransparency/Unlit` for all pipelines and additionally `OrderIndependentTransparency/Standard` for the built-in pipeline.
2. Change the material of every object that shall be rendered with order-independent transparency. They have to be rendered with a shader writing to the buffer used by the order-independent transparency implementation. Two sample shaders that you can use are included in this project: `OrderIndependentTransparency/Unlit` for all pipelines, `OrderIndependentTransparency/Standard` for the built-in pipeline and `OrderIndependentTransparency/URP/Lit` for the Universal Render Pipeline.

3. Run your scene.

Expand Down
42 changes: 38 additions & 4 deletions Samples~/URP Demo/Materials/BlueTransparent.mat
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BlueTransparent
m_Shader: {fileID: 4800000, guid: fb32df2ea84beb3469051c4a2fde36e4, type: 3}
m_Shader: {fileID: 4800000, guid: c20571aee5e15994a94948a184fd2028, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _ALPHAPREMULTIPLY_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BackgroundTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
Expand Down Expand Up @@ -61,33 +67,61 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Alpha: 0.5
- _AlphaClip: 0
- _Amount: 1
- _Amplitude: 1
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cutoff: 0.5
- _CutoutThresh: 0.2
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _Distance: 1
- _DstBlend: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _Speed: 1
- _SrcBlend: 1
- _Transparency: 0.5
- _UVSec: 0
- _WorkflowMode: 1
- _ZWrite: 0
m_Colors:
- _Color: {r: 0, g: 0.14112902, b: 1, a: 0.59607846}
- _BaseColor: {r: 0, g: 0.14117648, b: 1, a: 0.59607846}
- _Color: {r: 0, g: 0.14117643, b: 1, a: 0.59607846}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _TintColor: {r: 0.100138426, g: 1, b: 0, a: 1}
m_BuildTextureStacks: []
42 changes: 38 additions & 4 deletions Samples~/URP Demo/Materials/GreenTransparent.mat
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GreenTransparent
m_Shader: {fileID: 4800000, guid: fb32df2ea84beb3469051c4a2fde36e4, type: 3}
m_Shader: {fileID: 4800000, guid: c20571aee5e15994a94948a184fd2028, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _ALPHAPREMULTIPLY_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BackgroundTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
Expand Down Expand Up @@ -61,33 +67,61 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Alpha: 0.5
- _AlphaClip: 0
- _Amount: 1
- _Amplitude: 1
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cutoff: 0.5
- _CutoutThresh: 0.2
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _Distance: 1
- _DstBlend: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _Speed: 1
- _SrcBlend: 1
- _Transparency: 0.5
- _UVSec: 0
- _WorkflowMode: 1
- _ZWrite: 0
m_Colors:
- _Color: {r: 0, g: 0.9705882, b: 0.13725491, a: 0.4745098}
- _BaseColor: {r: 0, g: 0.96862745, b: 0.13725491, a: 0.4745098}
- _Color: {r: 0, g: 0.9686274, b: 0.13725486, a: 0.4745098}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _TintColor: {r: 0.100138426, g: 1, b: 0, a: 1}
m_BuildTextureStacks: []
42 changes: 38 additions & 4 deletions Samples~/URP Demo/Materials/RedTransparent.mat
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: RedTransparent
m_Shader: {fileID: 4800000, guid: fb32df2ea84beb3469051c4a2fde36e4, type: 3}
m_Shader: {fileID: 4800000, guid: c20571aee5e15994a94948a184fd2028, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _ALPHAPREMULTIPLY_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BackgroundTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
Expand Down Expand Up @@ -61,28 +67,56 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Alpha: 0.5
- _AlphaClip: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0.57
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Transparency: 0.5
- _UVSec: 0
- _WorkflowMode: 1
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 0, b: 0.14227676, a: 0.3882353}
- _BaseColor: {r: 1, g: 0, b: 0.14117648, a: 0.3882353}
- _Color: {r: 1, g: 0, b: 0.14117643, a: 0.3882353}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _TintColor: {r: 0.990566, g: 0.07008721, b: 0.07008721, a: 1}
m_BuildTextureStacks: []
Loading

0 comments on commit 7f77cd9

Please sign in to comment.