Jump to content
  • Advertisement

supagu

Member
  • Content Count

    1132
  • Joined

  • Last visited

Community Reputation

148 Neutral

About supagu

  • Rank
    Contributor
  1. seems like only doing 4x4 blocks would result in a lot of wasted time generating this data, moving it around and storing it? im doing old school rasterisation where i do a whole line of a triangle at a time, how ever i did read up on some other method that used sse or something to do blocks at a time, but the article i read on that didnt explain it well enough for me to understand. Is this perhaps the method your talking about?
  2. fill me in with more info on the quad/tile idea? are you talking about dividing up the screen? the problem i see with this idea is most polys will end up in the same tiles on the screen when you render a model anyways. If you deferred any rasterisation till the end once all meshes had been processed than it might be a different story.
  3. supagu

    Fast memset

    this requires your data to be in an stl container, i think, which it is not
  4. i have an array of floats (4bytes) and i want to set this array to 1.f for each entry as fast as possible. I tried memset, but that only accepts a char sized value to set At the moment I have this: // clear depth buffer { int count = (int)floorf(float(mWidth * mHeight) / 4.f); __m128* depthBuf = (__m128*)mDepthBuffer; __m128 clearDepth = _mm_set_ps1(1.f); int i = 0; for (int c = 0; c < count; ++c, i += 4) { *depthBuf = clearDepth; ++depthBuf; } for (; i < (mWidth * mHeight); ++i) mDepthBuffer = 1.f; } but its 2 slow.
  5. hrmm seems with the multi buffering it might be more hassle than its worth seems like any savings you might make could be offset by having to combine the buffers each frame.
  6. im thinking of combining my method of spliting the poly in to multiple divisions with the multi buffering. The problem is how to do this in a lock-less fashion if possible. say i have 2 threads. so i have 2 render buffers, so i can render up to 2 triangles at once. but each triangle gets chopped in to multiple. so the thread gets to render part of the triangle, to a certain buffer. need to work out how to work out what buffer to render too. IE. some way to say triangle index of 3 needs to go to buffer 1, triangle index of 4 goes to buffer 0. this needs to be done when i start rendering the first block of a new poly as to automatically balance rendering between the 2 buffers.
  7. i've sort of thought of doing a multi buffer thing where they get merged, but im not sure if this would cause issues with sorting/blending i suspect it would cause problems
  8. currently i have a software renderer that is single threaded. I want to make it multithreaded so whipped up some test code thats draws a single triangle that takes up half the screen. I divide the triangle in to the number of threads i have and each thread renders a block of the triangle. this is giving me a more than 50% improvement. How ever im not sure how this would work in real world especially if there are lots of small triangles. I guess i could dynamically adjust number of divisions of the triangle based on its size, but then i have wasted threads doing nothing. I've read up on larabee that they put triangles in to bins based on screen location so they can draw multiple triangles at once. Not sure if i should try this or some other methods? Ideas, thoughts?
  9. Looking here im trying to implement this code in maxscript(z is up). http://www.codeguru.com/cpp/misc/misc/math/article.php/c10123__3/ mFov = 140.57 -- degrees mCotFOV = (1.0 / (tan (mFov / 2.0) ) ) -- cotangent mNear = 10 --0.1 -- cm mFar = 70 --0.7 -- cm A = (1.0 / mAspect) * mCotFOV B = mCotFOV C = mFar / (mFar - mNear) D = -((mFar * mNear) / (mFar - mNear)) E = 1 mProjectionMatrix = Matrix4 0 mProjectionMatrix.row1 = Point4 A 0 0 0 mProjectionMatrix.row2 = Point4 0 B 0 0 mProjectionMatrix.row3 = Point4 0 0 C D mProjectionMatrix.row4 = Point4 0 0 E 0 and it returns this matrix, which is wrong proj matrix:(matrix4 [0.201573,0,0,0][0,0.358352,0,0][0,0,1,-11][0,0,1,0]) I cant attach a pic here, but what I can see happening is that the scale values are to small(x, y and z). No idea why. Everything else seems ok. I divide my output point/position by its w value.
  10. Im trying to do this via maxscript to bear with me :) What im trying to do is to convert my mesh into camera space using the code from here http://msdn.microsoft.com/en-us/library/ms537094.aspx. It works ok but the depth values arent working. For example I set my near plane to 4cm and my far to 7 cm and put my teapot further away than 7cm and it still shows up inside my unit cube :( This is the matrix I am generating here (matrix4 [8,0,0,0][0,3,0,18][0,0,8,0][0,-1,0,0]) -- for testing, clipping planes mNear = 40 -- cm mFar = 70 -- cm -- http://msdn.microsoft.com/en-us/library/ms537094.aspx A = (right + left) / (right - left) B = (top + bottom) / (top - bottom) C = (mFar + mNear) / (mFar - mNear) D = (2 * mFar * mNear) / (mFar - mNear) E = -1 F = (2 * mNear) / (right - left) G = (2 * mNear) / (top - bottom) -- NOTE: Need to rotate OGL matrix right to get a 3ds matrix!! mProjectionMatrix = Matrix4 0 -- my own matrix structure mProjectionMatrix.row1 = Point4 F 0 A 0 mProjectionMatrix.row2 = Point4 0 G B 0 mProjectionMatrix.row3 = Point4 0 0 C D mProjectionMatrix.row4 = Point4 0 0 E 0 mProjectionMatrix.print() mNumVerts = mGeometry.numverts for i = 1 to mNumVerts do ( mVertPos = meshop.getVert valGeometry i mNewVertPos = mVertPos * mViewMatrix -- camera view matrix mNewVertPos = mProjectionMatrix.multiplyPoint mNewVertPos -- multiply my projection matrix and the point of a mesh meshop.setVert valGeometry i mNewVertPos ) -- mesh is output in the 3ds max viewport
  11. i have a laptop and was thinking it would be cool to be able to have some game im working on to support gestures from my laptops touchpad. Not sure if laptop mouse pads support multiple inputs at once, but im guessing they might. Im wondering if there is some way to access this information from c++ in windows (im running vista). Some special mouse API perhaps? thoughts and ideas appreciated.
  12. there's a formula here which might be of some help: http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/lookat.html
  13. your c looks reasonable. I would suggest trying the simplest shader possible though. That shader will definitely not work with the simple c code you have there.
  14. Quote:Original post by Morrandir Step-by-step it would look like this: - 1. triangle is skipped - 2. triangle - add the upper vertex to the point list, set starting point of the best line to this point - all subsequent triangles skipped this will only work from bottom to top, doing it the other way the result will be the same
  15. ive thought of adjust the best line, but that would also result in a similar line (the same in the above case). I've also thought of working forwards till i hit a point, then work backwards till i hit a point rinse and repeat, but again, it wouldnt be the optimal line
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!