Jump to content

Scripting a shader texture movement!

Views: 1,402 | Comments: 2   

I will make a more detailed blog entry about this because it was an adventure to reach this.

It was all about converting a beautiful shader generated waves mvement  in a mathematic function that allows to predict waves forces at a position (x,y,z) , to get for example:

- realistic and not randomly ingame wave shaking effects on a boat, or wood prop or whatever.

- Splash effects or character realistic reactions depending on the wave water level.

This is a little showcase that shows how the terrain is replicating the main shader waves movement.

> The terrain's movements are generated with a script and is rendered in blue.

> The shader is placed to compare a little bit higher over the terrain and has transparency.

 

 Share


User Feedback


15 hours ago, havenphillip said:

Would be cool to set an invisble texture on the terrain and then pick the terrain to make obects float above it at the water level

Yes that would be great for a game with main >90% terrain=water like sea of thieves for example. And the pick capture will run yes, on the terrain.

But I see 3 limits in this:

> The limitation to one terrain for one map: So your game must be >90% water like sea of thieves maybe?

> The Collision: Terrain collision is hard, I suppose water is should be soft; maybe you want to allow the player to plunge and go down in water, actually I used the terrain as "debug" for the simulation; once it runs ok, I want to use only the equation for calculation so it could be more appropriate for water to use AddForce() I don't know that is the next step, not done yet.

> Performances: For terrain we have to check all "terrain points" and levelled all of them with

the right wave altitute * time so that it simulates those waves movement, using:

Quote

for x, 0, 1024 do

      for z, 0, 1024 do 

            Terrain:SetHeight(x, z, wave_height)

      end

end

This runs ok with little terrain like 64x64 but for 1024x1024 it becomes a problem.

That's why shaders are a way magical more appropriate to simulate enorm surface movement so quickly; like I became the feeling by working on this that (I cannot demonstrate anything):

ex_vertexposition.x  <=>  for x, 0, 1024 do

ex_vertexposition.z  <=>  for z, 0, 1024 do

 

  • Like 1
Link to comment
Share on other sites

That's great how you just did the math on that and made it work.

Would be cool to set an invisble texture on the terrain and then pick the terrain to make obects float above it at the water level. Would a terrain pick capture the wave height? 

It's going to be cool to see stuff floating on this.

Link to comment
Share on other sites



Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Write a comment

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...