Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 27 Feb 2012
Offline Last Active Dec 20 2013 10:29 AM

Posts I've Made

In Topic: depth layer number

22 November 2013 - 10:42 AM

Thanks for your kindly reply.

So we have a progressive refinement with each pass, and already the first pass gives you results. It usually makes no sense to look for very deep layers
I don't konw this meaning.


My question is that, I want a number of depth images to represents a scene. However, I don't know how much the layer number is.  I hope to find a specific pass that tell me how many fragment  N (also can be known as layers because 1 layer issues one fragment) in each pixel of final image (u,v). Thus by rendering Nmax number of scene, we can get Nmax depth images to briefly represent this scece. 

In Topic: How to bind a 3d noise volume

22 November 2013 - 02:30 AM

I got the answer. GEM2 "nv_dds.cpp" and "nv_dds.h" could do the job.

In Topic: 24 bits texture fetch in shader

20 June 2013 - 06:21 PM

No there is not bit shifting. I use GL_DEPTH_COMPONENT which I believe matches your internal format (at opengl context creation time) which mine is 24 (I may have changed to 32 recently).

The fetch is aware of the 24, the fetch takes care of making it a float. If you have a texture that you upload as 4- bytes, or a single byte per R,G,B,A, obviously you don't convert a char to a float in your shader, it just happens.

You mean 

float depth =tex2D(depthMap, projCoord.xy).r;

is enought to get the depth number?

Acctually I fetch the R,G,B  channels value of that texture. Each value is different, but Each value is continuous on an scene object. 

In Topic: 24 bits texture fetch in shader

20 June 2013 - 10:21 AM


Attach  a color buffer as well and display that to verify that the scene is rendering properly in the depth texture and not is some random direction/camera location that is viewing nothing.

If that works then you know the depth is being written properly and that it is actually rendering into that depth texture.
 float3 sampleZ = tex2D(depthMap, projCoord.xy).xyz;

   float3  bitShifts = float3(1.0/(256.0*256.0), 1.0/256.0, 1); 
   float depth = dot(sampleZ,bitShifts);

Why are you performing a dot product on a depth value? sampleZ is the depth textures z component, what are you trying to achieve here?



The scene renders well and the color buffer is reasonable, no depth wrong things like occluded object appearing happens.

I use that as a naive understanding of GL_DEPTH_COMPONENT24 format. I took it as : depth = (r<<16+g<<8+b), which is wrong. 

And I wonder how to fetch a 24-bits internal format texture.

I  use GL_DEPTH_COMPONENT internal format as well (I think it means 8-bits internal-format, is it right), and it does not still work.The depth image looks the same as GL_DEPTH_COMPONENT24 

In Topic: Compute project triangle's area

13 May 2013 - 02:39 AM



Some other ideas are this ...


Use D3DXVec3Project to take each point of a triangle and project it to screen space.


Take the cross product of any two screen space triangle points. This is twice the area of the triangle (in screen space). 

    Thanks very much. As the area is computed without D3D or OPENGL, I must write my own rasterizer.

    I wonder if the triangles can be paremeterized into a vector, like spherical harmonics way. And the vector can by projected on a plane. Is there some ways.