# dark216

Member

5

2. ## why do we need to divide w in texture projection

oh my poor English. Please, bear with me.   I'm trying to figure out the math in texture projection. and such shader code comes to me: half4 col = tex2Dproj( _GrabTexture, i.uvgrab); //half4 col = tex2D( _GrabTexture, i.uvgrab);   I found  the difference between tex2Dproj and tex2D is    half4 col = tex2Dproj( _GrabTexture, i.uvgrab); equals to half4 col = tex2D( _GrabTexture, i.uvgrab / i.uvgrab.w); what I don't get is the reason for this.   the concept of texture projection is finding the texcoord of each vertex in projector's draw call, and convert screen coords([-1,1],  [-1, 1], [ -1,1]) to clamped texture coords ([0,1],  [0, 1], [ -1,1]) . and then the modified screen coords can be used to sample frame buffer(rt) and draw those vertices again. But it seems to me at this point it's sufficed. I don't see the reason to divide the depth field.    can anyone give me a clue.
3. ## why do we need to divide w in texture projection

I mean I built my house on the quicksand   thanks again
4. ## why do we need to divide w in texture projection

thanks to you all.   "Don't build your house on the quicksand!" that means me, I'm gonna get this clear!
5. ## why do we need to divide w in texture projection

guys, frankly, I thank you all for reply, but I still don't get it.   Why is this divide called perspective divide? and it's a  (x or y / depth) => tan( fov / 2) right?    I'm gonna go through some basic knowledge again, I must be missing sth, seriously!
6. ## why do we need to divide w in texture projection

I read this pdf just been seeing your reply, this the same with yours from wiki   http://web.cs.ucdavis.edu/~amenta/s12/perspectiveCorrect.pdf   so you mean: the implementation of tex2D actually divides w from vertex automatically? like: notTex2D(_DispMap, i.uv.xy / i.vertex.w);   and    notTex2DProj(_DispMap, i.uv.xy / i.vertex.w / i.uv.w);   right?