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 Studio Chat / [SOLVED] how to create water on a plane?

Author
Message
Yiu435
3
Years of Service
User Offline
Joined: 19th Dec 2020
Location:
Posted: 18th Jul 2023 04:02
how to create water on a plane?
I know there is a example for water with the terrain shader sample but I am not familiar to shader.
What is the easy way to achieve it?
Thanks for helps.

The author of this post has marked a post as an answer.

Go to answer

Zappo
Valued Member
19
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 18th Jul 2023 12:48
I was tempted to make a reference to "Snakes on a Plane" - but I won't.

For the best results you should use a shader. It gives a higher quality and more realistic effect than other methods. Having said that, there are a couple of ways I can think of to do a quick water effect:

1) You could create an animated GIF of moving water and texture your plane with that. It would probably need to be seamless (so the edges weren't detectable). Animated GIF's are supported by AppGameKit Studio and can even be used as a 3D object texture BUT they can slow the app down quite considerably due to the work involved in rendering them. By their nature they also have limited colour palettes so can look pixelated - but that may be a style you are after.

2) You could use a static texture - like a seamless JPEG or PNG of water, and then use the SetSpriteUVOffset command to slide the texture over your plane or any other 3D object. This will give the impression that the water is moving like a stream. This is the simplest method and if you make your object slightly translucent it can look quite good, but your water will still be flat, i.e. no 3D waves.

I would recommend looking into the shader method though if you want realism and your target devices support it.
Yiu435
3
Years of Service
User Offline
Joined: 19th Dec 2020
Location:
Posted: 18th Jul 2023 16:27
@Zappo
Your advice is very helpful.
For more details, how could I make the water plane swimming able?
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 20th Jul 2023 05:49
Well, to be honest the shader pack is what is best, and it works and looks perfect.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 20th Jul 2023 07:18 Edited at: 20th Jul 2023 07:29
This post has been marked by the post author as the answer.
worth a look. light-weight source included.

or, to follow zappo's advice, something like THIS:
.

Attachments

Login to view attachments
Yiu435
3
Years of Service
User Offline
Joined: 19th Dec 2020
Location:
Posted: 20th Jul 2023 11:21
Thanks for all.
Now I know What I need to do.
Aidan
User Banned
Posted: 8th Aug 2023 09:17 Edited at: 8th Aug 2023 09:22
I know this is solved but I did it by applying a repeated image on a plane and then change the UV coordinates on that image for every sync. Just incase you struggle with shader work.

And moving the UVs in such a way to look like waves moving
I used the Cartesian rotation

X = distance * sin (angle)
y = distance * cos (angle)

Increasing angle every frame

Just to give you an alternative idea
Yiu435
3
Years of Service
User Offline
Joined: 19th Dec 2020
Location:
Posted: 9th Aug 2023 10:19
Thank you!

Login to post a reply

Server time is: 2024-05-02 20:38:31
Your offset time is: 2024-05-02 20:38:31