Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Super Mario Sunshine Water Shader

Author
Message
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 21st Feb 2020 13:03 Edited at: 22nd Feb 2020 07:34
Based on: https://blog.mecheye.net/2018/03/deconstructing-the-water-effect-in-super-mario-sunshine/

I'll admit, I'm a novice with OpenGL shaders. So, I can't promise this shader is optimized/performant, but it works.

Project download attached, enjoy.

Attachments

Login to view attachments
Amon
10
Years of Service
User Offline
Joined: 30th May 2014
Location: Shropshire, United Kingdom
Posted: 21st Feb 2020 23:49
Cool
Win 10 Pro - AMD RYZEN 7 3800X Octacore - 16GB DDR4 - RTX 2080TI 11GB
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Feb 2020 00:39
That's great im now thinking that would work for my blitzkrieg remake (old apple 2 remake)
I was thinking a totally 3D world but might give it more a 3D perspective but with limited
movement perhaps just rotations not sure (the cartoony tank supplied by the fab blink)
anyway got me going and been after a cartoon style water thanks

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Mesher
User Banned
Posted: 22nd Feb 2020 03:18
very impressive indeed - its amazing what shaders can really acheive these days. and all it takes is just a few commands

mix, clamp, dot, smoothstep, length


Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 19th May 2020 00:30
@Nieb

very nice

so this is meant for 2d more than 3d basied on the code provided ?
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 21st May 2020 13:28 Edited at: 21st May 2020 13:29
This is more akin to what the Mario Sunshine Water is doing... now strictly speaking this is rough, and can't be done in AppGameKit as it doesn't support Pre-Generated MipMap Image Formats (like DDS) or have any way to add them to an Image Mesh to load them from an Image Atlas.
So the code provided is in Dark BASIC Professional, it's also quite "Rough" because as most people never used these features of DBP., they tended to be a little "tricky" to work with due to various features of the Engine tended to break things.

When I have time I'll work on a Shader that will Emulate all three Elements of the Mario Sunshine Water (Frame Buffer Reflection, Refraction and Mip Map Tricks).
Still for now, feel free to have a play with what I've attached.



Attachments

Login to view attachments
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 21st May 2020 17:33
I dont see why that effect cannot be done in AGK.....what's special about it?
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 21st May 2020 23:35
You can., but not without it being a Shader...
AGK (both v2 and Studio) support Mip-Mapping (Linear, Bilinear, Trilinear and Anisotropic) but it doesn't support any Image Formats that can contain Mip-Maps., instead it Auto-Generates them.
That's kind of the issue here, because we're taking advantage here of how the Further the Distance from the Camera... the Texture Map is changed with a Smaller Texture Map.

Generally speaking, this is done to conserve GPU Memory and Reduce Pixel Processing... but in our case, we're utilising an Automated Function of the 3D Pipeline (which is essentially costless today) to swap out the Texture Images without any fancy code.
So where a Normal MIP-Mapped Texture Map might look like this:



The one we're using for this looks like this:



And with some creative Blend Mode and Scrolling Operations., the end result is reasonably convincing Flowing Liquid (like the Ocean)

Login to post a reply

Server time is: 2024-11-22 05:02:08
Your offset time is: 2024-11-22 05:02:08