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.

DarkBASIC Professional Discussion / How make endless ocean with scroll texture? (shader)

Author
Message
Mobilemedved
11
Years of Service
User Offline
Joined: 23rd Jan 2015
Location:
Posted: 4th Feb 2015 11:18
I make helicopter sim, and need endless ocean. I get Fresnel Water.fx and apply it from very big plane. This plane move with camera:
"Function shdrUpdateWaterPlain(shdrWater As Integer, obj As Integer, x As Float, y As Float, z As Float)
Position Object obj, x, y, z
....
....
....
EndFunction
"
Ok. I have endless water. But I need texture scroll, from helicopter motion effect. I think it is necessary to change the line, but what?:
OUT.Tex1 = IN.UV*WaterScale/0.5+(time*Speed1);
OUT.Tex2 = IN.UV*WaterScale+(time*Speed2);
OUT.Tex3 = IN.UV*WaterScale*0.25+(time*Speed3);

shader code:



ps. Also in my project still have a shader Sky.fx (XNA) but this dont work correctly

zzz!
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 4th Feb 2015 23:51
Do the dark basic pro command "scroll object texture" not do what you need?

Mobilemedved
11
Years of Service
User Offline
Joined: 23rd Jan 2015
Location:
Posted: 7th Feb 2015 09:03
This command not work if I use sahder

zzz!
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 8th Feb 2015 19:13 Edited at: 8th Feb 2015 19:15
The IN.UV 2D float could be added to a texture scroll value to move the texture. I imagine you know how to alter shader constants using the shader commands, and you must be aware of what UV coordinates are.

OUT.Tex1 = float2(IN.U+ScrollX, IN.V+ScrollZ)*WaterScale/0.5+(time*Speed1);

etc, etc. Obviously you would need to define ScrollX and ScrollZ in the shader (or if you want you could chose to use a 2D variation using float2 Scroll; Scroll.X = ?; Scroll.Y = ?)

Mobilemedved
11
Years of Service
User Offline
Joined: 23rd Jan 2015
Location:
Posted: 10th Feb 2015 17:27
Chris Tate big thank! I make endless water! This work fine!

http://forum.thegamecreators.com/?m=forum_view&t=213587&b=6

zzz!
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 11th Feb 2015 17:30 Edited at: 12th Feb 2015 15:37
I would also suggest looking into clamping a texture to absolute world position in the shader. It's basically what you want for your shader. Keeping the texture to world position means that it doesn't matter where your plane is, the texture will always stay in the same place. This means you don't have to mess around with scrolling, it will do it automatically.

Quickly wrote a shader that does it:


"Get in the Van!" - Van B
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 12th Feb 2015 15:20
No problem; it looks nice!

Login to post a reply

Server time is: 2026-07-11 18:27:36
Your offset time is: 2026-07-11 18:27:36