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

Tessendorf waves simulation #68

Open
wants to merge 56 commits into
base: master
Choose a base branch
from

Conversation

sadiuk
Copy link
Contributor

@sadiuk sadiuk commented Feb 23, 2021

Description

Testing

TODO list:

@sadiuk
Copy link
Contributor Author

sadiuk commented Feb 23, 2021

image

@sadiuk
Copy link
Contributor Author

sadiuk commented Mar 9, 2021

tessendorf-waves-simulation-2021-03-09-15-59-38_rjP5L7zt.mp4

Not a proper heightmap, but much closer to the expected result.

@sadiuk
Copy link
Contributor Author

sadiuk commented Mar 11, 2021

tessendorf-waves-simulation-2021-03-11-16-06-59_tezBXDah.mp4

It still has to be centered, right?

@devshgraphicsprogramming
Copy link
Member

tessendorf-waves-simulation-2021-03-11-16-06-59_tezBXDah.mp4

It still has to be centered, right?

not really because it gets tiled on a big ocean surface

The phase random seeding still looks wrong, it should have no discernible patterns at startup.

@sadiuk
Copy link
Contributor Author

sadiuk commented Mar 11, 2021

The phase random seeding still looks wrong, it should have no discernible patterns at startup.

Yeah it still looks symmetrical with respect to the diagonal. Will fix that

@sadiuk
Copy link
Contributor Author

sadiuk commented Mar 12, 2021

tes_sRWCDHAM.mp4

ok this one looks fine for me,

Comment on lines 10 to 13
struct displacement_spectrum
{
vec2 d[3];
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd much rather see you use a mat2x3/mat3x2 (dont renember which one acts like an array of vec2[3]


#include <nbl/builtin/glsl/math/complex.glsl>
#include <nbl/builtin/glsl/sampling/box_muller_transform.glsl>
#define PI 3.1415926538

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's an engine constant for that

#include <nbl/builtin/glsl/sampling/box_muller_transform.glsl>
#define PI 3.1415926538
#define G 9.8
#define UINT_MAX 4294967295u

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's an engine constant for that

Comment on lines 16 to 19
vec3 fresnel(float cosTheta, vec3 f0)
{
return f0 + (1.0 - f0) * pow(1.0 - cosTheta, 5.0);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's an engine builtin for this

vec4 pos = vec4((world_pos.xyz + displacement) * scale, 1);
gl_Position = u_pc.vp * pos;

v_normal = texture(normal_map, texture_pos).rgb;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not read the normal texture in the fragment shader!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the normal map stores vertex normals. They must be read in the vertex shader and get interpolated, don't they?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

barycentrically interpolated normals = bad

also usually you'd have less vertices than you have pixels in a normal map

#define G 9.8
#define UINT_MAX 4294967295u

struct displacement_spectrum
{
vec2 d[3];
mat3x2 d;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the mat3x2 instead of the struct

vec3 light = normalize(light_pos - world_coord);
vec3 view = normalize(u_pc.camera_pos - world_coord);

vec3 f0 = vec3(0.04);
vec3 f = fresnel(max(dot(normal_normalized, view), 0.0), f0);
vec3 f = nbl_glsl_fresnel_schlick(f0, max(dot(normal, view), 0.0));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abs(dot())

@sadiuk
Copy link
Contributor Author

sadiuk commented Mar 30, 2021

tessendorf-waves-simulation-2021-03-30-23-24-24_7VCPCAfz.mp4

Well this is what i've got so far. The task is mostly finished, but i'll try to make the water shading a bit more realistic.

@sadiuk
Copy link
Contributor Author

sadiuk commented Apr 3, 2021

I think i fixed all the stuff you commented about so far @devshgraphicsprogramming

@@ -0,0 +1 @@
bin/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kill this whole file

@sadiuk sadiuk mentioned this pull request Oct 1, 2021
2 tasks
@AnastaZIuk
Copy link
Member

[CI]: Can one of the admins verify this patch?

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

Successfully merging this pull request may close these issues.

None yet

3 participants