XNA Creators Club Online
Page 1 of 1 (7 items)
Sort Posts: Previous Next

rendering spheres

Last post 03-13-2008 3:30 PM by jwatte. 6 replies.
  • 12-10-2007 5:04 AM

    rendering spheres

    The rendering of spheres I've seen are based on triangulation of the sphere surface but shouldn't it be possible to do something clever with the shader instead? The whole illusion of a sphere is based on light reflected from points on the sphere surface and it shouldn't be necessary to first divide it up into triangles. A sphere is such a simple geometry.

    Any ideas?

     

  • 12-13-2007 1:53 AM In reply to

    Re: rendering spheres

    Given the effort it would take to draw a sphere on a 2D plane then use shaders to give the illusion of 3D it would both be time consuming and wouldn't necessarily yield any performance advantage, in fact I wouldn't be surprised if it did the opposite.     
  • 03-05-2008 3:10 PM In reply to

    Re: rendering spheres

    Glad to see I'm not the only one thinking along these lines.  This is one of my current research projects uj10.  As it turns out, rendering a sphere on a sprite is one of the easiest geometry to do.  The cost is 1 vertex and only about 4 lines of vertex and pixel shader code.  No aliasing, and the effect is independent of the view angle and render resolution.

    I'm making a render engine based on this technique and others.  Which I hope to have finished by the 4th quarter 08.

    -TS-
  • 03-05-2008 6:06 PM In reply to

    Re: rendering spheres

    Interestingly enough ATI (or should I say AMD!) had a DX10.1 demo that did exactly this to bounce thousands of balls around. The balls were just 2d imposters but had full lihting effects added with shaders.

    Check out the pictures in this presentation http://developer.amd.com/assets/GDC_2008_DirectX10.1.pdf (since its DX10.1 i dont know if there are any binaries out there to try)


    The ZBuffer News and information for XNA
    Please read the forum FAQs - Bug reporting
  • 03-05-2008 6:41 PM In reply to

    Re: rendering spheres

    Thanks for the link Zman.  That kind of confirms my decision to go with DirectX10.  I think it's going to prove to be a worthwhile investment.

    10.1 looks even more promising.

    -TS-
  • 03-13-2008 2:54 PM In reply to

    Re: rendering spheres

    It is not that difficult given that the "spherical gradient" concept has been around for a long time in software. Just implement it in a shader as a lightmap for "textured" spheres or as a color map for solid color spheres.
  • 03-13-2008 3:30 PM In reply to

    Re: rendering spheres

    The main problem is that, to get correct depth, you have to modify Z in the pixel shader, which kills early Z testing. For thousands of bouncing spheres, that doesn't matter so much. For your typical sewer-crawling FPS game, however, that matters.

    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
Page 1 of 1 (7 items) Previous Next