Jump to content

SpiderPig

Developers
  • Posts

    2,272
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. To test it I did this. ambient_occulsion is 1.0f by default. #ifdef MATERIAL_METALLICROUGHNESS //-------------------------------------------------------------------------- // Metallic roughness //-------------------------------------------------------------------------- materialInfo.metallic = material.metalnessRoughness.r; materialInfo.perceptualRoughness = material.metalnessRoughness.g; if (material.textureHandle[TEXTURE_METALLICROUGHNESS] != uvec2(0)) { // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel. // This layout intentionally reserves the 'r' channel for (optional) occlusion map data vec4 mrSample = texture(sampler2D(material.textureHandle[TEXTURE_METALLICROUGHNESS]), texcoords.xy); ambient_occlusion = mrSample.r; materialInfo.metallic *= mrSample.b; materialInfo.perceptualRoughness *= mrSample.g; } materialInfo.perceptualRoughness = clamp(materialInfo.perceptualRoughness, 0.0f, 1.0f); materialInfo.metallic = clamp(materialInfo.metallic, 0.0f, 1.0f); // Achromatic f0 based on IOR. materialInfo.c_diff = mix(materialInfo.baseColor.rgb, vec3(0.0f), materialInfo.metallic); materialInfo.f0 = mix(materialInfo.f0, materialInfo.baseColor.rgb, materialInfo.metallic); #endif I only use it if there is no AO map specified. if (material.textureHandle[TEXTURE_AMBIENTOCCLUSION] != uvec2(0)) { float ao = texture(sampler2D(material.textureHandle[TEXTURE_AMBIENTOCCLUSION]), texcoords.xy).r; f_diffuse *= ao; // apply ambient occlusion to all lighting that is not punctual f_specular *=ao; f_sheen *= ao; f_clearcoat *= ao; } else{ f_diffuse *= ambient_occlusion; f_specular *= ambient_occlusion; f_sheen *= ambient_occlusion; f_clearcoat *= ambient_occlusion; }
  2. As per the workflow here I've create a AO_ROUGH_METAL map with AO in the red channel but it appears to not be showing up on the model when rendered. Looking at the PBR/Fragment.glsl shader it looks like AO is only being loaded from it's own dedicated slot. Is this intentional or can t be revised to use the red channel of the same texture that metal & roughness are in? if (material.textureHandle[TEXTURE_AMBIENTOCCLUSION] != uvec2(0)) { float ao = texture(sampler2D(material.textureHandle[TEXTURE_AMBIENTOCCLUSION]), texcoords.xy).r; f_diffuse *= ao; // apply ambient occlusion to all lighting that is not punctual f_specular *=ao; f_sheen *= ao; f_clearcoat *= ao; }
  3. SpiderPig

    fog settings

    Looks amazing.
  4. This is working fine now with build 611.
  5. There is still some issues. Project is up to date. I've attached the map I used as well as the updated files. Extract the pine tree to the Models folder. As you move the camera away the billboard stage has no material applied. Yet if you drag LOD3 into the scene it does and it's shadow casting is correct, yet as part of the main model it is not correct. You'll also notice that changing the shadow casting of LOD3 only sometimes updates the editor straight away. Also, not saving a model will still save it. After a bit more playing around I'm finding changing the shadow casting of LOD3 is not even updating the editor at all no matter what I do. I think if you play around with the attached map you should find a few things not working like they should. Pine.zip PineLeaves_DIFF.zip
  6. This was a while ago, but I'll check again today.
  7. Thanks, I just figured it out. I just needed to add a line to an existing file. auto stream = OpenFile(path + "\\Game.log"); if (stream != nullptr) { auto pos = stream->GetSize(); stream->Seek(pos); stream->WriteLine(line.ToString()); stream->Close(); }
  8. Is there an AppendFile function or similar available?
  9. No banding in that map. Not in the editor or in game. I re-enabled shadows on that spotlight and there's banding in editor and game.
  10. I'll make an example for you. 🙂
  11. If I create a mesh with MESH_LINES is there a variable in the shaders that can make that line thicker? Much like gl_PointSize? I tried glLineWIdth but I'm not sure if it can be done in the fragment shader... maybe I need the vertex shader...
  12. Notepad++. Do you think that matters?
  13. That frag shader file? Just a text editor.
  14. Okay. Here's a better example then. No Interface, just a rotating sprite. I'd want to have MSAA working for a camera that renders sprites or any other 3D object on top of a 3D scene. #include "Engine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0]); //Create framebuffer auto framebuffer = CreateFramebuffer(window); //Create world auto world = CreateWorld(); //Create main camera auto camera = CreateCamera(world); camera->SetPosition(0, 0, -3); //Create a model auto box = CreateBox(world); //Create a light auto light = CreateBoxLight(world); light->SetRange(-5, 5); light->SetRotation(34, 45, 0); //Create camera auto orthocamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); orthocamera->SetMSAA(4); orthocamera->SetClearMode(CLEAR_DEPTH); orthocamera->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0); orthocamera->SetRenderLayers(2); auto sprite = CreateSprite(world, 64, 64); sprite->SetRenderLayers(2); sprite->SetPosition(256, 256); while (true) { box->Turn(0, 1, 0); sprite->Turn(0, 0, 0.25); world->Update(); world->Render(framebuffer); } return 0; }
  15. The 3D scene vanishes in this example with MSAA enabled. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0]); //Create framebuffer auto framebuffer = CreateFramebuffer(window); //Create world auto world = CreateWorld(); //Create main camera auto camera = CreateCamera(world); camera->SetPosition(0, 0, -3); //Create a model auto box = CreateBox(world); //Create a light auto light = CreateBoxLight(world); light->SetRange(-5, 5); light->SetRotation(34, 45, 0); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface with a semi-transparent background auto ui = CreateInterface(world, font, framebuffer->size); ui->background->SetColor(0, 0, 0, 0.5); //Create widget iVec2 sz = ui->background->ClientSize(); auto button = CreateButton("Button", sz.x / 2 - 75, sz.y / 2 - 15, 150, 30, ui->background); //Create camera auto orthocamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); orthocamera->SetMSAA(4); orthocamera->SetClearMode(CLEAR_DEPTH); orthocamera->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0); //UI will only appear in orthographic camera orthocamera->SetRenderLayers(2); ui->SetRenderLayers(2); auto sprite = CreateSprite(world, 64, 64); sprite->SetRenderLayers(2); sprite->SetPosition(256, 256); while (true) { box->Turn(0, 1, 0); sprite->Turn(0, 0, 0.25); while (PeekEvent()) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; default: ui->ProcessEvent(ev); break; } } world->Update(); world->Render(framebuffer); } return 0; }
  16. DynamicLine.zip I've only noticed these things since the OpenGL build. It could be because now there are compile times involved. If you edit the attached frag file, it loads it twice and the changes are not applied. This is the console output after a single edit of DynamicLine.frag. If you change the color in the attached frag shader you'll see this in the console but the box will not change color. Loading shader module "Materials/DynamicLine/DynamicLine.frag" Loading shader module "Materials/DynamicLine/DynamicLine.frag" If you edit the material, all changes are applied but it still loads it twice. Deleting shader family "Materials/DynamicLine/DynamicLine.fam" Loading shader family "Materials/DynamicLine/DynamicLine.fam" Deleting shader family "Materials/DynamicLine/DynamicLine.fam" Loading shader family "Materials/DynamicLine/DynamicLine.fam" With some shaders I've seen it do it 4 times. It's annoying because as the files get bigger it takes longer to compile. #include "Engine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); world->SetGravity(0.0f, -2.0f, 0.0f); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -2); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); auto box = CreateBox(world); box->SetColor(0, 1, 0); auto mat = LoadMaterial("Materials\\DynamicLine\\DynamicLine.mat"); box->SetMaterial(mat); auto watcher = CreateFileSystemWatcher("Materials"); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { auto ev = WaitEvent(); if (ev.id == EVENT_FILECHANGE or ev.id == EVENT_FILECREATE) { //Look for a loaded asset with this file path auto asset = FindCachedAsset(ev.text); if (asset) { asset->Reload(); } } } box->Turn(0.0f, 0.1f, 0.0f); world->Update(); world->Render(framebuffer); } return 0; }
  17. I might be wrong in what I'm seeing - but based on the console output it seems that loading this material is loading the PBR shader family as the root even though I've specified Unlit.fam as the root in DynamicLine.fam. Even if this output is correct, it's loading the PBR then deleting it, then loading it again. DynamicLine.zip #include "Engine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); world->SetGravity(0.0f, -2.0f, 0.0f); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -2); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); auto box = CreateBox(world); box->SetColor(0, 1, 0); auto mat = LoadMaterial("Materials\\DynamicLine\\DynamicLine.mat"); box->SetMaterial(mat); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  18. That's right. I've pretty much got that then. All I'd have to do is change the extension and add the missing data structures. Seeing as Blender doesn't support BC7 I was thinking of auto converting any png textures to the correct dds format on export with a small program made with ultra.
  19. Oh I do, but it only does static geometry right now. I don't know how hard animation will be.
  20. Can this please be looked asap, I can no longer package and update my game.
  21. I dare say it's not hard, its just time consuming. The main issue I had was finding out the right stuff to access in blender from python, but google was the answer there. There's also the Leadwerks mdl exporter for blender. Maybe that could be converted to suit this rather than starting again?
×
×
  • Create New...