Question by
JPhilipp · Mar 23, 2018 at 03:55 PM ·
shadershader programming
Get world position in shader of Unity's new PostProcessing stack?
How would one in the new PostProcessing2Beta shader framework get the absolute xyz world position of the pixel in question? I found many related threads on this but have failed so far when trying to include their approaches. Many thanks!
Shader "Hidden/Filter/Test" {
HLSLINCLUDE
#include "../../PostProcessing/Shaders/StdLib.hlsl"
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
float4 Frag(VaryingsDefault i) : SV_Target {
float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoordStereo);
// what's the world position of this color pixel ...?
return color;
}
ENDHLSL
SubShader {
Cull Off ZWrite Off ZTest Always
Pass {
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment Frag
ENDHLSL
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Proper working atmosphere shader in Unity 2018. 1 Answer
Creating a 3D portal effect using stencil buffer with a deferred shading setup? 1 Answer
Need help converting a custom shader to URP 0 Answers
Help with URP shader for a procedural terrain mesh 0 Answers
Setting fallback to Sprites-Default on custom shader for sprites 1 Answer