MoustafaChamli Posted May 25, 2014 Share Posted May 25, 2014 I used the GLSL export plugin from Blender in order to use with the game engine as a material, but I can't seem to use it properly. I tried following the information provided by the Leadwerks wiki, but I'm not a programmer, so I don't know how to properly call the .vert and .frag files into Leadwerks. Any indication of what to do would be greatly appreciated! http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Game_Engine/Export_GLSL Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted May 26, 2014 Share Posted May 26, 2014 Shaders created in a program aren't directly one on one compatible with other software. The same goes for Leadwerks. What effect are you trying to achive? Quote Link to comment Share on other sites More sharing options...
MoustafaChamli Posted May 26, 2014 Author Share Posted May 26, 2014 Non-photorealistic shading. This is a real-time render taken directly in Blender: I can also provide the .vert and .frag files if that helps. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted May 28, 2014 Share Posted May 28, 2014 I would be interested in having such cartoon shader in LE3.1. Actually LE3.1 only have fullscreen toon shader, but don't have per model and such cartoon effect is missing. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
shadmar Posted May 29, 2014 Share Posted May 29, 2014 How does the exported .frag look like? Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
MoustafaChamli Posted June 2, 2014 Author Share Posted June 2, 2014 Here's what I currently have. It likely has a lot of cruft in there, so any advice as to what to remove would be appreciated: http://pastebin.com/x1H6G9WW Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 2, 2014 Share Posted June 2, 2014 holy **** that is messy. They export every function for everything. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
MoustafaChamli Posted June 6, 2014 Author Share Posted June 6, 2014 It's from an add-on script. And seeing the length of the script really made me think there was a lot of cruft in there. Is there something specific I can take from the .frag to make it more manageable? Quote Link to comment Share on other sites More sharing options...
YouGroove Posted June 8, 2014 Share Posted June 8, 2014 Better convert a general cartoon shader code tutorial to LE3 than try converting specific shader code made for Blender i think. A very good tutorial : http://digitalerr0r.wordpress.com/2009/03/22/xna-shader-programming-tutorial-7-toon-shading/ What is great is that it uses a gradient map, so you could really customize your shader with few to lot of tones shading : Another tutorial , seems good also ? http://rbwhitaker.wikidot.com/toon-shader Quote Stop toying and make games Link to comment Share on other sites More sharing options...
MoustafaChamli Posted June 10, 2014 Author Share Posted June 10, 2014 I'm trying to get an understanding as to how I would go about to do this, but it would seem the documentation for this is either sparse, or outdated. I don't seem to find any shaders.pak file, and there's no indication as to how I'm supposed to use a .vert and .frag file to get a Leadwerks compatible shader. Please note that I'm essentially doing this to assist our programmer. My actual skills are still in the early stages, so not knowing where what goes in which directory/file is a bit problematic. Even just a base "put file in this directory and compile" would be a good start. Thanks. Quote Link to comment Share on other sites More sharing options...
Ma-Shell Posted June 10, 2014 Share Posted June 10, 2014 LE3 doesn't use the shaders.pak any more. Instead there should be a "Shaders" folder somewhere (most likely on top-level) in your project folder. Each material uses only one shader (and one for shadows), which includes the vertex- AND the fragment-shader in a single .shader - file. As far as I understand, you have to annotate, where the vertex-shader starts using @OpenGL2.Vertex (Just use the minimum OpenGL-version, your shader is compatible to.) And your fragment-shader should start with @OpenGL2.Fragment (Don't know if this is sufficient. Just have a look at one of the example-shaders in that folder.) Then in the editor you create a material and assign the shader. (Compiling of the shader is done while loading) Quote Link to comment Share on other sites More sharing options...
MoustafaChamli Posted July 14, 2014 Author Share Posted July 14, 2014 It got me started in the right direction. It would seem Leadwerks mostly looks at the @OpenGL4.vertex and @OpenGL4.fragment sections, so I'll fiddle with those. Quote Link to comment Share on other sites More sharing options...
Rastar Posted July 14, 2014 Share Posted July 14, 2014 If you open those files inside Leadwerks, it will parse them and correctly categorize the shader parts (vertex, fragment etc) Quote Link to comment Share on other sites More sharing options...
MoustafaChamli Posted July 17, 2014 Author Share Posted July 17, 2014 If you open those files inside Leadwerks, it will parse them and correctly categorize the shader parts (vertex, fragment etc) I've tried that, and it wouldn't read them correctly. But now that I'm a bit more familiar with how it works, I'll try again to see the results, and what needs to be corrected. Quote Link to comment Share on other sites More sharing options...
MoustafaChamli Posted July 20, 2014 Author Share Posted July 20, 2014 I'm getting a better grasp at GLSL overall, and it would seem I'd need to update the code to work with OpenGL4 as it seems Blender mostly uses OpenGL2.1 Getting a 3.3 and OGL2.1 fallback would be great overall, to be quite honest. I know Josh is working on a OGL3.3 fallback, so there's that. Quote Link to comment Share on other sites More sharing options...
MexSource Posted July 21, 2014 Share Posted July 21, 2014 But i think Josh is only working on a 3.3 fallback for Intel and Linux, because Intel hasn't managed to get opengl 4 to work on their graphic cards on Linux. Quote C++ :3 Link to comment Share on other sites More sharing options...
MoustafaChamli Posted July 23, 2014 Author Share Posted July 23, 2014 Actually, initial OGL4 support is arriving on Linux, although it might take some time before most distros adopt it (http://www.phoronix.com/scan.php?page=news_item&px=MTcyNzI) That said, I'm getting close to a working solution, having looked around the web for some guides. Right now, I'm mostly stuck with an invalid operand on line 88 of the fragment code. Here's a link to the Fragment: http://pastebin.com/nDtDFnLx I figure that if I can get this, I should be able to get a working "toon" shader for the game. Just note that there are a lot of commented functions, as I'm still messing around with the code. Quote Link to comment Share on other sites More sharing options...
shadmar Posted July 23, 2014 Share Posted July 23, 2014 You have to sample the textures before they are usable. So line 88 should read something like : vec4 outcolor = ambientmaterial + df * texture(texture0,ex_texcoords0) + sf * texture(texture2,ex_texcoords0); There is a toon shader ala borderlands style already with the game engine. (Post process). Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
MoustafaChamli Posted July 23, 2014 Author Share Posted July 23, 2014 That doesn't quite work, as this makes the model go completely black. I ended up doing this: vec3 color = ambientmat + df*ex_diffuse + sf*specmat; fragColor = vec4(color, 1.0) + texture(texture0,ex_texcoords) * 1.0; But that doesn't take into account the "toon" shading. I'll take a look at your code for the post-effects shader, see if I can use bits of it. I'm not looking for something that's like Borderlands (see screenshot above). Quote Link to comment Share on other sites More sharing options...
MoustafaChamli Posted August 22, 2014 Author Share Posted August 22, 2014 I think I managed to get something decently close to what I was looking for, using a combination of shader scripting, post-processing, and general illumination. It's not quite what I had in Blender but it'll do for now. Quote 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.