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 / Water affects and terrain detection

Author
Message
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 15th Nov 2010 05:47 Edited at: 25th Jan 2011 04:41
Hey everybody! I was wondering how you would create a water affect, both from above and submerged. The other terrain thing i was wondering was how do you know how high the character should be so it sits right on top of the terrain? Is there some formula to calculate it with, or do you use a collision detection function or what? Any help appreciated!

Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile way and you have their shoes. ~Author Unknown
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 15th Nov 2010 15:03 Edited at: 15th Nov 2010 15:17
The best way is using shaders.

Evolved has an excellent set of shaders for this free on his site at http://www.evolved-software.com/

Here they are in all their glory:
http://www.youtube.com/watch?v=F8t_vCL4jag

By 'best' I mean 'most realistic'. There are much more efficient ways to do a similar effect without the heavy drain on your PC. Ghosting textured planes is one way.

Quote: "The other terrain thing i was wondering was how do you know how high the character should be so it sits right on top of the terrain? Is there some formula to calculate it with, or do you use a collision detection function or what?"

If you are using terrains you can use the "terrain height" command, I prefer to use collision though. I use sparky's collision dll (highly recommended for any collision detection) something like this:


Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 15th Nov 2010 23:05
Thanks!

check my youtube channel at http://www.youtube.com/user/freeflightsimulator
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 16th Nov 2010 01:31
Are there any code snippets to use that require no dlls or plugins or similar?

check my youtube channel at http://www.youtube.com/user/freeflightsimulator
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 16th Nov 2010 09:53
"Terrain height" is a native command but really if you are even considering using raycasting or another form of collision detection sparky's is accurate, quick and free.

I started using it when I found errors using the native collision commands and have never looked back. Up to you of course.

Using shaders is something (for water at least) well worth learning about too.

Have you got some code we could write a snippet for? A lot depends on how you are setting up your terrain and character.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 16th Nov 2010 16:28
Here is another example for making water:
http://forum.thegamecreators.com/?m=forum_view&t=174821&b=6

The code snippets forum is pretty good for this kind of stuff, I recommend you take a look.

Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 17th Nov 2010 00:31
Thanks for the links and thingys!

check my youtube channel at http://www.youtube.com/user/freeflightsimulator
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 17th Nov 2010 00:42
Oh, not any code right now, i was making a polar themed game, and it would involve getting in and out of water... Also one other question:
if i wanted to get an underwater affect, how would i do that?

check my youtube channel at http://www.youtube.com/user/freeflightsimulator
Mugen Wizardry
User Banned
Posted: 17th Nov 2010 00:43
you use set camera fov for an accurate 'fisheye' effect ^^

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 17th Nov 2010 03:14


check my youtube channel at http://www.youtube.com/user/freeflightsimulator
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Nov 2010 09:28
Also you could use the "heat haze shader" by sixty squares here:
http://forum.thegamecreators.com/?m=forum_view&t=175042&b=1

If you inverted a sphere and applied the shader to it, then constantly set the position of the sphere to the same as your camera you could have something pretty good!

I would set the size of the sphere to just slightly larger than the start of your camera range and don't change the rotation of the sphere.

You can invert a sphere like this:


Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 18th Nov 2010 02:29
Thanks! I will try!

check my youtube channel at http://www.youtube.com/user/freeflightsimulator

Login to post a reply

Server time is: 2026-07-21 18:58:22
Your offset time is: 2026-07-21 18:58:22