Jump to content
  • Advertisement

boubi

Member
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

100 Neutral

About boubi

  • Rank
    Member
  1. boubi

    Trigonometry trick

    Again me : it works only if point inside circle... too bad... the question is still open for point outside circle....
  2. boubi

    Trigonometry trick

    Fix ! a small error has been done on typo : For horizontal distance : we need to apply a simple thales formula wich will give you : (R-x0)*cos teta*0.5
  3. boubi

    Trigonometry trick

    I didn't explained me well sorry, but i only wanted to know the length of the segment making the intersection between ray from wich we have only in input altitude and cos teta, i suppose that i must intersect and limit myself to one quarter of the circle, that's what permitt me to avoid quadratic problems. I do this because i'm generating a lookuptable for GPU caculcation, the lookup table is quite a bit intensive because it evaluates several integrals ... so that's why i'm looking a way to do things very simple and so fast. The cos teta and altitude will be my indexes in this lookup table. Thanks for all your interests...
  4. boubi

    Trigonometry trick

    Hi, community i post the answer in case someone is interrested one day i have tons of tons of operations like that so that's why i wanted to save some cycle through smarter formulas. I have found how to do it , and checked it in a unit test application : Basically it's just applying the trigonometric identiy sin teta = sqrt(1-cos^2 teta) and rescale it by the circle wich is at center (x0,y0) and radius (R-y0). therefore to know the value i searched is : Vertical length of the intersection segment with circle is given : sqrt(1-cos^2 teta)*(R-y0). Horizontal lenght For horizontal distance : we need to apply a simple thales formula wich will give you : (R-x0)*cos teta Full lenght of segment of intersection simply apply pythagorean theorem : sqrt(1-cos^2 teta)*(R-y0) + (R-x0)*cos teta I have tested it graphically with an application. See u later !
  5. boubi

    Trigonometry trick

    Try to google : ray circle intersection you will find answers to do this, sorry this is not the purpose of this topic, basically you just have to plug the ray parametric form into the equation of the circle or sphere if you want it in 3D, then you develop all the stuff and you will see appearing the quadratic equation At2 + Bt + C = 0 wich is really simple to solve.
  6. Ok guy , i asked here and you can assume that the locks causes synchronisation between GPU and CPU ...that's to say that your CPU can wait a certain amount of time waiting that driver doesn't need the resources anymore especially when having some frames of delay in the command buffer (eg presentation intervall other than immediate). we have had this problem on a big game like Crysis here, and the lock time was driver dependent... Try to deactivate lock if you can and capture and you will see if it's the pbm...
  7. boubi

    Trigonometry trick

    I know of how to optimize software, but the goal of my post is the challenge of trying to solve this with trigonometry sorry...it's kinda a headache math puzzle game Anyone is welcome , so let's go ! try to solve this if you are a player ... Cheers.
  8. With a very little information over your situation it's kind of talking in blind and only trying to guess what's up there. Just rapidly , tell me that you profile your app in optimized compiled target (Release) ? What's your game engine architecture, is it multithreaded or not ?, your GPU wait , so it's in the CPU ok, you make too much stuff ok but generally, when we search for performance , we run a profiler and identify the largest time consuming functions and then analyze code ... They are plenty of solutions to optimize something , so my question is are you sure you are doing theses thing the fastest possible ? have you analyze deeper the LHS hazard's on your cache lines for example inside big loops for example... have you multithreaded , if you make maths , did you use SIMD ? A correct and precise answer is possible only if you have the application source and profilers on and architecture in mind... sorry i don't think someone can reply easily by forums... Try to search hotspots in your app in your profiler and analyze the code. Hope this helps.
  9. Thats very interesting, what I want to achieve is more of a 'spore-like' planet than a correct solution. Can you maybe provide me with more information on how the sky in spore is rendered? [/quote] From what i see i guess they render a second sphere with alpha blending , and modulate alpha by dot(N,L) L being sundir and N sphere normal...
  10. Somewhere in your shaders , you should adapt the exponentials : exp(-h/H) h = your altitude , H = the height where the considered quantity is the highest concentrated for example there are two values : one for mie scattering and one for rayleigh scattering. If you simply integrate the shaders as they are provided in Gpu Gems2 in your renderer , try to find the constants that are used in the denominator of the previous exponentials... You can put what you want in it if you stay in the same coordinate range in the full pipeline of calculation. Oh and just to comment the pic of spore, there is no atm scattering in there...
  11. Your 2nd capture tells more things , you make a lot of draw calls wich is nasty because it burden the driver queue and has call overhead at each call (enqueuing in the driver , entering the functions, ect...) (you should batch more), moreover you make a huge amount of lock in one frame over the vb's , i suppose you upload procedural geometries but you seem to do that on plenty of vb's ... The lock and upload into the vb has a cost and i don't know the size of each upload (consider it's like transferring RAM to VRAM) ... But nevertheless the cpu is more used in one frame , meaning that i guess you are performing calculation inside locks ? If the cpu is slow try to consider your algo / maths , use SIMD if possible, but first of all use a profiler to see whats happening ?
  12. boubi

    Fast DirectX Screen Capture

    Please be more precise, your app render what ? how much time does the rendering frame cost (fps) ? Like you describe it, your application seems to do nothing apart dumping the framebuffer ? i don't think the rendering into the rendertarget is slow, rather the JPG compression can be slow if you do it once per frame on a full framebuffer ... If you want to know this run a basic free profiler like very sleepy, it's free and reveal you what time is spent in wich functions.
  13. boubi

    Trigonometry trick

    oh sorry i omitt that i don't want to have teta as input... only the cosine , sorry i will have tons of calls of this so i want to avoid using arc cosine functions... Thanks for your help
  14. boubi

    Matrix -> Vector3?

    is this the local to bone matrix ? or bone to local matrix ? i'm not sure of what you want to do, but at a glance you can invert your matrixLightPosition and get the position from the 4th row or column depending whether you are in column major or row major for your matrices.
  15. First consider that effect framework is good for little engines or demos, but for big ones and commercial ones not, becauses thoses are always pushing the hardware into the limits and want to save every cycle it can even if it's not always the case in all the pipeline stages, generally we try to do so 1) Effect framework is DX only but not HLSL, so in a multiplateform engine it will not be portable (PS3 will not be friendly) 2) Most commercial engines implement material systems with shaders that are combinable (uber shader), that's to say the rendering shader is a combinatory of small pieces of code precompiled, for example you can have a material wich render bricks , and the very same material will have codepath precompiled for reflections, specular, normal mapping, so you can have the same material , but different behavior within it. Theses make happy artists, because they don't have to worry about choosing between tons of materials, and it make happy your renderstates changes too, since material can have same renderstates but not same shader code. => This is not feasible with effect framework i think.
  • 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!