Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

136 Neutral

About Chapa

  • Rank
  1. Chapa

    Skybox issue

    Why dont you just disable depth testing when drawing your skybox, and then make it follow your position with a simple translate, that works for me.
  2. Hi, a few weeks ago i started trying to implement a tessellated terrain on my school project, but after finally getting it working, i encountered some issues, first one is that there is a lot of cracks on my terrain, i readed that this is a very common issue, and also found some solutions, but i cant find any sample code, and i dont really understand or actually know how to code those solutions i found, so i really need to see how it works already coded and understand it better, and the other one is normals after displacement, right now im using a normalmap to get my new normals after displacement, but i dont know if it is a good solution, and after that i still cant find a good solution to recalculate tangents or binormals for specular using, any help would be great, thanks.
  3. Chapa

    Domain vs Geomtry Shader

      Well right now still with no normal calculations and that stuff im like at 300 fps, and adding the geometry stage doing almost nothing, it goes down to like 50 fps, i know fps are algorithmic and that stuff, but it is still alot to consider removing that stage definetly, thank you.   Now going back to spazzarama answer, i will be doing the new normal calculations on the domain shader, but now that i started thinking on how to do them, it is not possible to do smooth normals since i dont have access to adjency vertices, so i started looking for some information on how to do it, a lot of people tell me to use a "sobel map", but i have no idea on how to make it or use it, any ideas?
  4. Chapa

    Domain vs Geomtry Shader

    @phantom: what i tried to say, is that each frame is taking longer time to render.   @spazzarama: thanks for your answer, it makes sense what you said about domain shader always will be called, but geometry is still optional, so i guess when using tess, geometry is not needed anymore like for nothing lol, thanks for the code examples too.
  5. Hi, first sorry for my poor english,but here it goes, i recently started with tessellation shaders, to be able to render a big terrain with easy culling and LOD implementation, but im facing some issues, right now this is what i am doing:   1.- Draw call of a flat mesh of X*X quads. 2.- Vertex shader does nothing, it only sends the information to the hull shader. 3.- Hull shader gets a tessellation factor depending on distance and it also does frustrum culling checking if the vertex is inside the frustrum. 4.- Domain shader uses a displacement map (heightmap) to move the new vertices to its "y" position.   I still need to calculate normals, tangents and binormals or bitangents however you call them, to be able to apply lighting on the pixel shader, and i also want to implement backface culing and may be occlusion culling using normals.   I tried adding a geometry shader stage, which right now is doing nothing but passing the information to the pixel shader, no calculations, but this still makes a big drop on the fps, i dont want to think what will happend if i add the normal calculations there.   Im not sure what should i do, or what am i doing wrong, should i calculate normals on domain shader, geometry shader, or which should be a nice solution, thank you.
  6. Thank you L. Spiro, with this information it is really clear for me now how to save the data, you have been very helpfull, and i really appreciate the time you are taking to answer me, but i still cant get the whole idea, i understood how to structure the info and also i understood how i could manage the physics and even i got the LOD idea, its pretty simple when using this structure...   But i still cant get, how am i going to put this kind of structure into a render queue, the only idea i get for rendering this, is just having a render method in the model, which is going thru all meshes, and then each mesh is going thru all submeshes, and of course activating what needed on each stage, and finally getting the render of a single model,... the benefits i see on this way is that i will only update constant buffer on each mesh, if its different of course, and i can share the vertexbuffer, even the indexbuffer, just using an offset on the drawcall and knowing the size, but i still will change the material and probably texture for each submesh, which is what everyone tries to avoid, thats what i have been reading everywhere, of course after sorting by rendertype and shaders, this still confuses me...   And again, i am sorry for my english, may be you already tried to explain me this before or gave me an idea about it, but sometimes when reading a whole sentence its just hard for me to understand everything you are trying to tell me.   Thanks again
  7. Thank you L. Spiro and JMab, that was very useful,   So let me see if i understood how it should be, L. Spiro,     - Model will have only pointers to its meshes, i guess this will help in the future to know which meshes are related. - Mesh will have the physics helpers (BB or BS, etc) and a list of sub-meshes, i guess this is what i would call a "group" lika a head for example, which would be part of a model. - Sub-Mesh will be the one having all the info like vertex/index buffers, shaders and material IDs, matrices transformations, etc, and this one would represent for example, the eyes, or the mouth, etc.   If this is correct, i think it is pretty clear now then, after having this i think i will first loop thru all meshes to check which one is inside frustrum, but since the sub-meshes will be sorted by material i would need to activate a bool or something like that, and then go thru all the sub-meshes on the scene, and render the ones that are inside the frustrum by reading the bool i modified.   Am i near now? this has been very helpfull, thank you everyone for the answers. 
  8. Thank you very much for your answers, im actually also new to programming, im still in college and never saw programming before, and since we see alot of stuff at the same time we do not really learn everything so deeply...   But i like to do my own research and learn by myself, so i did it, and i just learned what a handle is, and a little bit of bitwise operators, and i managed to do an example code, making handles and sorting them, just as kauna told me, it is amazing, i guess the handlers, will be the index number of my object on their own list,  and i will just walk thru the vector, and change the states when needed, looks like some nested fors or whiles with some ifs, and thats it, pretty cool and easy.   About JohnnyCode advises, i was already planning to do a kind of resourece manager that does all this kind of stuff, thank you for making me sure of doing it, and im already using frustrum culling before all this rendering...   But i still have some doubts about defining models and meshes that i cant get straight on my head, i still do not import any animations, so i dont manage skinning, i actually dont know how to yet, im actually importing static models from obj and mtl files, i decided to always divide the meshes by material, so each mesh has only 1 material assigned of course, so having everything divided as kauna told me, everything will fit cool with this method...   But i still keep thinking, what if i make a model class with its own materials and meshes, this still will make me only have one world matrix per model and also one vertex buffer, and i wont need to send that many world matrix changes to shader or vertex buffer changes... for example lets say in my sorted vector with handlers, my last handle is the matrices transformations, if i sort by material for example, probably all of the meshes that has the same transformations will be all far away from another, so i will need to update the transformations almost each iteration, and doing it the way i think it will happen a lot of less times, since all the meshes in the model will be rendered in order, and i guess i can also do this by putting the matrices transformations handler at the beggining on my vector, or also using a vertex buffer handler, but i dont know if its the correct thing to do, i dont really know what is more expensive to do, sending material info or sending matrices info, since both are just constant buffers and material buffer adds some texture sends, this confuses me alot lol..   Also doing this, i would probably only check if the whole model is inside the frustrum, and not each of the meshes, or also when testing collisions, this has nothing to do with rendering, but i guess it will save some cpu cycles also...   I would really appreciate if you guys can help me get this clear for me, thank you.
  9. Hello, before anything, sorry for my english, since it is not my native language i am not really good on it, but here i go...   Im new to DirectX and i been thinking on the best way to manage the draw calls i will be doing, so i can get the best performance i can, i now understand a good way is sorting the meshes on a way that i make the less state changes possible, for example sorting by shader, then materials, etc, and i been trying to approach this, but also thinking in the future when i will be needing to get control of a certain mesh, or test collisions, etc, and i been trying to search for this info, but no one talks about models having more than one mesh, and managing all those meshes together, etc...   So this are the 2 ways i think i could do it, but cant decide which one is best or which one to choose...   Lets say i have a material, mesh and model class and each mesh has a link to the material it uses...   So the first idea would be loading all the materials and meshes on a list, and on the model class only saving a list of pointers to them, so i can modify or check something if needed, for example changing the world matrix of all the meshes on the model, the benefit of this idea is that i will be able to sort all of the meshes in the scene, ignoring to what model it belongs, and render them by material, saving material state changes even if two or more different models uses the same material, but the bad part is that i will be updating the matrix buffer on each mesh, to be able to move different meshes to the same place, ignoring their place on the list.   My second idea would be loading the materials and meshes inside the model class and by that way only having one world matrix for the whole model, in this case i will be rendering by model, and inside it, rendering by material anyway, and the benefit would be only updating the matrix buffer once per model, instead of once per mesh, but the bad part here is that if i have the same material on different meshes between models, i will need to update the material again on the other model or models.   So this are my 2 ideas and i still cant decide which one to choose, i really would appreciate any advice thank you.
  • 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!