Real Water question

Blitz3D Forums/Blitz3D Programming/Real Water question

Santiworld(Posted 2016) [#1]
Hi, i working in a own ship game in blitz3d.

i'm trying to make a good and realistic water.

for the moment, i using plane water from fastlib and is excelent calm water with reflect and refraction.
i Using 3D mesh water moving vertex to simulate waves movement.


the question is, with dx7 and blitz3d, there is any way to create water like this? using libs, or something?
https://www.youtube.com/watch?v=ykPjzV9Z5Ew



thanks and sorry my english!


H&K(Posted 2016) [#2]
no


Yue(Posted 2016) [#3]
Mesh Water, Animating sample on Fragmotion.


RustyKristi(Posted 2016) [#4]
Using libs.. Yes, by choosing the best wrapper if not B3D, Blitzmax. If you really like to stick with B3D, my best bet is SoftPixel because of the DX9/DX11 rendering. DX11 is experimental as noted on their site.

http://softpixelengine.sourceforge.net/download/SoftPixelEngineWrapper.zip

http://softpixelengine.sourceforge.net/forum/viewtopic.php?f=11&t=42

Those wrappers seems outdated though, you may need help or some work but still depending on your usage.

I'm looking into the wrappers myself as I already forgot about this and just remembered picking it up again recently.

I think your keyword here in making those realistic water is "Tessellation". ;-)

Nvidia always comes first with some fancy graphics tech to showcase their hardware, this is similar to the Unity DX11 water you posted above





Yue(Posted 2016) [#5]
Hi, I 've looked at a sample of water in the examples Blitz3D shows a choppy sea and I think you can improve with Faslibs .

The example is called water,




RustyKristi(Posted 2016) [#6]
Softpixel supports tessellation but I don't know how far it goes or if it is complete/stable enough for production.

Look inside the media folder, you'll find ShaderTessellationHLSL.txt but has no usage in those given examples, you have to ask the author (LukasBanana)


RustyKristi(Posted 2016) [#7]
@Yue,

That's only a simple water example that you can get away with mobile. As long as you have access to Shaders and if SoftPixel's DX11 is good, it should be possible.

You cannot create your own Shader with Tessellation in FastLibs.


Santiworld(Posted 2016) [#8]
hi, ok!, thanks!.

i see now , Tessellation is the secret!

Blitz3d is so compatible with all PC, and the only limitation is the graphics realism.

i choose blitz, i don't like Unity, and other lenguages.

so, i continue the search for good waters using dx7

this is my first 3dwater, the color of water is becouse is a river.




Santiworld(Posted 2016) [#9]
maibe make something like this, is a good way.

but the shaders?, the sunshinne :(

https://www.youtube.com/watch?v=C3UelEn15Sc


RustyKristi(Posted 2016) [#10]
That's nice. Yes, with using wrappers you are still using Blitz3D but with that you have to adjust to other context like 3D Sound and Collision since you are enabling another engine.

so, i continue the search for good waters using dx7


The best water I have seen so far in dx7 is fastlibs and ashadows, nothing comes close. I don't know about other demos but these two stand out but as you can see it does not even compare with today's new water rendering with realism.

I already have asked this and like you has some interest in improving Blitz3D effects but you can't do it without any help from other engine wrappers while maintaining B3D language code.

Unless you have an extensive knowledge in C/C++ Graphics/Engine Programming where you can tear up old DX7 blitz3d source code and convert it to DX9/11.

Speaking of which, you can check out Ploppy's HardWired Lib, but that's far from being stable and can be used in production.

I would suggest studying Shader Programming and pick between your preferred renderer (DirectX 9/11 or OpenGL) and then pick an engine wrapper that works for you and Blitz3D.


RustyKristi(Posted 2016) [#11]
but the shaders?, the sunshinne :(


sunshine? if you're talking about Fastlibs Light Scattering, it can be done using Shaders and you can find lots of information about that. :)

Everything that FastLibs and Ashadows offers is now possible even now have some improved versions like the water tessellation you see there.


Yue(Posted 2016) [#12]
Real Water here.
https://www.shadertoy.com/view/Ms2SD1




Rick Nasher(Posted 2016) [#13]
Yeah, but contrary to what I've seen with fastlibs it's dead slow under softpixels. But hey perhaps it's just my old 2007 laptop or I've not seen/tried the latest version..
[edit]
@Yue: That's some awesome water. I'd expect a shark to come out of there any time. Full screen is a tad slow on my machine though.


gpete(Posted 2016) [#14]
Here's a nice piece of code from way back in the forum somewhere with a few changes I made... and also my path to the 20by20 3DS quad file and my local image file..




I can't remember where in the forum I found this years ago..


Rick Nasher(Posted 2016) [#15]
Would love to try and run this, but.. eh, media for this? Also: is this quick enough to be applied in a real live game environment?


gpete(Posted 2016) [#16]
Ok Rick I looked it up.... the original code is in:

Blitz3D Code archives/3D Graphics - Mesh/3D Water

"3D Water by CyBeRGoth"
It has a 60 kilobyte media download in the archive of textures.
As for the water texture I used there are HUNDREDS of them for free on the web- you don't need the moon thing- the graphic there is one I got from the JPL Nasa Pluto Mission site. So it looks like Cybergoth had a animated texture- I just used a plain old .png file - remember that textures have to be a multiple of 8- 32x32 64x64, 128x128, 256x256 etc,

So in an old program I did the animated Quad mesh moves with the ship mesh- basically that isn't much overhead


Rick Nasher(Posted 2016) [#17]
OK gpete, that seems doable and I probably already have the JPL Nasa pluto texture as I was using that for a planetary sim a while back :-). So then the major question:

-What does it look like? Can you post a screenshot perhaps so we can see what results we're actually talking about.
-Does it rival FastExtensions water? (currently using that one)


Yue(Posted 2016) [#18]
Here test,




Yue(Posted 2016) [#19]
...


Yue(Posted 2016) [#20]
My Water, no FastExt, no Ashadow.



Yue(Posted 2016) [#21]
This is the best water I've seen in Blitz3D without libraries .






Santiworld(Posted 2016) [#22]
Hi! the montain water looks very good!, can you upload more image of that water?


Yue(Posted 2016) [#23]
Here Code Water only Blitz3D.




Rick Nasher(Posted 2016) [#24]
@Yue.

-1st picture doesn't look good to me.
-2nd picture looks good, but no waves so is a bit too much like a mirror.
-know that demo. Indeed very nice, but not really useable for open worlds scene I think.


Yue(Posted 2016) [#25]
@Rick Nasher

Yes, this sea has waves , set plays




Yue(Posted 2016) [#26]




Rick Nasher(Posted 2016) [#27]
Ah, yeah see it now, well done.


Guy Fawkes(Posted 2016) [#28]
@Yue: Can you post the source & any needed files to that water generator code so others can have vertex-water as well? :)

Thanks!

~GF


Yue(Posted 2016) [#29]
Water Anim here: https://www.dropbox.com/s/dji61llllnrb38n/WATERANIM.rar?dl=0




Yue(Posted 2016) [#30]
Water 2 Here Download : https://www.dropbox.com/s/li0hgs25zxu2l3g/water.rar?dl=0



Yue(Posted 2016) [#31]
Other Water Download here : https://www.dropbox.com/s/44lt3byno6lhk2k/WATER2.rar?dl=0




Yue(Posted 2016) [#32]


Water Waves paragraph A vast sea in a storm.


Here Download: https://www.dropbox.com/s/y31un2wc1hnb3bx/waterscape.rar?dl=0


Guy Fawkes(Posted 2016) [#33]
Can you post this 1 too?



This is the one I'm after.

I tried WATER2 and it was only blue water. What I need is clear water where the vertices are moving.

Thanks Yue! :)

~GF


Yue(Posted 2016) [#34]
@Guy Fawkes

Download here: Water 2 https://www.dropbox.com/s/li0hgs25zxu2l3g/water.rar?dl=0


Guy Fawkes(Posted 2016) [#35]
Thanks ALOT Yue! Simply BEAUTIFUL! =D

~GF


Rick Nasher(Posted 2016) [#36]
This a rather nice looking water for all blitz code. Only pity that such things only work under a certain angle, which limits the usability.
If you change the line
If KeyDown(208)Then If EntityY(camera)>3 MoveEntity 

into:
If KeyDown(208)Then MoveEntity camera,0,-1,0  ;If EntityY(camera)>3 

You'll see what I mean.
Nevertheless, very nice little piece of code, I wouldn't have guessed it was possible like this. Many thanks, I will use this somewhere I am sure.


Yue(Posted 2016) [#37]
To me what intrigues me most of all is that you can still learn a lot from Blitz3D in terms of programming .


Santiworld(Posted 2016) [#38]
Thanks Yue!

is a excelent water!! for lakes waters


i test in my 3dWater, but only works in a calm waters, becouse the cubemap not work in 3D big waves.




Santiworld(Posted 2016) [#39]
this is my water without cubemap




Guy Fawkes(Posted 2016) [#40]
Can you please post this demo, Santi so others can learn?

Thanks!

~GF


Santiworld(Posted 2016) [#41]
is a work in progress, i wish to finish the demo in dicember.

i have a lot of work to finish the demo becouse is a very big project.


here is a video of the scenary editor, work in progress




Yue(Posted 2016) [#42]
I think for the wave cubemap work you have to change the distance of the camera from cubemap. I just speculate about it.

Edit: Power Full Video Santiago. :)


Santiworld(Posted 2016) [#43]
for wavemesh i have a big quad mesh, i move vertex using this funcion




;! NUEVA FUNCION PARA AGUAS 3D BY Santiago Gonzalez www.indiesoft.com.ar
Function wave_mesh()
	fdx# = 5
	fdy# = 1
	fdz# = 11
	wtipe = 0
	alpha# = 1
	f_vel# = 1
	For b.boton_menu = Each boton_menu
		If b\texto = "Vel" Then f_vel# = b\val
		If b\texto = "Alt" Then f_alt# = b\val
		If b\texto = "fdx" Then fdx# = b\val
		If b\texto = "fdy" Then fdy# = b\val
		If b\texto = "fdz" Then fdz# = b\val
		If b\texto = "Wtype" Then wtipe = b\val
		If b\texto = "Waves" Then waves = b\val
		If b\texto = "Alpha" Then alpha# = b\val
	Next
	
	t_e_frame = (t_e_frame + 1) Mod 23
	
	For i = 0 To mesh_agua_childs
		surf_agua = GetSurface (mesh_agua[i],1)
		;EntityTexture mesh_agua[i],t_espuma,t_e_frame,3
		
		vert = CountVertices(surf_agua)
		tri = CountTriangles(surf_agua)
		
		For v = 0 To vert-1
			
			If wtipe = 1 Then
				
				x# = VertexX(surf_agua,v)
				y# = 0;VertexY(surf_agua,v) 
				z# = VertexZ(surf_agua,v)
				
				
				For w = 1 To waves
					dir = w * 30
					y = y+Sin(dir+(z*waves*fdz+((x+waves)*fdy)+(wave_cicle)))* f_alt 
					
				Next	
				x# = x + Cos((z*fdx)+MilliSecs()*f_vel)*.05
				;y# = y# - (y *.6)
				
				VertexCoords (surf_agua,v,x,y,z)
				
;				d# = Abs(x) + Abs(z)
;				cb = 220
;				ec# = 50
;				ec2#= 50-(d*1)
;				If ec2 < 0 Then ec2 = 0
;				c1# = cb + (y*ec)-(y*ec2 )
;				c2# = cb + (y*ec) 
;				c3# = cb + (y*ec)+(y*ec2)
;				If c1 < 0 Then c1 = 0
;				If c2 < 0 Then c2 = 0
;				If c3 < 0 Then c3 = 0
;				If c1 > 255 Then c1 = 255
;				If c2 > 255 Then c2 = 255
;				If c3 > 255 Then c3 = 255
;				VertexColor surf_agua,v,c1,c2,c3
				
			End If
			
			
		Next
		
		UpdateNormals mesh_agua[i]
		
	Next
	wave_cicle = wave_cicle + (f_vel* t_fix#)*20 
;	
;	If (MilliSecs()-BumpTextureFrameF)>33 Then
;		BumpTextureFrame = BumpTextureFrame + 1*game_speed
;		BumpTextureFrameF = MilliSecs()
;	EndIf
	BumpTextureFrameF = BumpTextureFrameF + 1
	If BumpTextureFrameF > 5 Then
		BumpTextureFrameF = 0
		BumpTextureFrame = BumpTextureFrame + 1
		If BumpTextureFrame > 31 Then
			BumpTextureFrame = 0
		End If
		
	End If
	
	EntityTexture mesh_agua[0], BumpTexture, BumpTextureFrame, 0
	
	
	
End Function




Santiworld(Posted 2016) [#44]
is important this aspect for wave mesh 3D


you have a quad mesh (Plane)

you move the Y vertex (up and down) using sin(time..)

and if you MOVE the vertex horizontal, (vertexX) you simulate a soft surface of water.



x# = VertexX(surf_agua,v)
y# = 0;VertexY(surf_agua,v) 
z# = VertexZ(surf_agua,v)
				
For w = 1 To waves
	dir = w * 30
	y = y+Sin(dir+(z*waves*fdz+((x+waves)*fdy)+(wave_cicle)))* f_alt 
Next	
	
;! THIS IS THE HORIZONTAL VERTEX MOVEMENT!!!
x# = x + Cos((z*fdx)+MilliSecs()*f_vel)*.05





Santiworld(Posted 2016) [#45]
the problem, is very SLOW move big count of vertexs. in the Image you can see i have 30 FPS, very slow!


Guy Fawkes(Posted 2016) [#46]
o no problem, santi. I just wanted the water part of it. =)

~GF


Santiworld(Posted 2016) [#47]
Oka, i upload media textures tomorow
AAnd the to ccodeauncticreatefunctionr.


Guy Fawkes(Posted 2016) [#48]
Great, thanks Santi! =) I look forward to it!

Regards,

~GF


Santiworld(Posted 2016) [#49]
I Upload in code Archives my 3dwaves

http://www.blitzbasic.com/codearcs/codearcs.php?code=3281



im shure this code can be improved!!





Guy Fawkes(Posted 2016) [#50]
Nice, Santi world! =)

It would be nice if you could manipulate the vertices instead of loading a texture! =)

~GF