temp
This commit is contained in:
@@ -4,26 +4,33 @@
|
||||
|
||||
#include "bindless.glsl"
|
||||
|
||||
layout(location = 0) in vec2 uv; // from fullscreen triangle: 0..2 range
|
||||
layout(location = 0) in vec2 uv;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
layout(push_constant) uniform SkyboxPC {
|
||||
mat4 invViewProj; // inverse(Proj * View) (your current setup)
|
||||
vec4 cameraPos; // xyz = camera world position
|
||||
uint skyboxTextureId; // index into textureCubes[]
|
||||
mat4 invViewProj;
|
||||
vec4 skyboxRot[3];
|
||||
vec3 cameraPos;
|
||||
uint skyboxTextureId;
|
||||
} pcs;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 ndcXY = uv * 2.0 - 1.0;
|
||||
|
||||
vec4 ndc = vec4(ndcXY, 1.0, 1.0);
|
||||
|
||||
vec4 world = pcs.invViewProj * ndc;
|
||||
vec3 worldPos = world.xyz / world.w;
|
||||
|
||||
vec3 dir = normalize(worldPos - pcs.cameraPos.xyz);
|
||||
vec3 dir = normalize(worldPos - pcs.cameraPos);
|
||||
dir.y *= -1.0;
|
||||
|
||||
mat3 skyboxRot = mat3(
|
||||
pcs.skyboxRot[0].xyz,
|
||||
pcs.skyboxRot[1].xyz,
|
||||
pcs.skyboxRot[2].xyz
|
||||
);
|
||||
dir = skyboxRot * dir;
|
||||
|
||||
outColor = sampleTextureCubeLinear(pcs.skyboxTextureId, dir);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user