Aaron Symons Posted February 22, 2015 Share Posted February 22, 2015 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! Quote Win7 64-bit | Intel i7-3770 3.40GHz | NVIDIA GeForce GTX 660 Link to comment Share on other sites More sharing options...
IgorBgz90 Posted February 22, 2015 Share Posted February 22, 2015 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 crashing). Update: GLSL documentation: https://www.opengl.org/sdk/docs/man4/html/ Good Luck! Quote Link to comment Share on other sites More sharing options...
Rastar Posted February 22, 2015 Share Posted February 22, 2015 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! Quote Link to comment Share on other sites More sharing options...
Aaron Symons Posted February 22, 2015 Author Share Posted February 22, 2015 Thanks for giving me a good starting point guys. I'll look into the links you've given me and certainly do as you suggest. Quote Win7 64-bit | Intel i7-3770 3.40GHz | NVIDIA GeForce GTX 660 Link to comment Share on other sites More sharing options...
shadmar Posted February 22, 2015 Share Posted February 22, 2015 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. 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Aaron Symons Posted February 22, 2015 Author Share Posted February 22, 2015 @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. Quote Win7 64-bit | Intel i7-3770 3.40GHz | NVIDIA GeForce GTX 660 Link to comment Share on other sites More sharing options...
Recommended Posts
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.