gamecreator Posted June 28, 2015 Share Posted June 28, 2015 Do shadmar's shaders work properly with the release version? I'm having trouble getting them to work properly outside of the editor. Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 28, 2015 Share Posted June 28, 2015 Maybe if you gave some actual information concerning the problem, someone could give advice on how to resolve instead of just guessing what the problem could be? Is it a particular shader effect thats not working? Is something not loading correctly? Maybe post a small demo showing the problem. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
gamecreator Posted June 28, 2015 Author Share Posted June 28, 2015 Edit: I created a new project and in it the shaders work. So I think I can figure this out. Thanks. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted June 29, 2015 Author Share Posted June 29, 2015 Found out what was causing it. camera->SetParent(controller_pivot, true); I have my camera parented to a controller pivot (to follow behind my character, in third person). As soon as I comment this code out, the shaders work. I can set the camera's position manually, of course, but is there a way to work around this? Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 29, 2015 Share Posted June 29, 2015 hmmm thats a weird one. What happens if you add the posteffects via code after you set its parent? Does it still not work? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
gamecreator Posted June 29, 2015 Author Share Posted June 29, 2015 Yeah. The parenting is done in the initial setup code. I have this in my main loop to turn the shaders off and on at will: if(window->KeyHit(Key::NumPad1)) camera->AddPostEffect("Shaders/PostEffects/00_Underwater+Caustics.lua"); if(window->KeyHit(Key::NumPad2)) camera->AddPostEffect("Shaders/PostEffects/04_pp_dof.lua"); if(window->KeyHit(Key::NumPad0)) camera->ClearPostEffects(); Works perfectly without the parenting. Mostly doesn't work with it set. Edit: so this may be something to do with the pivot. I'm altering my test code now too and there it works even with the pivot parenting. Bah. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted July 7, 2015 Author Share Posted July 7, 2015 Ok. I took the time to create a new project from scratch, new map and for a while the camera parenting and shaders worked fine. But somewhere after I put the camera into the player class, it stopped working. Not sure why. Again, if you comment out the SetParent, it works. Here's the project: http://www.mediafire.com/download/c88y8vof1382ara/ShaderTest.zip Thanks to anyone who can take a look. And in the effort of saving everyone time, here's what player.cpp looks like: #include "world.h" #include "player.h" using namespace Leadwerks; playerclass player[10]; void playerclass::think() { } void playerclass::initialize(float xx, float yy, int which) { x=xx, y=yy; controller = Pivot::Create(); model = Model::Load("Models/fir.mdl"); model->SetParent(controller, false); model->SetRotation(90, 180, 0, true); controller->SetShadowMode(Light::Dynamic); controller->SetPosition(xx, 12, yy, false); // Commented these out for now to make things easier to debug // controller->SetMass(1); // controller->SetPhysicsMode(Entity::CharacterPhysics); camera->SetPosition(xx, 17.5, yy-1.9, true); camera->SetRotation(10, 0, 0); // COMMENT THIS OUT TO GET SHADERS WORKING camera->SetParent(controller, true); } playerclass::playerclass() { x=0.0; y=0.0; speed=1.5; } Thanks! Quote Link to comment Share on other sites More sharing options...
cassius Posted July 7, 2015 Share Posted July 7, 2015 You can do a 3rd person camera without parenting. Just place the player in front of the camera in the main loop. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Josh Posted July 7, 2015 Share Posted July 7, 2015 I suspect the problem is one of his Lua-based effects. He's probably calling camera:GetPosition() and retrieving the local position instead of the global one, which will be different if the entity has a parent. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gamecreator Posted July 7, 2015 Author Share Posted July 7, 2015 Good thought Josh but if I do the camera pivot in App.cpp, it works fine. It's almost as if the pivot being inside a class breaks it (the camera is global). cassius, yeah, that's why I'm not too worried about this. It's just a little bizarre. Quote Link to comment Share on other sites More sharing options...
shadmar Posted July 7, 2015 Share Posted July 7, 2015 No post shaders were in your uploaded project so all failed to load. But I just copied some off another project. In underwater shader replace line 57: (your reflection camera scale doesn't seem to be 1 but 0.99999..) , and add (true) to getposition since your camera is parented: if camera:GetScale().y>.9 and camera:GetPosition(true).y <= height dof shader... replace line 20 (since your refl. cam doesn't have a scale of 1, why is that??): and camera:GetScale().y>.9 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
gamecreator Posted July 8, 2015 Author Share Posted July 8, 2015 No post shaders were in your uploaded project so all failed to load Seems Export doesn't include those. I don't even know how to set the reflection camera scale so I assume it's something Leadwerks did. Still, I appreciate you taking the time to take a look. Thank you. 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.