Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Underwater rendering bug #8

Open
XakepSDK opened this issue Jan 18, 2019 · 7 comments
Open

Underwater rendering bug #8

XakepSDK opened this issue Jan 18, 2019 · 7 comments

Comments

@XakepSDK
Copy link

XakepSDK commented Jan 18, 2019

When you're underwater, game renders ceiling as floor instead of actual ceiling.
Water reflections are too mirror-like.

@XakepSDK
Copy link
Author

@muddymind
Copy link

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.

@niko1point0
Copy link

niko1point0 commented Jan 20, 2019

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

@mastan-rus
Copy link

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:

  • Realistic, with total internal reflection etc.
  • Like most games do - as if water and air has same refractive index, but with some distortion effect.
  • Off or current mirror-like (for performance reasons)

@muddymind
Copy link

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.

@niko1point0
Copy link

Only reflection was implemented. Refraction has not been implemented yet, just like particle effects. Give it time, the developers will work on it

@IvanVolosyuk
Copy link

I have implemented fresnel reflections and refractions in the fork:
https://github.com/IvanVolosyuk/q2vkpt
In the commit:
IvanVolosyuk@886d97b
Looks better - more realistics, noisier as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants