Open XakepSDK opened 5 years ago
My guess is that properly casting refraction rays is expensive since they would need a lot of them to reduce noise. They probably just took them out and this also affects glass surfaces which are almost opaque.
You’re right, there aren’t refraction rays. I think they should be implemented, regardless if performance drops. The point of this mod is to implement accurate Ray Tracing, therefore I assume its on the developer’s list of things to do
Since engine uses raytracing, it can do proper reflection/refraction. Like in Quake Wars: Ray Traced - see screenshot on the right. Would be great if engine featured switchable water effect:
Looking at src/refresh/vkpt/shader/path_tracer.h
if(is_water(material_id)) {
vec3 water_normal = waterd(position.xy * 0.1).xzy;
float F = pow(1.0 - max(0.0, -dot(direction, water_normal)), 5.0);
direction = reflect(direction, water_normal);
trace_ray(Ray(position, direction, 0.01, 10000.0));
throughput *= mix(vec3(0.1, 0.1, 0.15), vec3(1.0), F);
contrib += (1.0 - F) * vec3(0.2, 0.4, 0.4) * 0.5;
if(!found_intersection(ray_payload_brdf))
{
primary_albedo = env_map(direction); // * throughput;
store_no_hit(primary_albedo, motion);
return vec4(contrib, false);
}
Triangle triangle = get_hit_triangle(ray_payload_brdf);
vec3 bary = get_hit_barycentric(ray_payload_brdf);
vec2 tex_coord = triangle.tex_coords * bary;
/* world-space */
position = triangle.positions * bary;
normal = normalize(triangle.normals * bary);
material_id = triangle.material_id;
albedo = global_textureLod(triangle.material_id, tex_coord, 2).rgb * ALBEDO_MULT;
cluster_idx = triangle.cluster;
primary_albedo = albedo;
albedo = vec3(1);
temporal_accum = true;
if(dot(direction, normal) > 0)
normal = -normal;
}
Looking at this it appears it only calculates the reflection ray.
Only reflection was implemented. Refraction has not been implemented yet, just like particle effects. Give it time, the developers will work on it
I have implemented fresnel reflections and refractions in the fork: https://github.com/IvanVolosyuk/q2vkpt In the commit: https://github.com/IvanVolosyuk/q2vkpt/commit/886d97b6ac2dbfb1469b47f60523fda3ef552418 Looks better - more realistics, noisier as well.
When you're underwater, game renders ceiling as floor instead of actual ceiling. Water reflections are too mirror-like.