shultays

Members
  • Content count

    245
  • Joined

  • Last visited

Community Reputation

187 Neutral

About shultays

  • Rank
    Member
  1. maybe you can do this in shaders, how are you choosing which polygons will be sem-transparent? like they are closer to camera or what? or are they random?
  2. Java pointer or similar

    Link from Sun Web Site "Reference data type parameters, such as objects, are also passed into methods by value. This means that when the method returns, the passed-in reference still references the same object as before. However, the values of the object's fields can be changed in the method, if they have the proper access level."
  3. is there a good book or article about game physics? I am mostly interested in how two cubic objects collision are determined and more importantly handled.
  4. Java pointer or similar

    java always pass by value, it sends a copy of the reference object which refers to actual object. like in c++ void test(Object *b){ ... } Object *a = new Object(); test(a); in this case it sends a copy of the pointer a to test function. this is same in java, just you don't put * before references but again it sends a copy of a pointer (reference) to test function and if test sets b to something it does not affect a.
  5. Deferred shading

    for directional lights, you must render a full screen quad. for each pixel ps wil calculate angle between normal of pixel and direction of light and calculate the final color of the pixel using that value for point lights you can use full screen quads but it is more inefficent. a better apprach is using a light volume (for example a sphere centered at ight postion and has radius of light range). this is like shadow volumes if you know about them. basically it finds the which part of the screen will be illuminated by light. there are 3 different cases while rendering light volume if front face of model passes the depth test while back face does not, than it means that that pixel is affected by light. if both sides fails at depth test than light is completly behind of an object so it does not illuminate anything if both sides passes the depth test than light is floating in air and does not affect scene again. you need to use stencil buffers. first render backside of light volume and set stencil buffer to some specific value if depth test fails (make sure that depth write is false). you will not render anything on color buffer in this pass. in the second pass render front face of light volume but this time enable stencil test and render object if stencil buffer is equal to what we set previous pass and depth test passes. in this second pass you should render the effect of light on color buffer.
  6. I read somewhere standard pipeline is also implemented as a shader program in most modern GPUs so using it does not have any performance gain (of course if you program your shaders properly).
  7. Why in C++?

    I always imagine something like that when I see a thread like that. I am not implying you are a troll, just idea itself is funny :D
  8. Looking for artist name ideas

    vuvuzela? :P
  9. Z-Fighting

    you can render second triangle using only stencil test. render object, set stencil bits to 1 while rendering. after render picked triangle, disable depth test and enable stencil test and render if stencil buffer is 1 not sure if this is a good idea though
  10. Tiled Terrain Rendering

    this will be probably bad an idea but I think it would work. I am not that experienced with shaders and their performance lets say you have you have 4 textures, give each of them a id, 0 1 2 3. each vertex will need a 2 components for storing texture id and one for weight distrubiton between textures. for triangles, every vertex must have same texture ids but weights will be different. you will pass those to pixel shader, since ids are same they will not be interpolated but weight will be. in pixel shader you will do something like that if( id1 < 0.5) fetch texture1 and store in color1 else if( id1 < 1.5) fetch texture2 and store in color1 else if( id1 < 2.5) fetch texture3 and store in color1 else fetch texture4 and store in color1 same will go for id2. once you do a fetch operation for both textures you will interpolate two color return lerp(color1, color2, weight) again, I never tried this and not sure how well it will work or if it will work at all
  11. if you are using as2 you can use something like that _root["name"] if movie clip at root. you can specify other layers like _root.container["name"] or simply this["name"] if you are working on same layer
  12. Thank you guys!

    I made a game for my graduation project and my grade is AA :D. it would be very hard without all your help (your answers and articles in this site). seriously, this site is a great resource for people interested in game programming. here is a video from my game. fps was a bit too low due to recording and I had to close shadow volumes. it should be still considered in alpha stage I guess, there is still much to do. I hope I won't lose my interest soon and finish it.
  13. stencil buffer.. i dont get it

    you are right about first example. render the cutting shape on the stencil buffer, set every value to something specific while rendering. after that render second shape using stencil test not equal so it will render not render on cutting shape. finding outlines would be much harder. I am not sure if it is related to stencil buffers. you can search for cel shaded animation in ogre. here is the wikipedia article http://en.wikipedia.org/wiki/Cel-shaded_animation if ogre supports rendering objects as a wireframe using thick lines you can easily implement it using first method.
  14. stencil buffer.. i dont get it

    1- stencil mask is used for setting which bits of the stencil buffer will be read in stencil test. it is basically an and operation before reading the stencil buffer value (stencil value)&(stencil mask) for example if you require only right most bit of stencil buffer and other bits are used for some other tasks you can use stencil mask 0x01 so other bits will not interfere with your stencil testing. if right most bit is 1, resut will be 1 else it will be 0, other bits will not be influential 2- stencil write mask is same as stencil mask but this time it is used while writing on stencil buffer. you can specify which bits will be writable using write mask and all other bits will be preserved while writing. for example previous value in the buffer is 0xFF and you want to set right most bit to 0, you can set write mask to 0x01 and stencil value to 0x00. only right most bit will be altered and buffer values will be 0xFE 3- you can alter the value in the buffer while rendering on object using stencil operations. for example StencilPass operation will be executed if stencil test passes. for example you want to render a mirror on the scene. first job is rendering the scene normally, after that render the mirror but set stencil func to always and stencil pass to replace and stencil ref to 0x01. in this case stencil test will always pass. while rendering the mirror, it will replace the stencil buffer value with 0x01 while outside of mirror will remain 0x00. After that render the mirror scene, but use stencil test = equal and stencil ref = 0x01. change stencil operation back to keep (or set stencil write mask to 0x00) to prevent altering stencil buffer. So this time scene will be rendered if stencil buffer is 0x01 which is position of mirror. 4- it compares reference value to buffer value. if it is greater, it will be something reference > buffer. 5- There are 3 different events you can use stencil operation. stencil pass, stencil fail, stencil z fail. stencil pass operation will be trigerred if both z test and stencil test passes. stencil fail operation will be trigerred if only z test passes and stencil test fails. and stencil z fail will be trigerred if both z and stencil tests fails. stencil buffer is not a feature of ogre. it is a feature of graphics unit and graphics libraries simply change render states to use it.
  15. Particle System Help

    Quote:Original post by X Abstract X I just assumed that 2 trig function calls per particle would be really slow in a case where something like 10 000 particles are spawned all at the same time. Maybe I'm underestimating the power of a CPU though, I really don't know, that's why I'm asking. Quote:Original post by dmatter The way I handled this before was, when adding a particle, to just repeatedly generate positions for it in a rectangular region until the squared-distance between the particle and the center is less than or equal to the squared-radius of the sphere. Generally this requires only one or two attempts. That sounds really interesting. I'm probably going to try it. I don't think trig function would be that slow. I took a numerical analysis course 1-2 years before and they can be calculated as sum of series. I think it can perform it even faster by using a precalculated table and approach your input using it. although I have no idea how they are implemented. anyone knows how they are implemented? try both, but I don't think you will get any noticable performance boost. it might be even slower. it will miss the circle only 1-pi/4 ~= 20% of time but I guess dmatter's method would give a more uniform result. if you choose a random angle and radius it will tend to be on the center