Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 5 of 7 FirstFirst ... 34567 LastLast
Results 41 to 50 of 70

Thread: Deferred shading

  1. #41
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: Deferred shading

    I was hoping you'd give us details of your pre-run benchmarking, but you obviously don't do that. I do a frame or two of some basic timed tests at start-up myself.

  2. #42
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    California
    Posts
    396

    Re: Deferred shading

    Really? That seems horribly messy to the point where I wouldn't even want to mess with it.

  3. #43
    Intern Contributor NeARAZ's Avatar
    Join Date
    Dec 2006
    Location
    Lithuania
    Posts
    51

    Re: Deferred shading

    Quote Originally Posted by Leadwerks
    It would be better to just have the driver crash than to make it run in software more, in my opinion.
    Well, welcome to the wonderful world of abstractions... If it does not work, we'll switch to software! Everyone's going to be happy! *sigh*

  4. #44
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: Deferred shading

    Quote Originally Posted by Leadwerks
    Really? That seems horribly messy to the point where I wouldn't even want to mess with it.
    Messy? Since when was OpenGL tidy? Answer: 1999.
    How else can you be sure something is hardware accelerated in OpenGL? Answer: you can't, you cross your fingers and wait for the support calls.

  5. #45
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    California
    Posts
    396

    Re: Deferred shading

    NeARAZ, do you work for Unity? I probably met you when I was in Denmark. I am the guy from California that came by right when Unity 2.0 was about to be released.

  6. #46
    Junior Member Regular Contributor
    Join Date
    Dec 2005
    Location
    CA
    Posts
    113

    Re: Deferred shading

    Leadwerks:

    What is the formula that you are using to reconstruct the XYZ position from the depth buffer in your GLSL shader??

    Tks in advance!

  7. #47
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    California
    Posts
    396

    Re: Deferred shading

    Change non-linear depth value into a z value:
    Code :
    float DepthToZPosition(in float depth) {
    	return camerarange.x / (camerarange.y - depth * (camerarange.y - camerarange.x)) * camerarange.y;
    }

    buffersize is the screen dimensions:
    Code :
    float depth = texture2D(texture1,texCoord).x;
    	vec3 screencoord;
    	screencoord = vec3(((gl_FragCoord.x/buffersize.x)-0.5) * 2.0,((-gl_FragCoord.y/buffersize.y)+0.5) * 2.0 / (buffersize.x/buffersize.y),DepthToZPosition( depth ));
    	screencoord.x *= screencoord.z;
    	screencoord.y *= -screencoord.z;

  8. #48
    Junior Member Regular Contributor
    Join Date
    Dec 2005
    Location
    CA
    Posts
    113

    Re: Deferred shading

    So basically you need to pass to your shader the width & height + zFar & zNear right?

  9. #49
    Intern Contributor NeARAZ's Avatar
    Join Date
    Dec 2006
    Location
    Lithuania
    Posts
    51

    Re: Deferred shading

    Quote Originally Posted by Leadwerks
    NeARAZ, do you work for Unity? I probably met you when I was in Denmark. I am the guy from California that came by right when Unity 2.0 was about to be released.
    Yeah, I remember that

  10. #50
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    California
    Posts
    396

    Re: Deferred shading

    So basically you need to pass to your shader the width & height + zFar & zNear right?
    Yes, that is all that is require to calculate it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •