This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME! | |
// However, if you want to author shaders in shading language you can use this teamplate as a base. | |
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader. | |
// This shader works with URP 7.1.x and above | |
Shader "Universal Render Pipeline/Custom/Physically Based Example" | |
{ | |
Properties | |
{ | |
// Specular vs Metallic workflow | |
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.Rendering; | |
using UnityEngine.Rendering.Universal; | |
[ExecuteInEditMode] | |
public class CustomPass : MonoBehaviour | |
{ | |
public Mesh mesh; | |
public Material material; | |
DrawMeshPass m_DrawMeshPass; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Universal Render Pipeline/Custom/UnlitTextureShadows" | |
{ | |
Properties | |
{ | |
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1) | |
[MainTexture] _BaseMap("BaseMap", 2D) = "white" {} | |
} | |
SubShader | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/UnlitTexture" | |
{ | |
Properties | |
{ | |
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1) | |
[MainTexture] _BaseMap("BaseMap", 2D) = "white" {} | |
} | |
// Universal Render Pipeline subshader. If URP is installed this will be used. | |
SubShader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create a new XCode Metal (library) project. | |
2. Edit Scheme. Product->Scheme->Edit Scheme | |
3. Run, Info tab, and point to your application | |
E.g. /Application/Unity/Hub/Editor/Unity.app | |
4. Run, Arguments tab to add cmdline arguments | |
E.g. -projectPath "/Users/name.name/projects/MyProject" | |
5. Run, Options tab, set to GPU Frame Capture to Metal | |
6. Run the project and click the camera icon from XCode to take a capture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace UnityEngine.Rendering.LWRP | |
{ | |
// A renderer feature contains data and logic to enqueue one or more render passes in the LWRP renderer. | |
// In order to add a render feature to a LWRP renderer, click on the renderer asset and then on the + icon in | |
// the renderer features list. LWRP uses reflection to list all renderer features in the project as available to be | |
// added as renderer features. | |
public class FullScreenQuad : ScriptableRendererFeature | |
{ | |
[System.Serializable] | |
public struct FullScreenQuadSettings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Enable Profiler in OnPreprocessBuild like following: | |
public void OnPreprocessBuild(BuildReport report) | |
{ | |
Profiler.enabled = true; | |
Profiler.enableBinaryLog = true; | |
Profiler.logFile = "profilerlog.raw"; | |
Debug.Log("Enabling Profiler"); | |
} | |
2) Disable Profiler in OnPostProcessBuild | |
3) Now put Profiler.Begin/EndSample in the desired code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Text; | |
#if UNITY_EDITOR | |
using UnityEditor.Experimental.Rendering.LightweightPipeline; | |
#endif | |
using UnityEngine.Experimental.GlobalIllumination; | |
using UnityEngine.Rendering; | |
using UnityEngine.Rendering.PostProcessing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.Rendering; | |
using UnityEngine.Rendering.LWRP; | |
public class CustomRenderPassFeature : ScriptableRendererFeature | |
{ | |
class CustomRenderPass : ScriptableRenderPass | |
{ | |
// This method is called before executing the render pass. | |
// It can be used to configure render targets and their clear state. Also to create temporary render target textures. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Copyright(c) 2015 Phil Lira - phil.rlira [at] gmail [dot] com | |
//Permission is hereby granted, free of charge, to any person obtaining a copy | |
//of this software and associated documentation files (the "Software"), to deal | |
//in the Software without restriction, including without limitation the rights | |
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
//copies of the Software, and to permit persons to whom the Software is | |
//furnished to do so, subject to the following conditions: | |
//The above copyright notice and this permission notice shall be included in all |
NewerOlder