havenphillip Posted September 28, 2019 Share Posted September 28, 2019 Bepuddled terrain effect. I was able to put this together based on an old Shadmar shader I began fiddling with, but it's different enough that I didn't feel the need to credit him so I did it here. *credits Shadmar* Make a box and attach the waterterrain.lua script to it. Then drag the player into the "Player" slot of the script so it can access the camera. That's it. (Also don't forget to have a skybox set) Some settings considerations: It looks better on darker terrains so I set the diffuse color to about half, put the specular all the way up and set roughness to 0.0 in the Material Editor. Terrains tend to look darker when wet anyway. Diffuse texture is set to uncompressed with mipmaps because it's so large. Textures should be set up as shown below. Water Terrain.zip 4 Quote Link to comment Share on other sites More sharing options...
havenphillip Posted September 28, 2019 Author Share Posted September 28, 2019 They're kind of stretching long on the x-axis so you can go in the shader and find this line (around line 49): vec2 spec_texcoords0 = ex_texcoords0/(vec2(puddlesize)); ...and change it to this: vec2 spec_texcoords0 = ex_texcoords0/(vec2(puddlesize/2,puddlesize)); That seems to have squared them up. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted September 28, 2019 Share Posted September 28, 2019 This is neat. Thank you for sharing it. I hope to try it later. 1 Quote Link to comment Share on other sites More sharing options...
havenphillip Posted October 1, 2019 Author Share Posted October 1, 2019 One thing about this I've noticed is the flashlight doesn't evenly light the ground in 360 degrees. If I change "nmat" in the vertex shader from: //Sky mat3 nmat = mat3(camerainversematrix); //inverse sky on model stays in place ex_normal = normalize(nmat * vertex_normal); ex_tangent = normalize(nmat * vertex_tangent); ex_binormal = normalize(nmat * vertex_binormal); ...to this, the flashlight works correctly but the sky reflection doesn't. //Flashlight //mat3 nmat = mat3(entitymatrix); //flashlight works 360 //ex_normal = normalize(nmat * vertex_normal); //ex_tangent = normalize(nmat * vertex_tangent); //ex_binormal = normalize(nmat * vertex_binormal); I tried a few things including using an "if" statement but haven't been able to solve this. If anyone's already figured this out I'd like a solution. It's not too much of a big deal. It just irks me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.