Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by giugio1977

  1. hello. I'm trying to create an indirect drawing with vulkan. All works fine but now i would create some states variables to send per objects drawing. For example : if i have 3 cubes and i would change the color only at the first, how i can do? The dynamic uniform buffers are made for this? I read that i can change only one state variable how i do? I must understand how i can use dynamic uniform buffers for change the state only to one or more objects without remap all the data buffer.   thanks.
  2. thanks you are very kind. Only 2 questions and i start reading: 1)i have 4 lists of geometrics objects with 100000 objects in the worst case and create a scenegraph is a huge waste of memory, i ask you an example or a tutorial for do these things without the scenegraph if is possible. 2)I read something about compute shader, but i'm fine in some case if i can send a for object raw 64 bit address for find very fast the list object that is a c++ object but at the end this is only an index then i can use an ordered list? thanks now i start to reading the superbible. hello. what mean this? i don't understand.
  3. in pratical instead of tests that i'm doing the real application must have a piking that change the color of the selected object, a visible / invisible bool integer and a color that may be change sometime in indirectdraw . for the piking that is the most important can you advice to me how do with a compute shader?there are architectural or simple examples for the picking and bounding boxes? thanks
  4. hello. I understand in part the dinamyc buffers. in my program i have a dynamic buffer with only one matrix ,but how i can copy only some matrixes to the gpu instead copy the entire buffer?. here from an example of vulkan sdk   void updateDynamicUniformBuffer(bool force = false) { // Update at max. 60 fps animationTimer += frameTimer; if ((animationTimer <= 1.0f / 60.0f) && (!force)) { return; }   // Dynamic ubo with per-object model matrices indexed by offsets in the command buffer uint32_t dim = static_cast<uint32_t>(pow(OBJECT_INSTANCES, (1.0f / 3.0f))); glm::vec3 offset(5.0f);   for (uint32_t x = 0; x < dim; x++) { for (uint32_t y = 0; y < dim; y++) { for (uint32_t z = 0; z < dim; z++) { uint32_t index = x * dim * dim + y * dim + z;   // Aligned offset glm::mat4* modelMat = (glm::mat4*)(((uint64_t)uboDataDynamic.model + (index * dynamicAlignment)));   // Update rotations rotations[index] += animationTimer * rotationSpeeds[index];   // Update matrices glm::vec3 pos = glm::vec3(-((dim * offset.x) / 2.0f) + offset.x / 2.0f + x * offset.x, -((dim * offset.y) / 2.0f) + offset.y / 2.0f + y * offset.y, -((dim * offset.z) / 2.0f) + offset.z / 2.0f + z * offset.z); *modelMat = glm::translate(glm::mat4(), pos); *modelMat = glm::rotate(*modelMat, rotations[index].x, glm::vec3(1.0f, 1.0f, 0.0f)); *modelMat = glm::rotate(*modelMat, rotations[index].y, glm::vec3(0.0f, 1.0f, 0.0f)); *modelMat = glm::rotate(*modelMat, rotations[index].z, glm::vec3(0.0f, 0.0f, 1.0f)); } } }   animationTimer = 0.0f;   memcpy(uniformBuffers.dynamic.mapped, uboDataDynamic.model, uniformBuffers.dynamic.size); isFilledDynamicBuffer = true;     // Flush to make changes visible to the host  VkMappedMemoryRange memoryRange = vkTools::initializers::mappedMemoryRange(); memoryRange.memory = uniformBuffers.dynamic.memory; memoryRange.size = uniformBuffers.dynamic.size;   vkFlushMappedMemoryRanges(device, 1, &memoryRange); } What can i use instead of memcpy(uniformBuffers.dynamic.mapped, uboDataDynamic.model, uniformBuffers.dynamic.size); for update of only some matrixes instead of  the entire buffer? Thanks. 2)can I use the dynamic buffers with vulkan indirectdraw? thanks.
  5. hello. I would create an instanced boxes drawing in vulkan. I have 2 variables that change during the time and are selected and visible . I seen in documentation and examples that use instanceindex and an ubo and every change the ubo is remapped. i have 3 questions: 1)i must choose from an texture and an ubo for changing variables(selected and visible) and for example if a piking on a box is executed i must remap the data variables to the new value selected in the texture or ubo , but i must change only 3 byte in the entire buffer or texture, then in the shader when i get the value from the texture or the ubo i must get the selected color. 2)i'm using instancing drawing and i have 300000 objects 3)is better to use ubo or a 1d texture? thanks.
  6. giugio1977

    scale matrix and rectangle

    hello. I have some parallelograms like from image.   i must find a method for calculate a scale matrix that convert a fixed rectangle (that is always the same) in to these parallelogram is possible? thanks.
  7. giugio1977

    instancing with geometry shader

    Naturally a problem is the size of the texture but with vulkan can i upload more memory of a texture gl object?
  8. I reformulates a question. hello , i have a lot of 2d shapes of 4 point , are always parallelograms With the extrusion they have 8 points and my idea is to do the extrusion on the cpu, save all vertexes of extrusion in a texture and do a instancing drawing and in in the geometry shader I wish take the points from the texture so i can do a batch draw of many many 1 point and in the geometry shader read the points from the texture and emit the vertexes. I try to do this because any my geometry  is similar and i have a lot of meshes. Another approach is do an instance with a scale matrix (that is a 3d vector) then do only  a transformation on all points but i can't create a scale matrix from a base rectangle and a parallelogram that aren't similar but for rectangular shapes of different sides I think that this can be done. Naturally i have a texture with the scale matrix or correct extruded vertexes and an instance id for take the vertex or the matrix from the texture with a sampler. Thanks
  9. I must create a small opengl 4.3 engine ,where i can find an example or a tutorial for gl files and interop with opencl? And what version of opencl you advice to me ?  how i can test compatibility with opencl ? My gpu is a 4.3 opengl nvidia card. thanks.
  10. giugio1977

    shapes and opengl

    Yes, there is a camera culling , and i write a max casistic in general i have 100000+- object and the camera not view all objects because a lot of object are culled, but now i have a question:  memory :is better for you create all 3d object in the cpu with extruding at the start or do an instancing with a texture or more texture that have the shape , the direction and the depth and calculate the extrusion on the fly in the instancing?  i saw that  more of these object have 4 point then the extrude object has 8 point and this is calculated at the start then with c++ i can delete all depth and direction information and shapes to save a lot of memory. but for a batch i must generalize how i can use batch all those objects instead? thanks.
  11. Hello. I have a casistic where i have 500000+  objects of different 2d shapes to extrude and draw. The shapes have at max 16 point. A first idea is to use instancing and select the shapes that are equals or similar and launch 3/4 batch of instancing for the similar i use a scale matrix.because a lot of objects are equal as shape but bigger or smaller. the second idea is to use an istancing with geometry shader. the third idea is to use deferred shading. I'm not worried too much of the result of shading it isn't a game is an architectural program; but i can't find a decent solution for old gpus of 3/4  years ago. thanks.
  12. hello. I would send some array of primitive structures from c# to c++. 1)marshaling 2)cli c++ .net dll wrapper 3)?other technology what are the pro and cons? only a base Then I do an full search on google. thanks.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!