sphere is here
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
#version 460
|
#version 460
|
||||||
#include "include.glsl"
|
#include "include.glsl"
|
||||||
|
|
||||||
layout(location=0)in vec3 position;
|
layout(location = 0) in vec3 position;
|
||||||
|
|
||||||
layout(location=1)out vec4 pos;
|
layout(location = 0) out vec4 pos;
|
||||||
|
|
||||||
void main(){
|
void main() {
|
||||||
mat4 worldview=camera_uniforms.view*pc.world;
|
pos = vec4(position, 1.);
|
||||||
pos = worldview*vec4(position,1.);
|
vec4 worldview = camera_uniforms.view * pc.world * pos;
|
||||||
gl_Position=camera_uniforms.proj*pos;
|
gl_Position = camera_uniforms.proj * worldview;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -4,7 +4,7 @@
|
|||||||
#extension GL_GOOGLE_include_directive:require
|
#extension GL_GOOGLE_include_directive:require
|
||||||
#include "include.glsl"
|
#include "include.glsl"
|
||||||
|
|
||||||
layout(location = 1) in vec4 pos;
|
layout(location = 0) in vec4 pos;
|
||||||
|
|
||||||
layout(depth_greater) out float gl_FragDepth;
|
layout(depth_greater) out float gl_FragDepth;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ float scene(vec3 p) {
|
|||||||
const float EPSILON = .0001;
|
const float EPSILON = .0001;
|
||||||
const uint MAX_STEPS = 50;
|
const uint MAX_STEPS = 50;
|
||||||
#define NEARPLANE 0.
|
#define NEARPLANE 0.
|
||||||
float FARPLANE;
|
float FARPLANE = 10;
|
||||||
#define gl_GlobalInvocationID uvec3(1)
|
#define gl_GlobalInvocationID uvec3(1)
|
||||||
|
|
||||||
vec3 getNormal(vec3 p, float dens) {
|
vec3 getNormal(vec3 p, float dens) {
|
||||||
@@ -69,17 +69,16 @@ void main() {
|
|||||||
if (td.y < EPSILON)
|
if (td.y < EPSILON)
|
||||||
{
|
{
|
||||||
vec3 n = getNormal(p, td.y);
|
vec3 n = getNormal(p, td.y);
|
||||||
//f_color=vec4(1.);
|
|
||||||
f_color = vec4(shading(n, inverse(pc.world) * vec4(p, 1.)), 1.);
|
f_color = vec4(shading(n, inverse(pc.world) * vec4(p, 1.)), 1.);
|
||||||
|
|
||||||
vec4 tpoint = camera_uniforms.proj * camera_uniforms.view * pc.world * vec4(p, 1);
|
vec4 tpoint = camera_uniforms.proj * camera_uniforms.view * pc.world * vec4(p, 1);
|
||||||
gl_FragDepth = (tpoint.z / tpoint.w);
|
// gl_FragDepth = (tpoint.z / tpoint.w);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
f_color = vec4(raydir, 1.0);
|
||||||
// discard;
|
// discard;
|
||||||
}
|
}
|
||||||
|
|
||||||
f_color = vec4(1.0, 0.0, 1.0, 1.0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user