@@ -110,7 +110,6 @@ float3 ViewDirectionFromUV(float2 uv)
110110}
111111
112112
113-
114113float3 SampleSkybox (float3 dir)
115114{
116115 float3 absDir = abs (dir);
@@ -170,71 +169,6 @@ float3 SampleSkybox(float3 dir)
170169 return color;
171170}
172171
173- float3 ViewDirectionFromUV (float2 uv)
174- {
175- float2 ndc = uv * 2.0f - 1.0f ;
176-
177- float3 rayView = normalize (mul (float4 (-ndc.x, ndc.y, 1.0f , 0.0f ), InverseProjection).xyz);
178- float3 rayWorld = normalize (mul (float4 (rayView, 0.0f ), InverseView).xyz);
179-
180- return -rayWorld;
181- }
182-
183-
184-
185- float3 SampleSkybox (float3 dir)
186- {
187- float3 absDir = abs (dir);
188- float ma;
189- float2 uv;
190- float3 color;
191-
192- if (absDir.x >= absDir.y && absDir.x >= absDir.z)
193- {
194- ma = absDir.x;
195- if (dir.x > 0 )
196- {
197- uv = float2 (-dir.z, -dir.y) / ma * 0.5 + 0.5 ;
198- color = rightTex.Sample (skyboxSampler, uv).rgb;
199- }
200- else
201- {
202- uv = float2 (dir.z, -dir.y) / ma * 0.5 + 0.5 ;
203- color = leftTex.Sample (skyboxSampler, uv).rgb;
204- }
205- }
206- else if (absDir.y >= absDir.x && absDir.y >= absDir.z)
207- {
208- ma = absDir.y;
209- if (dir.y > 0 )
210- {
211- uv = float2 (dir.x, dir.z) / ma * 0.5 + 0.5 ;
212- color = topTex.Sample (skyboxSampler, uv).rgb;
213- }
214- else
215- {
216- uv = float2 (dir.x, -dir.z) / ma * 0.5 + 0.5 ;
217- color = bottomTex.Sample (skyboxSampler, uv).rgb;
218- }
219- }
220- else
221- {
222- ma = absDir.z;
223- if (dir.z > 0 )
224- {
225- uv = float2 (dir.x, -dir.y) / ma * 0.5 + 0.5 ;
226- color = frontTex.Sample (skyboxSampler, uv).rgb;
227- }
228- else
229- {
230- uv = float2 (-dir.x, -dir.y) / ma * 0.5 + 0.5 ;
231- color = backTex.Sample (skyboxSampler, uv).rgb;
232- }
233- }
234-
235- return color;
236- }
237-
238172PixelOutput PixelMain (VertexOutput input, uint index : SV_SampleIndex )
239173{
240174 float depth = depthTex.Load (input.position.xy, index).r;
0 commit comments