Jump to content
This is not recommended for shared computers
Sign in anonymously
Don't add me to the active users list
Bring your ideas to life with a Gaming Degree from Full Sail University
Yann ALET hasn't added any contacts yet.
23 March 2014 - 02:34 PM
Have you thought about sampling a sky gradient texture instead ?
Something like this
20 March 2014 - 08:46 PM
Thanks a lot for your response Bacterius !
So following your advice, i bumped the shininess ...
This is much better !
I wonder why my specular effect is located on such a small area though, i'll try to tweak my shader a bit to come up with a better algorithm.
Regarding the sharpness of my waves, that's why i increased my grid resolution, and added a height map, it did not help a lot though.
And regarding color absorption in water, i am actually handling that with this function which i wrote based on this article.
sandColor = GetWaterColorAt(sourceColor, distance);
float3 GetWaterColorAt(float3 sourceColor, float depth)
float rIndex = 7.0f;
float gIndex = 10.0f;
float bIndex = 70.0f;
float sandRed = sourceColor.r;
float sandGreen = sourceColor.g;
float sandBlue = sourceColor.b;
float lostRed = (depth / rIndex) * (1.0f/3.0f);
float lostGreen = (depth / gIndex) * (1.0f/3.0f);
float lostBlue = (depth / bIndex) * (1.0f/3.0f);
sandRed = sandRed - (sandRed * lostRed);
sandGreen = sandGreen - (sandGreen * lostGreen);
sandBlue = sandBlue - (sandBlue * lostBlue);
float3 sandColor = float3(max(0, sandRed), max(0, sandGreen), max(0, sandBlue));
I'll try to add caustic and reflection to see if i get better results.
Thanks again !
24 December 2013 - 02:31 PM
Thanks a lot, I'll try that !
23 December 2013 - 06:28 PM
Thanks for answering nfactorial.
I tried to scale the effect down by adding a 0.1f factor to it, and it does improve things. But i still have visual artefacts on the edges, I guess its the same artefacts i had before, but at a smaller scale.
New shader code :
float zw = gDepthMap.Sample(PointSampler, texCoord).x;
// Calculate sampling offset caused by refraction.
float3 diff = viewRay - refractRay;
diff = diff / zw;
texCoord = texCoord + (diff.xz * 0.1f);
Any thoughts ?
18 September 2013 - 06:17 AM
Awesome this works perfectly, sorry for the late answer, i needed to make sure i could reconstruct view position from depth (thanks to your brillant article !).
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC