Skip to main content
14 events
when toggle format what by license comment
Nov 25 at 16:13 vote accept philB
Nov 25 at 14:54 comment added LudoProf The place to flip the normal is where we flip which root of the quadratic we're looking at (closer to the far side of the cube, rather than the near side). I've edited the code to show how to use this to flip the normal.
Nov 25 at 14:53 history edited LudoProf CC BY-SA 4.0
Adding normal-flipping logic
Nov 25 at 8:10 comment added philB Thanks, I was almost there with float3(intersect.xy, 0) considering the normal on the plane xy which is not fully correct of course. It's how to flip that I don't get. I've tried using campos distance to pixel compared to lightpos to pixel but can't get it correct.
Nov 24 at 17:25 comment added LudoProf Since we know exactly where we hit the cone, we can construct the normal analytically. I've added (commented) code demonstrating this.
Nov 24 at 17:24 history edited LudoProf CC BY-SA 4.0
Adding code for normals
Nov 24 at 12:14 comment added philB I'm trying to get normals but I'm lost. I tried this technique of normal recontruction from depth using ddx/ddy but it seems not adapted here. I also tried to find the point along the cone axis to calculate the direction of the intercept from this axis but again I'm wrong somewhere. Have you a suggestion for that?
Nov 24 at 8:13 comment added philB I had trouble with self z test result until I set cull back mode (was none). Now it works great. With a cube of size 20 I just change this line in the vertex shader: o.pos = v.vertex.xyz/20; so that the pixel shader still works on a unit based cube but display the cone correctly in the 20 unit size cube. For CamPos I did CamPos*Inverse(MVP) at the CPU level so the line in the vertex shader is now just: o.dir = CameraPos.xyz - v.vertex.xyz;
Nov 21 at 15:04 comment added LudoProf I've never needed that case myself, but I'd speculate you might do that when you need to do say a coordination / filtering / digesting step in part of a bigger process. Like an earlier dispatch created a bunch of intermediate results across many threads, and you need to do just one extra invocation to review and summarize those results down to the narrower final output you need - like identifying the highest-priority tiles to update in a virtual texture this frame, out of many candidates that were previously evaluated in parallel.
Nov 21 at 8:50 comment added philB Thanks Ludoprof for this reply. I have to adapt now. Can you comment on when it is interesting to use dispatch(1,1,1)
Nov 21 at 1:57 history edited LudoProf CC BY-SA 4.0
Simplifying vertex shader, elaborating on shading options.
Nov 21 at 1:38 history edited LudoProf CC BY-SA 4.0
Upgrading to use correct Z-sorting, better answering original question.
Nov 21 at 1:32 history edited LudoProf CC BY-SA 4.0
Upgrading to use correct Z-sorting
Nov 21 at 0:02 history answered LudoProf CC BY-SA 4.0