Jump to content

SpiderPig

Developers
  • Posts

    2,285
  • Joined

  • Last visited

Community Answers

  1. SpiderPig's post in Editing an Asset will not update in editor was marked as the answer   
    This is working fine now with build 611.
  2. SpiderPig's post in LOD's casting shadow when they shouldn't was marked as the answer   
    Nice, pretty sure it's fixed now. 
  3. SpiderPig's post in AppendFile was marked as the answer   
    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(); }  
  4. SpiderPig's post in Shader extension not supported was marked as the answer   
    There is a CurrentTime variable in UniformBlocks.glsl that you can use.
  5. SpiderPig's post in Geometry Shader and Matrix Multiplication was marked as the answer   
    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. 

  6. SpiderPig's post in Does Texture::SetPixels() destroy current texture in GPU memory? was marked as the answer   
    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.
  7. SpiderPig's post in Creating a process in LUA was marked as the answer   
    Never mind, it was an easy fix in C#.
  8. SpiderPig's post in Component runtime was marked as the answer   
    I can't see anything else wrong with your code but I'm no lua expert so I'm just rattling off things that might help now... world not null?
  9. SpiderPig's post in RGBA to Float was marked as the answer   
    intBitsToFloat() Funny how simply making a post can make the answer show up on your next google search. 
  10. SpiderPig's post in How to MIRROR a camera rendertarget? was marked as the answer   
    I'd reverse the U coord of the entities texture coords somehow.  You might need a shader for that for a render target though.
  11. SpiderPig's post in Panel texture not showing with 3D cam was marked as the answer   
    I fixed it 
    auto ui = CreateInterface(world, font, framebuffer->size); ui->background->SetColor(0, 0, 0, 0); ui->SetRenderLayers(RENDERLAYER_1);//<----- Needs this!!  
  12. SpiderPig's post in Documentation Error was marked as the answer   
    Just a minor error in the C++ section for Framebuffer::Capture()
    auto path = GetPath(PATH_DESKTOP) .. "/screenshot.jpg"; pixmap:Save(path); Should be:
    auto path = GetPath(PATH_DESKTOP) + "/screenshot.jpg"; pixmap->Save(path);  
  13. SpiderPig's post in debug library is damaged was marked as the answer   
    Debug and Release are working okay for me.  Did you try a clean install?
  14. SpiderPig's post in Widget stays on screen after deleting it via SetParent (NULL) in 3D UI was marked as the answer   
    Just tested this.  Button needs to be set to nullptr (NULL) so that it is no longer keeping the widget alive.  You need to do both of these to delete the widget.  Well, it goes off screen so I'm going to assume it's gone for good.
    button->SetParent(nullptr); button = nullptr;  
  15. SpiderPig's post in GetCollider()->IntersectsPoint() return true for an old collider position was marked as the answer   
    I think there's a TransformPoint function that takes a source and target matrix... the matrix for your point might just be Mat4() with no arguments.  Target matrix would be the models matrix.
  16. SpiderPig's post in "Wrong number of primitive indices" was marked as the answer   
    For a line mesh AddPrimitive() should only take 2 arguments.  1 vertex for each end of a line.
  17. SpiderPig's post in fullbright surface? was marked as the answer   
    There's bloom.lua in the posteffects folder under the shaders folder in your project.  I think you add that to your camera as a post effect.
    For an emission shader I think you just need to change the shader from diffuse.shader to emission.shader in the material editor.  I haven't used Leadwerks in a while though.
  18. SpiderPig's post in glslangValidator with global include paths? was marked as the answer   
    And the answer is : 
    #include "../../../../../../../../UltraEngine/Templates/Common/Shaders\Base\Materials.glsl" Relatively speaking.
  19. SpiderPig's post in Test if SDF surface is inside AABB was marked as the answer   
    I believe I have found a solution.   If the node's corners are all above OR all below a surface (so a voxel index of 0 or 255) then the corner with the shortest distance is retrieved and it's distance is tested against half the radius of a sphere that encompasses all of the nodes corners (the distance from one of the corners to the centre of the bounds).  This way it ensures that the surface is not within the bounds of the node.  It creates nearly double the amount of nodes, and I dare say 30 to 40% of them don't represent the surface, but it fixes the gaps in the mesh and it's still fast.  Exploring the 4k terrain only uses about 100k nodes so it's not bad at all.  Fingers crossed it holds up!

  20. SpiderPig's post in Visual editor ETA was marked as the answer   
    There is no editor yet and I believe Josh said that the price of $7.99 will stay the same if your subscription stays current.  I think the price goes up to around 10 when Ultra is more stable.
  21. SpiderPig's post in Creating a class for initial system. was marked as the answer   
    Are you just wondering how to define the variables?  In which case you simply enclose the class name like this:
    shared_ptr<World> world;
  22. SpiderPig's post in Terrain Overlay Texture was marked as the answer   
    I've just realised there's probably no way to blend it seeing as Ultra can use so many different terrain materials.  I guess though you could assign a material per channel and do something like what I think I just got working...
    for (int y = 0; y < 512; y++) { for (int x = 0; x < 512; x++) { auto value = terrain_gen->GetErrosion(x, y); if (value != 0.0f) { terrain->SetMaterial(x, y, rocks, value); } } }  
  23. SpiderPig's post in Physics Jitter on SphereCollider was marked as the answer   
    So it appears that just a sphere collider will create the above issues.  Using a sphere mesh collider works best.  There is no gap between the surface(other than the obvious gap as the surface curves) and the jitter is gone completely.
    auto sphere = CreateSphere(world, 25.0f); auto collider = CreateMeshCollider(sphere->lods[0]->meshes[0]); sphere->SetCollider(collider); @Josh does all this sound like a bug to you or is it just the way of sphere collisions?
  24. SpiderPig's post in Geometry Shader was marked as the answer   
    Had to use the vertex world position for normal calculations instead of gl_Position.  This enables flat shading on shared vertices.
    #version 450 #extension GL_GOOGLE_include_directive : enable #extension GL_ARB_separate_shader_objects : enable #include "../../Shaders/Base/EntityInfo.glsl" layout (triangles) in; layout (triangle_strip, max_vertices = 3) out; layout(location = 0) in vec4 color[]; layout(location = 1) in vec3 normal[]; layout(location = 2) in vec4 texcoords[]; layout(location = 3) in vec3 tangent[]; layout(location = 4) in vec3 bitangent[]; layout(location = 5) flat in uint materialID[]; layout(location = 6) in vec4 vertexCameraPosition[]; layout(location = 7) in vec4 vertexWorldPosition[]; layout(location = 9) in flat uint entityflags[]; layout(location = 25) in flat uint entityID[]; layout(location = 23) in vec3 screenvelocity[]; layout(location = 0) out vec4 _color; layout(location = 1) out vec3 _normal; layout(location = 2) out vec4 _texcoords; layout(location = 3) out vec3 _tangent; layout(location = 4) out vec3 _bitangent; layout(location = 5) flat out uint _materialID; layout(location = 6) out vec4 _vertexCameraPosition; layout(location = 7) out vec4 _vertexWorldPosition; layout(location = 9) out flat uint _entityflags; layout(location = 25) out flat uint _entityID; layout(location = 23) out vec3 _screenvelocity; void main() { vec3 e1 = normalize(vertexWorldPosition[1].xyz - vertexWorldPosition[0].xyz); vec3 e2 = normalize(vertexWorldPosition[2].xyz - vertexWorldPosition[0].xyz); vec3 flat_norm = normalize(cross(e1, e2)); for(int v = 0; v < 3; v++){ gl_Position = gl_in[v].gl_Position; _color = color[v]; _normal = flat_norm; _tangent = tangent[v]; _bitangent = bitangent[v]; _texcoords = texcoords[v]; _materialID = materialID[v]; _vertexWorldPosition = vertexWorldPosition[v]; _vertexCameraPosition = vertexCameraPosition[v]; _entityflags = entityflags[v]; _entityID = entityID[v]; _screenvelocity = screenvelocity[v]; EmitVertex(); } EndPrimitive(); }  
  25. SpiderPig's post in Memory Pool was marked as the answer   
    @Josh I decided to do what you told me too.  I'm now using GetMemoryUsage() and it's displaying what it should.
     
    On another memory related topic "world->renderstats.vram" is the VRAM available and not in use, correct?
×
×
  • Create New...