Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Per-vertex displacement for LE4?

Recommended Posts

I wish I knew shaders well enough to make something like that. I messed with the tesselation shader and found some geometry shaders but I can't see how to take care of those cracks in the seams. If you integrated this into Leadwerks 4 and sold it as an add-on I'd buy it. 20 bucks. These texture editors make your heightmaps look cool but then you bring it to Leadwerks and you lose a little bit in translation.

Then again, it  might serve better strictly as a selling point for LE5. Sounds like you got some ground-breaking stuff going on over there.

Either way Turbo look great. Two thumbs up.

  • Like 1
Link to post

Dude, how do I get the seams? and then use vertex alpha to control the displacement? What is it? Like length(texcoords) or something? Do you have a code example or even a shader you'd be wiliing to impart? Or a webpage or tutorial somewhere that shows an example? That would be awesome.

I learned how to displace but after reading your article I just assumed you needed "per-vertex" which I thought meant you have to subdivide. I've been scouring the internet for geometry shader examples for subdivision and tesselation shaders.

I imagine the new engine will be much faster, and therefore better for this kind of thing, but I'm still trying to wrap my head around LE4.

Link to post

Hey Josh I know you're busy and I keep bugging you with this but could you explain real quick how I get the seams so I can disable displacement on them. I've been looking everywhere and can't seem to find the answer. This is my displacement code:

    //Vertex displacement
    vec4 height = texture(texture3,ex_texcoords0);
    float offset = (height.r + height.g + height.b)*0.025;
    vec4 newPos = vec4(modelvertexposition.xyz + vNormal* offset,1.0);

    if (height.r > 0.5) {        
        gl_Position = projectioncameramatrix * newPos;

Link to post
  • 2 months later...

There is a Mesh::UpdateEdges() method (Leadwerks 5) that will attempt to find them and set vertex displacement based on that. I don't think you can do this in the vertex shader.

  • Like 1
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

Facebook Twitter Youtube Github Steam
  • Create New...