Jump to content

Depth mode


havenphillip
 Share

Recommended Posts

I made this forcefield shader using the watermode depth buffer which works great. I replaced the Leadwerks water shader with this dummy shader:

//fragment

#version 400

//Uniforms
uniform sampler2D texture4;// depth

void main(void)
{    
    float depth = textureProj(texture4,vec3(1)).r;
}

//vertex

#version 400
#define MAX_INSTANCES 256

void main()
{

}

... and I used this script to turn on watermode and set the waterplane height:

function Script:Start()
    world = World:GetCurrent()
    world:SetWaterMode(true)
    world:SetWaterQuality(1)
end

function Script:UpdatePhysics()
    world:SetWaterHeight(3.0)
end

 

... everything works great and the shader works with post effects, which is something I couldn't get accomplished before, AND I'm getting excellent FPS. The problem is I lose the effect as soon as the water plane goes off camera. So I'm thinking if there is a way to create a "depth mode" which keeps the (invisible) water plane on camera at all times that would open up a nice little corner for using the depth buffer for things like a forcefield, water foam, water fog, ground fog, and soft particle falloff effects such as seen here:
http://blog.wolfire.com/2010/04/Soft-Particles




 

water in view.jpg

waterout of view.jpg

  • Like 2
Link to comment
Share on other sites

That's ok, man. I got the soft particle thing and the forcefield working using this method. The problem I was having was because I had other shaders in my scene using texture4 for something other than depth. They work perfectly now. I don't know why Josh wouldn't just set up a "depth mode" as  a permanent thing so that people could use depth buffers for cool stuff.  Leadwerks' aversion to shaders is self-defeating, imo.

  • Like 1
Link to comment
Share on other sites

Quote

I don't know why Josh wouldn't just 

Because he is completely concentrated on coming forward with Ultra engine.

We all (are/have) missing a few thing in the actually LE that could made the editor just top, but well.

Do you think about publishing your soft-Particles shader or make a tuto on this ?

  • Haha 1

 

 

Link to comment
Share on other sites

There are still people (I am one of them ^^) who still work with LE4.6 and try to build something / finish what they began

I spent hours learning how to use it and I made progress in building a game, so that I want to finish it.

And there is the very positive argument that the actual version 4.6 works stable and it will need a looooong time until  the new baby Ultra keeps a way without updates required. 

So I enjoy working with 4.6 

  • Like 1

 

 

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

 Share

×
×
  • Create New...