Jump to content

SpiderPig

Developers
  • Posts

    2,204
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. Got it back down to about 200ms by increasing ray step size based on how high the ray is above the terrain at that time. I have another idea that could decrease the amount of rays that actually need casting by up to 50%.
  2. Did this and it seems to work nice. if (enable_lighting == true && (RenderFlags & RENDERFLAGS_NO_LIGHTING) == 0) Only issue left to solve are the edges of the shadows are very harsh. If I can use a single bit as a Boolean to disable lighting I may also be able to use a few bits to determine the distance from the light source so that I can soften the edges.
  3. This iteration is a bit slower but looks a lot nicer. The shadows are just multiplied by the final color so fragments within the shadow are still having light calculated on them. @Josh Can I make a bool variable in the fragment shader to simply not calculate lighting for certain pixels? Something like this perhaps? EDIT : There's a RENDERFLAGS_NO_LIGHTING right there.... I might play with that if(canDoLighting == true) { if ((RenderFlags & RENDERFLAGS_NO_LIGHTING) == 0) { RenderLighting(material, materialInfo, vertexWorldPosition.xyz, n, v, NdotV, f_diffuse, f_specular, renderprobes, ibldiffuse, iblspecular); if (!renderprobes) { ibldiffuse = vec4(0.0f); iblspecular = vec4(0.0f); f_specular = vec3(0.0);// we don't want specular reflection in probe renders since it is view-dependent } } else { renderprobes = false; f_diffuse.rgb = materialInfo.c_diff * AmbientLight; f_specular = vec3(0.0f);// we don't want specular reflection in probe renders since it is view-dependent } }
  4. This file causes LoadModel() to hang rather than crash. Is there some sort of secret header that all model files should have? To confirm - this is not with any plugin I've made, this is just loading a file that doesn't have much data and is in a format that LoadModel() doesn't recognise. I've also seen LoadModel hang and rapidly increase RAM usage into the tens of GB. CausesHang.zip
  5. The example here throws an error with the latest build. https://www.ultraengine.com/learn/CreateTerrain?lang=cpp
  6. Has TEXTURE_RED been replaced / missing or is it redundant now?
  7. Got this error with one of the shaders in latest update. I did copy the shader folder over to my project. Adding in the required line solves the problem.
  8. 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.
  9. 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
  10. This is 0.9.4 by the way... Happens in 0.9.5 too.
  11. 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(); }
  12. 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
  13. I would have use for these as well. Also BEFORE_PHYSICS_UPDATE & AFTER_PHYSICS_UPDATE would be good.
  14. They are, I was more wondering if it should print an actual error when it failed to load. 🙂
  15. 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"
  16. 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; }
  17. Nice! Shader toy has some good shaders. 🙂
  18. There is a CurrentTime variable in UniformBlocks.glsl that you can use.
  19. 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.
  20. 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.
  21. 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.
  22. 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.
  23. 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
  24. 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?
  25. Oh right. Just wanted to check. What do you think about the swept culling issue?
×
×
  • Create New...