Dreikblack Posted May 22 Share Posted May 22 Model just became invisible with it. What am i doing wrong? #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -4); //Create a light auto light = CreateBoxLight(world); light->SetRotation(45, 35, 0); light->SetRange(-10, 10); light->SetColor(2); //Create a model auto model = CreateBox(world); model->SetColor(0, 0, 1, 0.5f); auto strippleMaterial = CreateMaterial(); ChangeDir(AppDir()); auto strippleShader = LoadShaderFamily("Shaders/Editor/Stipple.fam"); strippleMaterial->SetShaderFamily(strippleShader); model->SetMaterial(strippleMaterial); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; } Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 22 Share Posted May 22 I havn't looked at the stipple shader yet but maybe it should be a line mesh? Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted May 22 Solution Share Posted May 22 If you add this inside the shaderfamily structure in the file, it will behave like a standard shader: "root": "Shaders/PBR.fam" Note that this shader is not really line stippling, it just discards pixels in a grid pattern. 2 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...
Dreikblack Posted May 22 Author Share Posted May 22 Thanks! Will try do to so later. Looks like i was thinking about recently for 3D GUI elements (circle to show range for example) and noticed it in latest Workshop. Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted May 22 Author Share Posted May 22 How does discard work? Looks like it ignores any mesh, not only mesh with this shader Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 22 Share Posted May 22 Discard means the pixel is not being drawn to. I.e discarded or ignored. Maybe the shader needs to be applied to the mask section of the shader family as well? Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted May 22 Author Share Posted May 22 8 minutes ago, SpiderPig said: Maybe the shader needs to be applied to the mask section of the shader family as well? Same result. Not sure if i did it right tho { "shaderfamily": { "root": "Shaders/PBR.fam", "static": { "float": { "opaque": { "default": { "base": { "vertex": "Shaders/PBR/PBR.vert", "fragment": "Shaders/Editor/Stipple.frag" } } }, "mask": { "default": { "base": { "vertex": "Shaders/PBR/PBR.vert", "fragment": "Shaders/Editor/Stipple.frag" } } } } } } } Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 22 Share Posted May 22 Hmm I'm not sure then. Josh will know. 😁 Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted May 22 Author Share Posted May 22 Made it work with strippleMaterial->SetTransparent(true); Quote Link to comment Share on other sites More sharing options...
Josh Posted May 22 Share Posted May 22 You could also use alpha masking, and define a fragment shader in the depth pass settings. 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...
Josh Posted May 22 Share Posted May 22 Keep in mind, if you have 45 degree lines they will hit some spots where they appear completely solid, and in some positions they will disappear, because it's a checker pattern. 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...
Dreikblack Posted May 22 Author Share Posted May 22 Yeah, with 3D camera it does not look good, especially while moving. SetLineStipple(LINE_STIPPLE_DASHED) was best when it was working before switching to OpenGL 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.