Jump to content

SpiderPig

Developers
  • Posts

    2,272
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. As discussed bender has some issues with converting FBX to GLTF. What would be nice is to have a feature in the Model Editor that allows us to add the animations from another model onto the current model. Mixamo (as far as I know) only exports one animation per FBX file. SO using that means we could have a few dozen models of the same thing with different animations. Currently the only way to merge them is through blender or some other software.
  2. After some discussion with @Andy90 there is another problem that I'm not sure has been raised yet... so here it is. This FBX has been exported from Mixamo. If you drag it into a folder in the editor it will convert perfectly. If you open the GLTF in the asset editor the animation is present and working, however if you then save the model from the asset editor you get a notification that says it has "animations that won't be saved". So you can only save the model if you don't want to keep the animation. V0.9.4 BTW Walk Forward.zip
  3. This is 0.9.4 by the way... Happens in 0.9.5 too.
  4. I was creating the file with a buffer but changed to WriteFile but it still throws an error in LoadModel and crashes the application. This is how I'm creating the model file. void SaveModel(WString filepath, shared_ptr<Model> model) { auto version = 1; auto file = WriteFile(filepath); auto total_lods = model->lods.size(); file->WriteInt(version); file->WriteInt(total_lods); for (auto lod_index = 0; lod_index < total_lods; lod_index++) { auto total_meshes = model->lods[lod_index]->meshes.size(); file->WriteInt(total_meshes); for (auto mesh_index = 0; mesh_index < total_meshes; mesh_index++) { auto mesh = model->lods[lod_index]->meshes[mesh_index]; auto total_vertices = mesh->CountVertices(); auto total_indices = mesh->CountPrimitives(); //Save Vertices file->WriteInt(total_vertices); for (auto vert_index = 0; vert_index < total_vertices; vert_index++) { auto vertex_position = mesh->GetVertexPosition(vert_index); auto vertex_normal = mesh->GetVertexNormal(vert_index); auto vertex_texcoords = mesh->GetVertexTexCoords(vert_index); file->WriteFloat(vertex_position.x); file->WriteFloat(vertex_position.y); file->WriteFloat(vertex_position.z); file->WriteFloat(vertex_normal.x); file->WriteFloat(vertex_normal.y); file->WriteFloat(vertex_normal.z); file->WriteFloat(vertex_texcoords.x); file->WriteFloat(vertex_texcoords.y); } //Save Indices file->WriteInt(total_indices); for (auto indice_index = 0; indice_index < total_indices; indice_index++) { auto v0 = mesh->GetPrimitiveVertex(indice_index, 0); auto v1 = mesh->GetPrimitiveVertex(indice_index, 1); auto v2 = mesh->GetPrimitiveVertex(indice_index, 2); file->WriteInt(v0); file->WriteInt(v1); file->WriteInt(v2); } } } file->Close(); }
  5. I'm working on my own model format with a plugin, and with or without the plugin loaded I get the error - "Seek position outside of file bounds". If you try loading this file as a model it should return null if it does not recognise shouldn't it? LoadModel("Test.uga"); Test.zip
  6. I would have use for these as well. Also BEFORE_PHYSICS_UPDATE & AFTER_PHYSICS_UPDATE would be good.
  7. They are, I was more wondering if it should print an actual error when it failed to load. 🙂
  8. Used some old code today and loading a non-existent shader family with the .json extension printed this output... Loading shader family "Shaders/Unlit.json" Deleting shader family "Shaders/Unlit.json" Should it be more like this so we know it actually failed? Error : Failed to load shader family "Shaders/Unlit.json"
  9. Not positive if this is a bug to be honest and if it is it may well be fixed in the next update, but just in case - In my game rotating the directional light to mimic the sun causes the vertex, polygon and instance count to slowly ramp up to about 20x then it will slowly decrease and then ramp up again. (I have 1.2 million verts in my game and it can get up to 30million before repeating the cycle) The code below shows the stats fluctuating in the window title albeit at a lesser extent than in my game. Should the vertex, polygon and instance counts fluctuate with a moving / rotating light source? And by that much? #include "Engine.h" #include "ComponentSystem.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 world = CreateWorld(); world->RecordStats(); auto framebuffer = CreateFramebuffer(window); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(10, 10, -8); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); auto floor = CreateBox(world, 128); floor->Move(0, -64, 0); vector<shared_ptr<Entity>> boxes; for (int z = 0; z < 25; z++) { for (int x = 0; x < 25; x++) { auto e = CreateSphere(world); e->SetPosition(x, 0.0f, z, true); boxes.push_back(e); } } while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { Vec3 day_speed = Vec3(0.5, 0, 0); light->Turn(day_speed.x, day_speed.y, day_speed.z); auto stats = world->renderstats; WString text = "FPS : [" + WString(stats.framerate) + "] - "; text += "Verts : [" + WString(stats.vertices) + "] - "; text += "Polys : [" + WString(stats.polygons) + "] - "; text += "Insts : [" + WString(stats.instances) + "] - "; text += "Shadow Polys : [" + WString(stats.shadowpolygons) + "]"; window->SetText(text); world->Update(); world->Render(framebuffer, false); } return 0; }
  10. Nice! Shader toy has some good shaders. 🙂
  11. There is a CurrentTime variable in UniformBlocks.glsl that you can use.
  12. Foliage volume fills the terrain nicely. It needs more work but I'll leave that for now though and start getting the UI back together and working.
  13. Heightmaps are applied and look really good. There needs to be more work done on blending the heights together, but for an Alpha this is fine.
  14. Finally got normal mapping working correctly. I'm using debugging heightmaps to identify each world and the square in the top left of each map tells me what the coordinate system should be for that world. I love it how the edges of each map blend nicely together with no extra work other than just normals. Next steps; Fix tangent & bitangent maps Re-apply heightmaps and generate rocky heights for the borders between worlds Apply gravity maps & get physics working again Generate biomes according to heightmap stamps used After all that I can finally start working on gameplay again.
  15. Once again simply posting has helped solve the problem... This is not the correct order to multiply matrices in. localVertPos *= inverse(projectionMatrix); localVertPos *= inverse(entityMatrix); This is. localVertPos = inverse(projectionMatrix) * localVertPos; localVertPos = inverse(entityMatrix) * localVertPos; And the other issue of points all appearing in the centre of the mesh. Both vertex and geometry shaders need to be in the mask section of a shader family.
  16. I have officially been driven mad by this issue over the last few days. Something I've had working in the past and thought I understood now doesn't want to behave. Here's a simplified example. I'll be creating vertices in the geometry shader and those new positions will need multiplying by the model and projection matrices. But I'm getting mixed result of vertices flying off screen and sometimes only one vertex in the centre of the model. I know I'm doing something wrong. Here I'm applying the shader to a grid made with CreatePlane and 8 x & y segments. It should be a flat grid of points but the code below makes them fly around with the camera, this is just one shot were they were in view. Even when I pass the entity matrix, projection matrix and raw vertex position as an output to the geometry shader I can't get it to work. I'm sure a quick discussion with guys will help resolve this. Geometry Shader Code. #version 450 #extension GL_GOOGLE_include_directive : enable #extension GL_ARB_separate_shader_objects : enable #extension GL_EXT_multiview : enable layout ( triangles ) in; layout ( points , max_vertices = 1 ) out; layout(location = 9 ) in flat uint inFlags[]; layout(location = 25 ) in flat uint inEntityindex[]; layout(location = 2 ) in vec4 inTexCoords[]; layout(location = 3 ) in vec3 inTangent[]; layout(location = 4 ) in vec3 inBitangent[]; layout(location = 5 ) in flat uint inMaterialIndex[]; layout(location = 0 ) in vec4 inColor[]; layout(location = 6 ) in vec4 inVertexCameraPosition[]; layout(location = 23 ) in vec3 inScreenvelocity[]; layout(location = 1 ) in vec3 inNormal[]; layout(location = 7 ) in vec4 inVertexWorldPosition[]; layout(location = 17 ) in vec4 inVertexPosition[]; layout(location = 9 ) out flat uint outFlags; layout(location = 25 ) out flat uint outEntityindex; layout(location = 2 ) out vec4 outTexCoords; layout(location = 3 ) out vec3 outTangent; layout(location = 4 ) out vec3 outBitangent; layout(location = 5 ) out flat uint outMaterialIndex; layout(location = 0 ) out vec4 outColor; layout(location = 6 ) out vec4 outVertexCameraPosition; layout(location = 23 ) out vec3 outScreenvelocity; layout(location = 1 ) out vec3 outNormal; layout(location = 7 ) out vec4 outVertexWorldPosition; layout(location = 17 ) out vec4 outVertexPosition; #include "../../../../../../../../UltraEngine/Templates/Common/Source/Shaders/Base/EntityInfo.glsl" #include "../../../../../../../../UltraEngine/Templates/Common/Source/Shaders/Base/CameraInfo.glsl" void main() { //This works, only the first vertex of every triangle should make a point and it does just that /*for (int vertex_id = 0; vertex_id < 1; vertex_id++) { gl_Position = gl_in[vertex_id].gl_Position; gl_PointSize = 4.0f; outFlags = inFlags[vertex_id]; outEntityindex = inEntityindex[vertex_id]; outTexCoords = inTexCoords[vertex_id]; outTangent = inTangent[vertex_id]; outBitangent = inBitangent[vertex_id]; outMaterialIndex = inMaterialIndex[vertex_id]; outColor = inColor[vertex_id]; outVertexCameraPosition = inVertexCameraPosition[vertex_id]; outScreenvelocity = inScreenvelocity[vertex_id]; outNormal = inNormal[vertex_id]; outVertexWorldPosition = inVertexWorldPosition[vertex_id]; outVertexPosition = inVertexPosition[vertex_id]; EmitVertex(); } EndPrimitive();*/ //Here I'm trying to prove that I can take a local vertex position and re-multiply it by the correct matrices //As f ar as I know to get the local vertex postion back I need to undo a few things first... //I actually don't know what the vertex 'w' component should be. I'm pretty sure it should be 1.0f... mat4 entityMatrix = ExtractEntityMatrix(inEntityindex[0]); mat4 projectionMatrix = ExtractCameraProjectionMatrix(CameraID, gl_ViewIndex); vec4 localVertPos = gl_in[0].gl_Position; localVertPos.z *= 2.0f; localVertPos.z -= localVertPos.w; localVertPos *= inverse(projectionMatrix); localVertPos *= inverse(entityMatrix); //This is what the vertex shader does as far as I can tell gl_Position = projectionMatrix * (entityMatrix * localVertPos); gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5f; gl_PointSize = 4.0f; EmitVertex(); EndPrimitive(); } DisplayNormals.zip
  17. Thanks for your input guys. I actually have the app id already - but I don't know how to make the page live with no download attached... is that as simple as publishing the page but not making a repo? (or what ever it's called, I forget) or do I make it coming soon page?
  18. Oh right. Just wanted to check. What do you think about the swept culling issue?
  19. In this shot the camera is very close to the terrain surface but you can see the patch hasn't updated to the highest LOD level. The terrain here has a y scale of 500. Do you need an example for this one?
  20. Does anyone have any thoughts on releasing an alpha version of my game on steam as a free download? I thought about uploading it to something like itch.io but I want to use and test some steam features too. I'm thinking I could develop the game while it's on steam, get some feedback etc. and then later turn that free download into the demo for the final game. I'm just wondering though if this is a good idea or if steam should be avoided until ready for early access phase. Mainly for things like reviews. But I'm curious to hear your thoughts.
  21. So the max instance count is about 65k but does that include things like sub-passes and meshes? I mean can we have 65,000 instanced cubes or with 2 sub-passes are we limited to only 32,000 cubes? Also, with your Instanced geometry benchmark code, I've added in swept culling and a few more cubes. Even with swept culling enabled it doesn't make much difference. In my game I only have a few thousand instances and it doesn't hep much there either. Can I turn off culling for particular objects or all of them? I'd like to test the performance of both options. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { const int count = 32; RegisterComponents(); //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Instanced Geometry", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create framebuffer auto framebuffer = CreateFramebuffer(window); //Create world auto world = CreateWorld(); //Create camera auto camera = CreateCamera(world); camera->SetPosition(0, 0, -count * 2); camera->SetClearColor(0.125); camera->SetDepthPrepass(false); camera->AddComponent<CameraControls>(); camera->SetSweptCulling(true); camera->SetOcclusionCullingMode(false); //Create box auto box = CreateBox(world); box->SetCollider(NULL); auto mtl = CreateMaterial(); mtl->SetColor(0.5f); mtl->SetShaderFamily(LoadShaderFamily("Shaders/Unlit.fam")); box->SetMaterial(mtl); //Create instances std::vector<shared_ptr<Entity> > boxes; boxes.reserve(count * count * count); int x, y, z; for (x = 0; x < 32; ++x) { for (y = 0; y < 32; ++y) { for (z = 0; z < 64; ++z) { auto inst = box->Instantiate(world); inst->SetPosition(3.0f + float(x - 1 - (count / 2)) * 2, 3.0f + float(y - 1 - (count / 2)) * 2, 3.0f + float(z - 1 - (count / 2)) * 2); boxes.push_back(inst); } } } box = NULL; //Fps display auto font = LoadFont("Fonts/arial.ttf"); auto sprite = CreateSprite(world, font, "", 14); world->RecordStats(true); sprite->SetRenderLayers(2); sprite->SetPosition(2, framebuffer->size.y - font->GetHeight(14) - 2, 0); auto orthocam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); orthocam->SetRenderLayers(2); orthocam->SetClearMode(ClearMode(0)); orthocam->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { //Check for failed renderer initialization while (PeekEvent()) { const auto e = WaitEvent(); if (e.id == EVENT_STARTRENDERER and e.data == 0) { Notify(L"Renderer failed to intialize.\n\n" + e.text, "Ultra Engine", true); return 0; } } sprite->SetText("FPS: " + String(world->renderstats.framerate)); world->Update(); world->Render(framebuffer, false); } return 0; }
  22. I think I've fixed it! Thanks very much for your help, with your input it made me look in the right places. It was the sun direction calculation, I had missed a simple multiplication.
  23. Okay, this position makes the sky black. sun_pos = Vec3(-0.324064016,0.825100005,-0.462809354); Yet changing the y to be 0.835 instead of 0.825 works. sun_pos = Vec3(-0.324064016,0.835100005,-0.462809354); Its a shader issue. I'm getting closer.
  24. I just noticed your texture creation method; _dataTexture = CreateTexture(TEXTURE_2D, 64, 32, TEXTURE_RGBA32, {}, 1, TEXTURE_DEFAULT, TEXTUREFILTER_NEAREST); I leave my type as TEXTURE_RGBA and convert to floats like this - float BytesToFloat( in vec4 pixel ) { return intBitsToFloat( ( int( ( pixel.w * 255.0f ) ) << 24 ) | ( int( ( pixel.z * 255.0f ) ) << 16 ) | ( int( ( pixel.y * 255.0f ) ) << 8 ) | int( ( pixel.x * 255.0f ) ) ); } Would that function still work with the type TEXTURE_RGBA32 you think? I also use TexelFetch instead of sample.
  25. Sweet! That should work better. As far as using the buffer, I had it working fine on some smaller applications which leads me to believe there's a bug with my shader. Pity we can't debug shaders....
×
×
  • Create New...