Jump to content
havenphillip

Per-vertex displacement for LE4?

Recommended Posts

It would be possible to write a tessellation shader based on the content of the LE5 shaders.

  • Like 2

Share this post


Link to post

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.

Share this post


Link to post

The way I get rid of cracks is by disabling displacement along seams.

The new engine uses a per-vertex displacement value but you could use the vertex alpha to control the displacement amount.

Share this post


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.

Share this post


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;
    }
    //-------------------------------------------------------------------

Share this post


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.

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.

×
×
  • Create New...