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 / Evolved Water Shader

Author
Message
Fireotter
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location:
Posted: 6th Mar 2011 23:05
Hey, I'm having some problems with one of the Evolved water shaders, it works fine most of the time, but there are times where it just distorts horribly, or when objects in front of it bleed into the texture.

Image attached of one of the problems

I'm kinda new here, so there may be something I've just overlooked



Here's all the code minus some random object placements




What am I doing wrong?[img]null[/img]
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 7th Mar 2011 12:38
That looks like you aren't setting the camera clip for the refraction cameras.
Maybe adding this command into the loop when creating your cameras:





Fireotter
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location:
Posted: 7th Mar 2011 20:56
That made no noticeable effect, the same issues still occur
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Mar 2011 23:11
I've had problems with the set camera clip command before and had to do the clipping manually in the shader. Have you tried the other shader option in the command? I think I tried that but had the same problem.

One option is to hide/show objects that are above/below the water as appropriate. However, you need true clipping for objects that are partly submerged.
Fireotter
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location:
Posted: 9th Mar 2011 02:50
Other shader options still cause the same problem or worse

How would I do clipping manually in the shader? I'm not very familiar with shaders, as this is my first time using them. I tried clipping them manually via hiding them during the calculations, and it worked fine, except, as you said, when the object is partially submerged.

The clipping actually occurs in the two functions "Refraction update" and "Reflection update" if that helps.

Still pulling out my hair over this issue, as I just can't seem to solve it
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 9th Mar 2011 13:07
I see three missing commands in your code that might cause the tearing.
There's no 'sync on', no 'sync rate 60', and no 'set camera range 1, 100000' in your code.
Other than that, your code seems fine.

Cheers

SLAYER RULES! YEAH, MAN!!
Fireotter
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location:
Posted: 11th Mar 2011 00:59
Sync on, sync rate are both at the very beginning of my code, I just forgot to add it, the set camera range 1 is in the list of code setting up the 2 main camera's.

Can anyone help me out here? I just can't figure out what's wrong with it, my code is exactly the same as the evolved example. The only difference is my scene is probably significantly smaller. I have noticed that if the object is far enough away from the water, the bleeding effect doesn't occur.

Fireotter
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 13th Mar 2011 02:14
Quote: "the set camera range 1 is in the list of code setting up the 2 main camera's."

You should also set the camera range for camera 1 before the do/loop code, and not only in the 'MakeWater' function.

Maybe it would be a good idea to upload your code and the models so we can have a proper look.

Cheers

SLAYER RULES! YEAH, MAN!!
Fireotter
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location:
Posted: 13th Mar 2011 15:27
Thanks everyone for the help, it turns out if i just scaled everything by 10000% the entire problem went away, so I guess my objects were just too small and close to the water for the effect to work.

Login to post a reply

Server time is: 2026-07-17 14:00:01
Your offset time is: 2026-07-17 14:00:01