Jump to content

Shader Tutorials and Theories for LE


Aaron Symons
 Share

Recommended Posts

Hello,

 

I was just wondering if anyone can point me to any in-depth theories, practices, and tutorials for creating shaders for Leadwerks. I've spent a very short time dissecting some of the shaders that come with Leadwerks, but I don't fully understand how they work.

 

Thanks in advance!

Win7 64-bit | Intel i7-3770 3.40GHz | NVIDIA GeForce GTX 660

Link to comment
Share on other sites

Try starting with a simple. Visit the website: http://www.geeks3d.com/shader-library/ I recommend to take a shader of pixelation. Along the way, look into the source codes shaders, which are included in Leadwerks. Try, experiment in practice. The editor allows you to make mistakes. (And to be precise fix them without crashingsmile.png).

 

Update:

GLSL documentation: https://www.opengl.org/sdk/docs/man4/html/

 

Good Luck!

Link to comment
Share on other sites

Yes, start small and grow big. Begin with a pass-through shader that does nothing but transform coordinates and output color. Experiment with that. You might find this thread

 

http://www.leadwerks.com/werkspace/topic/8203-internal-shader-uniforms/page__hl__uniform

 

useful as it lists the uniforms (constants passed into the shader) that you need. Also, be aware that Leadwerks has a deferred renderer - many examples you might find online are for a forward renderer. The big difference being that in a forward shader you do the lighting calculations right away, whereas in deferred rendering you first write certain values into a so-called G-buffer, and Leadwerks does the lighting calculations afterwards in a separate pass.

 

The most important buffers you'll need in the beginning are fragData0 for the diffuse color and fragData1 for the normals.

 

Also, don't hesitate to ask here what exactly you don't understand about the inner workings of the Leadwerks shaders!

Link to comment
Share on other sites

Here is a quick start:

 

uniforms = values provided by application or engine (like Leadwerks), this usually what makes other shaders hard to use in Leadwerks since the naming here can be anything, everyone uses their own convension.

 

out = usually output from the vertex shader for input in fragment shader

in = input, usually from the vertex shader

 

cameramatrix = viewmatrix in other shader references

camerainversematrix = inverseviewmatrix in other references.

projectioncameramatrix = viewprojectionmatrix, MVP, has several names used around.

  • Like 1

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

@shadmar Thanks for the info! :)

 

Is there any documentation on the Leadwerks 3.x shader convension, as I can't see any? The most useful documentation I've always found has been LE 2.x (I think), where the likes of TVec types are used - very old.

 

I'd love to know how you did your

, as this has always been of interest to me since I first saw it in a game. I'm sure there are many different ways of going about it (I can think of a few ideas), but using a shader is most intriguing to me. :P

Win7 64-bit | Intel i7-3770 3.40GHz | NVIDIA GeForce GTX 660

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