Jump to content

SpiderPig

Members
  • Posts

    2,347
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. Yeah okay. Hopefully Josh can fix this none the less.
  2. I am using the BETA version. What's your screen setup? Are you running at native resolutions and 100% scaling?
  3. This part I've done and seems to work; OpenGLShader* shader = (OpenGLShader*)mat->GetShader(); Uniform* uniform = shader->GetUniform("arrayMap"); Not too sure what commands there are that can bind to the uniform. Google has not been too helpful... Is this right? glUseProgram(shader->program); GLuint _buffer; glGenTextures(1, &_buffer); glActiveTexture(GL_TEXTURE0 + uniform->index); glBindTexture(GL_TEXTURE_2D_ARRAY, _buffer); There are no errors being thrown by any of these GL commands either. I can't help but think the uniform itself needs to be activated so that the 2D_ARRAY can be bound to it rather than "_buffer"
  4. Just had a thought and looked at it again, when Leadwerks runs it is actually changing the screens resolution back to native EDIT : I changed my primary screen to 1680x1050 and had two black bars on the sides due to the aspect ratio. When Leadwerks ran these bars disappeared.
  5. After talking to @Argent Arts trying to figure out what was happening I managed to reproduce the problem. I have two screens of the same model both set to a resolution of 1920x1080 (which is their native resolution) in which full screen works fine. If I set one or both of these to a resolution below their native, the problem happens. @Argent Arts is using two screens as well, but both are different models and have different native resolutions. By setting the lower native resolution screen to the primary Leadwerks ran in full screen but only on that screen, not the bigger one. I'm not sure how Leadwerks manages full-screen mode, but from what looks to be happening, it seems Leadwerks is using the correct resolution of the screen for it's window, but is somehow scaling the result down as if the screen was still using it's native resolution. The scaling options for Windows 10 would also do this because it would scale it up to be different from the native as well. I'm not positive but with the Issue of the Leadwerks window appearing off screen, probably relates to the difference between native and current resolutions too. Is anyone else able to reproduce this problem by changing their screen resolution?
  6. I tried the converter on my DDS that has only 5 mipmaps and got this when loading into the editor. So I guess it's trying to calculate them still...? Error: Texture mipmap count (5) does not match calculated mipmap count (10). Error: Failed to load texture "G:/Leadwerks/Projects/TestingGrounds/Materials/beach_dirt_b.tex" As a general rule are all mipmaps supposed to present? Right down to the lowest size? (2x2 or 1x1)?
  7. Thanks. I tried this in a separate project and all I'm getting is a black cube. glGetError() returns 0 so all good there. I've uploaded the entire mat and texture file too. #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } float lookspeed = 0.1, looksmoothing = 0.5; Vec3 mousepos; bool wireframe = false; bool App::Start() { window = Leadwerks::Window::Create(); context = Context::Create(window); world = World::Create(); world->SetGravity(0, 0, 0); camera = Camera::Create(); camera->Move(0, 2, -4); Light* light = DirectionalLight::Create(); light->SetRotation(35, 35, 0); Model* box = Model::Box(); box->Move(0, 1, 0); Material* mat = Material::Load("Materials\\Test.mat"); box->SetMaterial(mat); Texture* texture = Texture::Load("Materials\\bluegrid.tex"); int _width = texture->GetWidth(); int _height = texture->GetHeight(); char* buf = new char[texture->GetMipmapSize(0) * 4]; texture->GetPixels(buf); OpenGLShader* shader = (OpenGLShader*)mat->GetShader(); glUseProgram(shader->program); GLuint _buffer; glGenTextures(1, &_buffer); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D_ARRAY, _buffer); glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, _width, _height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); GLenum error1 = glGetError(); glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, _width, _height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); GLenum error2 = glGetError(); Model* floor = Model::Box(); floor->SetShape(Shape::Box()); floor->SetPosition(5, 0, 0); floor->SetScale(30, 0.1, 30); mousepos = window->GetMousePosition(); window->SetMousePosition(context->GetWidth() / 2, context->GetHeight() / 2); return true; } bool App::Loop() { if (window->Closed() || window->KeyDown(Key::Escape)) return false; if (window->KeyHit(Key::F3) == true) { camera->GetDebugPhysicsMode() == true ? camera->SetDebugPhysicsMode(false) : camera->SetDebugPhysicsMode(true); } if (window->KeyHit(Key::F4) == true) { camera->GetDebugEntityBoxesMode() == true ? camera->SetDebugEntityBoxesMode(false) : camera->SetDebugEntityBoxesMode(true); } if (window->KeyHit(Key::F2) == true) { if (wireframe == true) { camera->SetDrawMode(0); wireframe = false; } else { camera->SetDrawMode(2); wireframe = true; } } float cx = Math::Round(context->GetWidth() / 2); float cy = Math::Round(context->GetHeight() / 2); Vec3 mpos = window->GetMousePosition(); window->SetMousePosition(cx, cy); mpos = mpos * looksmoothing + mousepos * (1 - looksmoothing); float dx = (mpos.x - cx) * lookspeed; float dy = (mpos.y - cy) * lookspeed; Vec3 camrot = camera->GetRotation(); camrot.x += dy; camrot.y += dx; camera->SetRotation(camrot); mousepos = mpos; float _time = Time::GetSpeed(); float camspeed = 0.2f * _time; if (window->KeyDown(Key::Shift) == true) { camspeed = camspeed * 5.0f; } if (window->KeyDown(Key::W) == true) { camera->Move(0, 0, camspeed); } else if (window->KeyDown(Key::S) == true) { camera->Move(0, 0, -camspeed); } if (window->KeyDown(Key::A) == true) { camera->Move(-camspeed, 0, 0); } else if (window->KeyDown(Key::D) == true) { camera->Move(camspeed, 0, 0); } if (window->KeyDown(Key::T) == true) { camera->Move(0, camspeed, 0); } else if (window->KeyDown(Key::G) == true) { camera->Move(0, -camspeed, 0); } Leadwerks::Time::Update(); world->Update(); world->Render(); context->Sync(); return true; } The texture is uncompressed and has no mipmaps. It might have to do with the way I'm binding it, maybe it can't find the right location in the shader? Test.zip
  8. As well as trying out texture atlases I'm looking into textures arrays too, but am having trouble finding information on how to set it up. This is what I have so far; Material* mat = Material::Load("Materials\\terrain.mat"); Texture* texture = Texture::Load("Terrain\\beach_dirt_b.tex"); OpenGLShader* shader = (OpenGLShader*)mat->GetShader(); int _width = texture->GetWidth(), _height = texture->GetHeight(); char* buf = new char[texture->GetMipmapSize(0) * 4]; texture->GetPixels(buf); glUseProgram(shader->program); GLuint _buffer; glGenTextures(1, &_buffer); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D_ARRAY, _buffer); glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, _width, _height, 1); glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, _width, _height, 1, GL_RGBA8, GL_BYTE, buf); Part of the Fragment Shader; #version 430 layout (binding = 0) uniform sampler2DArray tex; //in main() outcolor = texture(tex, vec3(coords.x, coords.y, 0)); All I get is total blackness on the terrain. Wondering if any of you guys know how to implement this? If needed I can make a small test program and upload that. A link I used; https://ferransole.wordpress.com/2014/06/09/array-textures/
  9. I think it might be. I just tested it again and this time exported the dds with only 5 mipmaps. After converting to TEX and loading in game the mipmap count was at 10. It would be nice to have more control over the import settings.
  10. The .tex files doesn't seem to retain the mipmaps in the .dds file. I've attached the test files I used. Also I used this code to extract the mipmap level then later draw it to the screen; //On Load Texture* t = Texture::Load("Terrain/Textures/beach_dirt_b.tex"); char* buffer = new char[t->GetMipmapSize(1) * 4]; t->GetPixels(buffer, 1); Texture* tex = Texture::Create(t->GetWidth(1), t->GetHeight(1)); tex->SetPixels(buffer); //On Run context->DrawImage(tex, 100, 100); Here is what the second mipmap should like; Using gimp to load and edit the dds file, I can see that it is defiantly saving the second mipmap with the edit I did. It just not showing up in the conversion to tex. Is it possible to add a command to the texture class; SetMipMap(Texture* texture, int level)? Provided of course it has the right resolution for that level... beach_dirt_b.tex beach_dirt_b.tex.meta beach_dirt_b.dds
  11. I've started creating a large texture atlas for my terrain so that I can use more textures with less slots. The problem is the default mip-map generation creates bleeding on lower mip levels, and from what it says here, I need to create each mip-map separately and then combine them. Does anyone know of a way to manually set each mip-map level into a texture? Can I perhaps make a .dds texture with the mip-maps I want and will the editor then convert it to .tex format using those mip-maps?
  12. Will they remain unaffected even if I change the position of the vertices in the terrain patch, and then just update the normal? Are they 90 degrees to the normal and each other?
  13. I use this code to create the normals for my terrain model. How would I create the Tangents and Bi-normals? I can't use the surface->UpdateTangentsAndBinormals() function, as I want the code to able to update normals for specific vertices only. How exactly do the tangents and bi-normals relate to the normal and how do they effect normal mapping? Vec3 _cPos = _getTerrainVertexPosition(x, z); Vec3 _lPos = _getTerrainVertexPosition(x - 1, z); Vec3 _rPos = _getTerrainVertexPosition(x + 1, z); Vec3 _uPos = _getTerrainVertexPosition(x, z + 1); Vec3 _dPos = _getTerrainVertexPosition(x, z - 1); //==================================================================================================// // TOP LEFT // //==================================================================================================// _U.x = _uPos.x - _lPos.x; _U.y = _uPos.y - _lPos.y; _U.z = _uPos.z - _lPos.z; _V.x = _cPos.x - _lPos.x; _V.y = _cPos.y - _lPos.y; _V.z = _cPos.z - _lPos.z; _topLeft.x = (_U.y * _V.z) - (_U.z * _V.y); _topLeft.y = (_U.z * _V.x) - (_U.x * _V.z); _topLeft.z = (_U.x * _V.y) - (_U.y * _V.x); //==================================================================================================// // TOP RIGHT // //==================================================================================================// _U.x = _cPos.x - _rPos.x; _U.y = _cPos.y - _rPos.y; _U.z = _cPos.z - _rPos.z; _V.x = _uPos.x - _rPos.x; _V.y = _uPos.y - _rPos.y; _V.z = _uPos.z - _rPos.z; _topRight.x = (_U.y * _V.z) - (_U.z * _V.y); _topRight.y = (_U.z * _V.x) - (_U.x * _V.z); _topRight.z = (_U.x * _V.y) - (_U.y * _V.x); //==================================================================================================// // BOTTOM LEFT // //==================================================================================================// _U.x = _dPos.x - _cPos.x; _U.y = _dPos.y - _cPos.y; _U.z = _dPos.z - _cPos.z; _V.x = _lPos.x - _cPos.x; _V.y = _lPos.y - _cPos.y; _V.z = _lPos.z - _cPos.z; _bottomLeft.x = (_U.y * _V.z) - (_U.z * _V.y); _bottomLeft.y = (_U.z * _V.x) - (_U.x * _V.z); _bottomLeft.z = (_U.x * _V.y) - (_U.y * _V.x); //==================================================================================================// // BOTTOM RIGHT // //==================================================================================================// _U.x = _rPos.x - _cPos.x; _U.y = _rPos.y - _cPos.y; _U.z = _rPos.z - _cPos.z; _V.x = _dPos.x - _cPos.x; _V.y = _dPos.y - _cPos.y; _V.z = _dPos.z - _cPos.z; _bottomRight.x = (_U.y * _V.z) - (_U.z * _V.y); _bottomRight.y = (_U.z * _V.x) - (_U.x * _V.z); _bottomRight.z = (_U.x * _V.y) - (_U.y * _V.x); _normal.x = (_topLeft.x + _topRight.x + _bottomLeft.x + _bottomRight.x) / 4.0f; _normal.y = (_topLeft.y + _topRight.y + _bottomLeft.y + _bottomRight.y) / 4.0f; _normal.z = (_topLeft.z + _topRight.z + _bottomLeft.z + _bottomRight.z) / 4.0f; //==================================================================================================// // NORMALIZE // //==================================================================================================// float _vectorLength = sqrt((_normal.x * _normal.x) + (_normal.y * _normal.y) + (_normal.z * _normal.z)); _normal.x = _normal.x / _vectorLength; _normal.y = _normal.y / _vectorLength; _normal.z = _normal.z / _vectorLength;
  14. I found this was how blender exported fbx objects. This problem is gone if you use the leadwerks mdl exporter for blender.
  15. I'll soon be working on my own path finding algorithm C++. What I'm thinking of at the moment is moving an enemy toward the player and checking ahead of it's current direction for AABB collisions to determine if this direction is a good one or not. (At least approximately) I haven't designed it yet, but it shouldn't be too hard to get a basic one in. But it would kinda be advanced stuff if your new to C++.
  16. I'm not sure then sorry. Maybe it's something Josh can answer. I remember trying to get it to work but can't actually remember if I succeeded or not...
  17. I remember trying this ages ago and that one of the functions to set height didn't work. Have you tried SetHeight() with the last argument as true? (In C++ it's false by default) terrain:SetHeight(ELPOS.x,ELPOS.y, raise + 10, true)
  18. In C++ the syntax is this; void SetElevation(const int x, const int y, const float elevation, const bool update); Try this; terrain:SetElevation(ELPOS.x,ELPOS.y, raise + 10, true) I'm not sure why it says argument 5... there's only 4 in C++.
  19. Yeah makes sense. The new asset loader is for Turbo, yes? When do you think Turbo will be at a stage where we can merge Leadwerks 4 projects over to it without having to worry about missing features?
  20. Very nice. Does this mean mip-maps are not needed for SVG textures on a model?
  21. They're not quite the same, I think the major difference is Draw() isn't called when the object is invisible (off screen). Pretty sure the scene is rendered each frame. Per loop there is one call to UpdateWorld () and then a call to RenderWorld ().
  22. I'll run the same test tonight and see how it compares ? It makes sense that a small compression will be quicker to read because of less IO operations. Without compression my SSD is 2x faster than the HD.
  23. Just curious, is loading a compressed package slower than loading an uncompressed package? Somewhere along the line the data has to be un-encrypted and uncompressed doesn't it?
×
×
  • Create New...