mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
~ | Small tweaks
This commit is contained in:
@ -24,8 +24,8 @@ pl 0 -2 0 0 1 0 2 // floor
|
||||
|
||||
qu -1 1.999 -1 2 0 0 0 0 2 6
|
||||
|
||||
OBJ obj/Dragon_800K.obj -0.5 0 0.55 5 0 90 0
|
||||
OBJ obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0
|
||||
OBJ scenes/obj/Dragon_800K.obj -0.5 0 0.55 5 0 90 0
|
||||
OBJ scenes/obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0
|
||||
|
||||
po -1.99 -0.5 -0.5 0 1 0 0 0 1 1 4
|
||||
po 1.99 -0.5 -0.5 0 1 0 0 0 1 0 4
|
||||
|
@ -19,7 +19,7 @@ cu 0 10 0 5 5 5 3
|
||||
sp 0 10 0 1 4
|
||||
|
||||
|
||||
OBJ obj/lambo.obj 0 1.5 0 1 0 0 0
|
||||
OBJ scenes/obj/lambo.obj 0 1.5 0 1 0 0 0
|
||||
|
||||
|
||||
|
||||
|
@ -7,8 +7,8 @@ MAT 255 220 50 0.0 1.0 0.5 // dragon 1
|
||||
MAT 255 255 255 5.0 0.0 0.0 // light 2
|
||||
sp 0 50 0 25 2
|
||||
|
||||
OBJ obj/sponza.obj 0 0 0 0.025
|
||||
OBJ scenes/obj/sponza.obj 0 0 0 0.025
|
||||
|
||||
OBJ obj/Dragon_80K.obj 7 2.5 0 9 0 140 0 0
|
||||
OBJ obj/Dragon_80K.obj 9 1.35 -3.5 5 0 40 0 1
|
||||
OBJ scenes/obj/Dragon_80K.obj 7 2.5 0 9 0 140 0 0
|
||||
OBJ scenes/obj/Dragon_80K.obj 9 1.35 -3.5 5 0 40 0 1
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
CAM -2.41462 2.57199 4.09049 -1.80012 -50.2012 0.02 2.973 45.75 5
|
||||
CAM 0 0 -5
|
||||
|
||||
MAT 20 20 20 0. 0.9 0.5 // 0 gray
|
||||
# pl 0 -0.5 0 0 -1 0 0 // floor
|
||||
MAT 255 255 255 10.0 1.0 0.0 //white
|
||||
# sp 0 0 0 1 0
|
||||
|
||||
|
||||
MAT 0 0 0 0. 0 0 // 1 black
|
||||
MAT 255 255 255 0. 1.5 0 DIE -1 // 2 blackhole
|
||||
|
||||
sp 0 0 0 5 1
|
||||
sp 0 0 0 15 2
|
||||
OBJ scenes/obj/room.obj 0 0 0 1
|
||||
|
40
scenes/volumetric.rt
Normal file
40
scenes/volumetric.rt
Normal file
@ -0,0 +1,40 @@
|
||||
CAM 1.61759 3.23371 -7.26417 -4.0001 105.199 0 2.973 45.75 5
|
||||
|
||||
MAT 255 255 255 2.0 1.0 0.0 // 0 white light
|
||||
# sp -3.5 2.7 0.5 0.2 0
|
||||
qu -4 2.375 0 0 0.25 0 0 0 0.25 0
|
||||
|
||||
MAT 250 250 250 0. 1.0 0.0 // 1 white
|
||||
MAT 250 100 100 0. 1.0 0.0 // 2 red
|
||||
MAT 100 100 250 0. 1.0 0.0 // 3 blue
|
||||
|
||||
MAT 250 250 250 0. 1.0 0.05 // 1 white tomato
|
||||
MAT 250 250 250 0. 1.3 0. DIE -1 // 1 white dielectric
|
||||
|
||||
qu 2.5 0 -2.5 0 5 0 0 0 5 1
|
||||
qu -2.5 0 2.5 0 5 0 5 0 0 2
|
||||
qu -2.5 0 -2.5 0 0 5 5 0 0 1
|
||||
|
||||
qu -2.5 0 -2.5 0 2.375 0 0 0 5 3
|
||||
qu -2.5 2.6275 -2.5 0 2.375 0 0 0 5 3
|
||||
|
||||
qu -2.5 2 0.25 0 1 0 0 0 2.75 3
|
||||
qu -2.5 2 -2.5 0 1 0 0 0 2.5 3
|
||||
|
||||
|
||||
sp 1.25 1 -1 1.5 4
|
||||
sp 0 2.5 0 0.5 5
|
||||
|
||||
|
||||
|
||||
# MAT 20 20 20 0. 0.9 0.5 // 0 gray
|
||||
# # pl 0 -0.5 0 0 -1 0 0 // floor
|
||||
|
||||
|
||||
# MAT 0 0 0 0. 0 0 // 1 black
|
||||
# MAT 255 255 255 0. 1.5 0 DIE -1 // 2 blackhole
|
||||
|
||||
# sp 0 0 0 5 1
|
||||
# sp 0 0 0 15 2
|
||||
|
||||
# OBJ scenes/obj/jinx.obj 0 0 -15
|
@ -3,7 +3,7 @@ CAM 0 2 -2 0 90
|
||||
MAT 255 255 255 0.0 1.0 0.0 //white
|
||||
MAT 150 150 150 0.0 1.0 0.0 //grey
|
||||
|
||||
MAT 255 255 255 10.0 0.0 0.0 //light
|
||||
MAT 255 255 255 1.0 0.0 0.0 //light
|
||||
|
||||
sp -5 5 0 1 2
|
||||
|
||||
|
@ -74,6 +74,10 @@ bool intersectTriangle(Ray ray, GPUTriangle obj, out hitInfo hit)
|
||||
|
||||
vec3 pvec = cross(ray.direction, vertex2);
|
||||
float det = dot(vertex1, pvec);
|
||||
|
||||
if (abs(det) < 1e-8)
|
||||
return (false);
|
||||
|
||||
vec3 tvec = ray.origin - obj.position;
|
||||
|
||||
float invDet = 1.0 / det;
|
||||
@ -82,8 +86,7 @@ bool intersectTriangle(Ray ray, GPUTriangle obj, out hitInfo hit)
|
||||
float v = dot(ray.direction, qvec) * invDet;
|
||||
float t = dot(vertex2, qvec) * invDet;
|
||||
|
||||
bool valid = abs(det) > 1e-8 &&
|
||||
u >= 0.0 && u <= 1.0 &&
|
||||
bool valid = u >= 0.0 && u <= 1.0 &&
|
||||
v >= 0.0 && (u + v) <= 1.0 &&
|
||||
t > 0.0;
|
||||
|
||||
|
@ -41,7 +41,7 @@ vec3 sampleSphereLight(vec3 position, GPUObject obj, int light_index, GPUMateria
|
||||
return vec3(0.0);
|
||||
|
||||
float cos_theta = max(0.0, -dot(light_dir, normalize(sample_point - obj.position)));
|
||||
return mat.emission * mat.color / (light_dist); // * cos_theta / (4.0 * M_PI * (obj.radius / 2.0) * (obj.radius / 2.0));
|
||||
return mat.emission * mat.color / (light_dist * light_dist) * cos_theta / (4.0 * M_PI * (obj.radius / 2.0) * (obj.radius / 2.0));
|
||||
}
|
||||
|
||||
vec3 sampleQuadLight(vec3 position, GPUObject obj, int light_index, GPUMaterial mat, inout uint rng_state)
|
||||
@ -65,7 +65,7 @@ vec3 sampleQuadLight(vec3 position, GPUObject obj, int light_index, GPUMaterial
|
||||
|
||||
vec3 normal = normalize(crossQuad);
|
||||
float cos_theta = max(0.0, dot(normal, -light_dir));
|
||||
return mat.emission * mat.color / (light_dist); // * cos_theta / pdf;
|
||||
return mat.emission * mat.color / (light_dist);
|
||||
}
|
||||
|
||||
vec3 sampleLights(vec3 position, inout uint rng_state)
|
||||
|
@ -142,6 +142,7 @@ int main(int argc, char **argv)
|
||||
shader.set_textures(scene.getTextureIDs());
|
||||
|
||||
glDispatchCompute((WIDTH + 15) / 16, (HEIGHT + 15) / 16, 1);
|
||||
|
||||
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
Reference in New Issue
Block a user